Nad SK Posted September 29, 2007 Share Posted September 29, 2007 (edited) I have stusk with this code. Who knows about that please show me. Thank. I want to select all the text in the window on layer Note (while (setvar "osmode" 32) (SETQ p ( getpoint "\nPick point")) (setvar "osmode" 0) (setq p1 (polar p (/ (* pi 3) 4) 15)) (setq p2 (polar p (/ pi -4) 15)) ;(command "line" p1 p2 "") ;; OK (setq la (ssget "W" 'p1 'p2 '((0. "TEXT") (8. "Note"))));; Stusk here. (setq ds (ssget (list la )) Edited July 22, 2013 by SLW210 Quote Link to comment Share on other sites More sharing options...
CAB Posted October 1, 2007 Share Posted October 1, 2007 Perhaps this will get you started. (defun C:Ctext (/ p p1 p2 la) (setvar "cmdecho" 0) (while (progn (setvar "osmode" 32) (setq p (getpoint "\nPick point")) (setvar "osmode" 0) (setq p1 (polar p (* pi 1.25) 50)) (setq p2 (polar p (* pi 0.25) 50)) ;(command "line" p1 p2 "") (if (setq la (ssget "C" p1 p2 '((0 . "TEXT") (8 . "Note")))) (progn (command "TEXT" "j" "mc" p 0 (rtos (sslength la) 2 2) "") ;(command "-LAYER" "s" 0 "") ) ) ) ) ; while (setvar "cmdecho" 1) (princ) ) ; end Quote Link to comment Share on other sites More sharing options...
Nad SK Posted October 2, 2007 Author Share Posted October 2, 2007 (edited) Thank CAB (command "TEXT" "j" "mc" p "" "" (rtos (sslength la) 2 2));OK Edited July 22, 2013 by SLW210 Quote Link to comment Share on other sites More sharing options...
spiker7221 Posted July 19, 2013 Share Posted July 19, 2013 Good morning/afternoon CAB, This is some great code. Exactly what I've been looking for. But I still need your expertise. Can you explain what the 1.25 and 0.25 is doing? I understand the math. Also, the 50 value...is this a radius, or rectangle? Here's my scenerio: Routine #1 draws a line and labels it at the midpoint with it's length text. Routine #2 then splits the line in to two parts, labels these 2 new parts. How can I use your approach to delete the old original piece of text? Can I set the SSGET crossing to a rectangular box....along the length of the original line? Perhaps this will get you started. (defun C:Ctext (/ p p1 p2 la) (setvar "cmdecho" 0) (while (progn (setvar "osmode" 32) (setq p (getpoint "\nPick point")) (setvar "osmode" 0) (setq p1 (polar p (* pi 1.25) 50)) (setq p2 (polar p (* pi 0.25) 50)) ;(command "line" p1 p2 "") (if (setq la (ssget "C" p1 p2 '((0 . "TEXT") (8 . "Note")))) (progn (command "TEXT" "j" "mc" p 0 (rtos (sslength la) 2 2) "") ;(command "-LAYER" "s" 0 "") ) ) ) ) ; while (setvar "cmdecho" 1) (princ) ) ; end Quote Link to comment Share on other sites More sharing options...
CheSyn Posted July 19, 2013 Share Posted July 19, 2013 The 1.25 and 0.25 are used to set the angle. The 50 is a distance value. I'm not sure what you are trying to accomplish? Do you want the line to split at a predetermined point (ie. always the midpoint), or does the user specify a point to split the line at? Good morning/afternoon CAB,This is some great code. Exactly what I've been looking for. But I still need your expertise. Can you explain what the 1.25 and 0.25 is doing? I understand the math. Also, the 50 value...is this a radius, or rectangle? Here's my scenerio: Routine #1 draws a line and labels it at the midpoint with it's length text. Routine #2 then splits the line in to two parts, labels these 2 new parts. How can I use your approach to delete the old original piece of text? Can I set the SSGET crossing to a rectangular box....along the length of the original line? Quote Link to comment Share on other sites More sharing options...
spiker7221 Posted July 19, 2013 Share Posted July 19, 2013 Good afternoon CheSyn, No, the user will pick the split point. I'm trying to delete the old original piece of text....by creating an SSGET crossing box....along the length of the original line? I.E...When the use picks the split point anywhere along line A, I want to expand out from that point at the angle of line A searching for the piece of text to delete. There will be other lines with text labels on them nearby I don't want to delete. Just want to delete the text associated with the line the point was on... Does that make sense? Thanks for your help, Mike Quote Link to comment Share on other sites More sharing options...
CheSyn Posted July 19, 2013 Share Posted July 19, 2013 I'm not sure how much text is in your drawing, but something like this could work. It just looks for text that has a value equal to the length of the line selected and at the same rotation. Let me know if something like this works for you. (setq line (car (entsel "\nSelect the line : "))) (setq start (cdr (assoc 10 (entget line))) end (cdr (assoc 11 (entget line))) ang (angle start end) dist (distance start end) diststr (rtos dist 2 2)) (setq texset (ssget "_x" (list '(0 . "TEXT") (cons 1 diststr) (cons 50 ang)))) (command "_.erase" texset "") Quote Link to comment Share on other sites More sharing options...
CAB Posted July 19, 2013 Share Posted July 19, 2013 Mike, It's often helpful to post a sample DWG so people can actually see what you are doing. I'm packing for vacation tomorrow so no time on my end. Looks like you are in good hands. 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.