poffenberger Posted July 3, 2017 Share Posted July 3, 2017 I have a very repetitive task where I move a single piece to the nearest line's endpoint. May need to do this hundreds of times in one drawing. Please see attachment. The red text is what needs moved to the nearest line's endpoint. If there was a way to automate this it would be greatly appreciated. Thanks Paulmove text to nearest endpoint.dwg Quote Link to comment Share on other sites More sharing options...
foster5476 Posted July 3, 2017 Share Posted July 3, 2017 Actually, was able to make it work pretty nice using both of these. Point manager to set the points, then this text to point code to move the text. http://lee-mac.com/ptmanager.html http://www.cadtutor.net/forum/showthread.php?67654-Moving-Text-Block-to-adjacent-point&highlight=nearest+end+point Quote Link to comment Share on other sites More sharing options...
poffenberger Posted July 3, 2017 Author Share Posted July 3, 2017 Thanks so much for your reply. I've loaded the pt manager and the txt to point code with no luck. Could I trouble you to help walk me thru this? Been using Cad for years but no experience with code. Paul Quote Link to comment Share on other sites More sharing options...
foster5476 Posted July 3, 2017 Share Posted July 3, 2017 First I opened the Point Manager under input type select lw polyline then picked the individual lines to move the text to. Select points under output type and click ok. It should put points at the start and end points of the lines you selected. Then use the txt2pt lsp and select the red text. Hit enter and they should all move. They are for me at least. Is this where you want them to move ? You may need to go thru the help guide on the PT Manager to help navigate. Quote Link to comment Share on other sites More sharing options...
poffenberger Posted July 3, 2017 Author Share Posted July 3, 2017 Thank You, it works incredibly. I hope some day to return the favor. Paul Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 4, 2017 Share Posted July 4, 2017 I looked at this and a lisp can do it all in one go, I was just not sure exactly which line as the pline is on a layer you do a ssget using this layer from the text insertion point with a little search window and find the pline, get its mid point and then move the text to this point. Now I know which line exactly I will see if I can find time to do a auto solution. Do you want a constant offset still ? Quote Link to comment Share on other sites More sharing options...
Grrr Posted July 4, 2017 Share Posted July 4, 2017 How about to copy it like this: (defun C:test ( / txt p1 blk p2 ralop SS i ) (and (setq txt (car (entsel "\nPick the source text: "))) (setq p1 (cdr (assoc 10 (entget txt)))) (setq txt (vlax-ename->vla-object txt)) (setq blk (car (entsel "\nPick the source \"BRKRFSW\" block: "))) (setq p2 (cdr (assoc 10 (entget blk)))) (setq ralop (list (angle p2 p1) (distance p1 p2))) (princ "\nSelect \"BRKRFSW\" blocks to copy along: ") (setq SS (ssget '((0 . "INSERT")(2 . "BRKRFSW")))) (repeat (setq i (sslength SS)) (vla-Move (vla-Copy txt) (vlax-3D-point p1) (vlax-3D-point (apply 'polar (cons (cdr (assoc 10 (entget (ssname SS (setq i (1- i)))))) ralop))) ) ) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 6, 2017 Share Posted July 6, 2017 Nice one Grr next task maybe something like add to top or add to bottom of text. Pick top line in the sample dwg "white text" then window select other text and redo as new text using top text insertion point. Make a list of text sort on Y val (( x y "4.3 afb")( x y "0.1 cal /" )) I am busy at moment else would do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.