Jump to content

create a selection set with a created object...help


Recommended Posts

Posted

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

 

 

 

 

 

 

 

Posted
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)))

 

Posted (edited)

Maybe  "Per che me piacce"  "Because  it like me" Say a  celibe monk ........

 

 

Edited by devitg
Posted

 

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

 

image.png.fc092cd4bad1336d4741ff771d025809.png

 

 

sx2.LSP

Posted (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 by mhupp
Posted

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

 

Posted

 

Did you test it?

(command "_line" "\\" "\\" "")
(Setq ss2( ssadd (entlast)))

 

 

 

 

Posted (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 by mhupp
updated code
Posted

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

 

Posted (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 by mhupp
Posted

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)
)

 

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...