leonucadomi Posted December 19, 2022 Posted December 19, 2022 hello al: for a routine I'm doing... I use (command "_line" "\\" "\\" "") to create a line How can I introduce that line created in a variable that is a selection set? example: I have this code... (setq ss2 (ssget "+.:E:S" '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE")))) but I want I don't want to select....LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE I want to make a line and save it in ss2. I tried entlast and it doesn't work for me help please Quote
devitg Posted December 19, 2022 Posted December 19, 2022 57 minutes ago, leonucadomi said: hello al: for a routine I'm doing... I use (command "_line" "\\" "\\" "") to create a line How can I introduce that line created in a variable that is a selection set? example: I have this code... (setq ss2 (ssget "+.:E:S" '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE")))) but I want I don't want to select....LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE I want to make a line and save it in ss2. I tried entlast and it doesn't work for me help please (command "_line" "\\" "\\" "") (Setq ss2( ssadd (entlast))) Quote
ronjonp Posted December 19, 2022 Posted December 19, 2022 @leonucadomi Why do you need to put one line into a selection set? Quote
devitg Posted December 19, 2022 Posted December 19, 2022 (edited) Maybe "Per che me piacce" "Because it like me" Say a celibe monk ........ Edited December 19, 2022 by devitg Quote
leonucadomi Posted December 19, 2022 Author Posted December 19, 2022 ok I'll tell you why, I want a do a routine that 1.- select objects (LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE) 2.- then ask me for two points that pass through those objects and the objects break at the intersection with that line. as it does command slice with solids. so i found a routine that does it but the line has to be previously drawn and I want to avoid that step. modify the command , call it sx2 sx2.LSP Quote
mhupp Posted December 19, 2022 Posted December 19, 2022 (edited) (defun c:AddLine (/ pt1 pt2) (setq pt1 (getpoint "\nSpecify First Point: ")) (setq pt2 (getpoint "\nSpecify next point: " PT1)) (entmake (list (cons 0 "LINE") (cons 10 pt1) (cons 11 pt2))) (setq l (entlast)) (princ) ) A little out of date http://www.theswamp.org/index.php?topic=10370.0 Edited December 19, 2022 by mhupp Quote
leonucadomi Posted December 19, 2022 Author Posted December 19, 2022 you already try to use "entlast" I need to modify this code (setq ss2 (ssget "+.:E:S" '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE")))) instead of selecting that variety of objects draw a line that is selected and is stored in ss2 Quote
devitg Posted December 19, 2022 Posted December 19, 2022 Did you test it? (command "_line" "\\" "\\" "") (Setq ss2( ssadd (entlast))) Quote
leonucadomi Posted December 19, 2022 Author Posted December 19, 2022 http://www.theswamp.org/index.php?topic=10370.0 I have not been able to enter here I don't know what to put here Quote
mhupp Posted December 19, 2022 Posted December 19, 2022 (edited) Keep sx2 loaded and use this. ;;====================================================== ;; Break Selected Objects with Line ;;====================================================== (defun c:BSOL (/ cmd ss1 ss2 tmp) (command "_.undo" "_begin") (setvar "CMDECHO" 0) (setq Bgap 0) ; default (setq pt1 (getpoint "\nFirst Point: ")) (setq pt2 (getpoint "\nNext Point: " PT1)) (entmake (list (cons 0 "LINE") (cons 10 pt1) (cons 11 pt2))) (setq ss1 (ssadd (entlast))) (prompt "\n*** Select object(s) to break with line: ***") (if (and (setq ss2 (ssget '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE")))) (not (ssredraw ss1 4)) ) (break_with ss2 ss1 nil Bgap) ; ss2break ss1breakwith (flag nil = not to break with self) ) (setvar "CMDECHO" 1) ;(ssdel (ssname ss1 0)) ;delete line after? (command "_.undo" "_end") (princ) ) Edited December 20, 2022 by mhupp updated code Quote
leonucadomi Posted December 20, 2022 Author Posted December 20, 2022 I already tried it thanks but it does the reverse, I mean, the line that is drawn is the one that is broken and what I want is for the selected objects to split Quote
mhupp Posted December 20, 2022 Posted December 20, 2022 (edited) 11 minutes ago, leonucadomi said: I already tried it thanks but it does the reverse, I mean, the line that is drawn is the one that is broken and what I want is for the selected objects to split Then flip SS1 and SS2 in the code (break_with ss1 ss2 nil Bgap) ; ss1break ss2breakwith (flag nil = not to break with self) to (break_with ss2 ss1 nil Bgap) ; ss2break ss1breakwith (flag nil = not to break with self) Edited December 20, 2022 by mhupp Quote
tombu Posted December 20, 2022 Posted December 20, 2022 This old lisp prompts to pick endpoints for the line to trim and using the second point as the start of a trim line prompts for a third point for the other end of the fence line. Deletes trim line automatically. (Defun C:trimfen (/ PT1 PT2 AX SSF pt_list flag EN) (prompt "\nTrim Line routine... ") (setq PT1 (getpoint "\nBegining point of trimming line: ")) (setq PT2 (getpoint PT1 "\nEnd point of trimming line: ")) (setvar "CMDECHO" 0) (VL-CMDF "._UNDO" "_BEgin") (entmake (list '(0 . "LINE") '(62 . 120)(cons 10 PT1)(cons 11 PT2))) (setq AX (entlast)) (redraw AX 3) (setq PT1 (getpoint PT2 "\nEnd point of fence line for selection: ")) (setq pt_list (list PT1 PT2)) (setq SSF (ssget "F" pt_list) flag nil) (VL-CMDF "._trim" AX "" "f" PT1 PT2 "" "") (while (and(not flag)(/= 0(sslength SSF))) ;repeat each segment of the fence (setq EN (entlast)) ;until no new ents are created. (setq SSF (ssget "F" pt_list)) (VL-CMDF "._trim" AX "" "f" PT1 PT2 "" "") (VL-CMDF "._extend" AX "" "f" PT1 PT2 "" "") (if (equal EN (entlast))(setq flag T)) );while (entdel AX) (VL-CMDF "._UNDO" "_End") (princ) ) Quote
leonucadomi Posted December 20, 2022 Author Posted December 20, 2022 3 hours ago, tombu said: This old lisp prompts to pick endpoints for the line to trim and using the second point as the start of a trim line prompts for a third point for the other end of the fence line. Deletes trim line automatically. (Defun C:trimfen (/ PT1 PT2 AX SSF pt_list flag EN) (prompt "\nTrim Line routine... ") (setq PT1 (getpoint "\nBegining point of trimming line: ")) (setq PT2 (getpoint PT1 "\nEnd point of trimming line: ")) (setvar "CMDECHO" 0) (VL-CMDF "._UNDO" "_BEgin") (entmake (list '(0 . "LINE") '(62 . 120)(cons 10 PT1)(cons 11 PT2))) (setq AX (entlast)) (redraw AX 3) (setq PT1 (getpoint PT2 "\nEnd point of fence line for selection: ")) (setq pt_list (list PT1 PT2)) (setq SSF (ssget "F" pt_list) flag nil) (VL-CMDF "._trim" AX "" "f" PT1 PT2 "" "") (while (and(not flag)(/= 0(sslength SSF))) ;repeat each segment of the fence (setq EN (entlast)) ;until no new ents are created. (setq SSF (ssget "F" pt_list)) (VL-CMDF "._trim" AX "" "f" PT1 PT2 "" "") (VL-CMDF "._extend" AX "" "f" PT1 PT2 "" "") (if (equal EN (entlast))(setq flag T)) );while (entdel AX) (VL-CMDF "._UNDO" "_End") (princ) ) I did not understand what it does Quote
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.