AutoCAD Visual LISP / AutoLISP :: Remove A Selection Set From A Selection Set
Nov 15, 2013
I've created a lisp that draws the boltholes of a pipe flanges, using the correct number of holes, at the correct diameter at the correct bolt-hole diameter and then rotates. Everything works seamlessly, when i do just one flange. But I've discovered that fewuently there will be mulitple times when a user will have to perform the command.
So the idea I had was to do the following:
Select all circles with (setq CirclesFirst (ssget "X" (list (cons 0 "CIRCLE"))))
Go through the code to create the new circles.
Select all circles with (setq Circles (ssget "X" (list (cons 0 "CIRCLE"))))
Remove selection set "CirclesFirst" from "Circles".
But what for some reason (command "_.select" Circles "R" CirclesFirst "") does not work.
View 9 Replies
ADVERTISEMENT
Apr 10, 2012
I'm trying to fix an issue with entlast where if the user hits escape during the process, the wrong entity gets erased, etc. Here's the problem code...
From a function that would have just inserted a dynamic block at 0,0 then modified it - here's where we pick up..
(SETQ ss (SSGET "L"))
(vl-cmdf "_.copybase" (getvar "LASTPOINT") ss "")
(prompt "
Pick insertion point... then rotation angle ")
(vl-cmdf "erase" ss "")
(vl-cmdf "_.pasteblock" PAUSE)
(setvar "polarmode" 1)(setvar "autosnap" 63)(setvar "osmode" osm1)
(vl-cmdf "_.ROTATE" (entlast) "" (cdr (assoc 10 (entget (entlast)))) PAUSE)
(vl-cmdf "_.EXPLODE" (entlast) ""
)
I would like to do..(setq ss (vl-cmdf "_.pasteblock" PAUSE)), but of course, that doesn't work - it returns "T".
My goal is to get rid of the entlast usage from the last two lines - unexpected cancels rotate and explode the wrong entities.
If I try (setq ss (entlast)) or (ssget "L") after the pastblock, I might still get the wrong selection set if the user hits cancel before picking.
View 4 Replies
View Related
Mar 2, 2012
I am trying to select all blocks of a certian name. I am using the following:
(setq ss1bk (ssget "_X" (list (cons 2 blkname))))
My issue is that this will not select any dynamic or attribute blocks that are not at the default insert state.
how to select all of a block by name including reguardless of current state?
View 9 Replies
View Related
Feb 28, 2013
Is it possible to get a selection set of what was just pasted into drawing?
View 8 Replies
View Related
Apr 23, 2013
I'm putting together some quick function that I can send 2 arguments and get from it the total area of a given hatch on the given layer. I think everything is in order but I'm having trouble with the selection set filter:
(DEFUN GET-HATCH-AREA (HATCH LAYR / area sset) (COND((AND(ssget "X" '((0 . "HATCH") (2 . HATCH) (8 . LAYR))) (SETQ area 0) (VLAX-FOR H (SETQ sset (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) (SETQ area (+ (VLA-GET-AREA h) area))) (ALERT(STRCAT "Total area = " (IF (OR (= (GETVAR "lunits") 3) (= (GETVAR "lunits") 4) ) (STRCAT (RTOS area 2) " sq. in. (" (RTOS (/ area 144) 2) " sq. ft.)") (RTOS area) ) ) ) (VLA-DELETE sset) ) ) ))
View 9 Replies
View Related
Oct 16, 2013
with the mouse I can select objects on the screen and then start a command that uses these objects.
How can I perform this in lisp?
I can create my selection set, that's no problem, but how can I 'make it active' for an external function?
(ssget "_C" p0 p1 '((0 . "TEXT")))
???
(c:txtexp)
View 2 Replies
View Related
Jan 27, 2003
R14 Autolisp:
I can create an empty selection set (setq EMss (ssadd)). As I loop through a list I can use the counter to create selection sets on the fly by using:
(set (read (strcat "ss" (itoa cnt))) EMss) and even keep a list of the ssets created with (setq sslst (cons (strcat "ss" (itoa cnt)) sslst)). But when I try to add an ename to the ss with (ssadd ename (read (strcat "ss" (itoa cnt))), I get a error: bad argument type (SSADD NEXTE (READ (STRCAT "ss" (ITOA CNT)))).
why I can create the sets but not add to them this way? I can add to them from the command line.
View 9 Replies
View Related
Oct 3, 2011
I wrote a lisp program which creates a selection set using ssget. Then I use the bounding box commands to get the lowest point of that selection set. Now I want to move that selection set as a whole using the vla-move command. Can we vla-move a selection set?
View 8 Replies
View Related
Feb 13, 2012
I need to copy a selection set from p1 to p2.to do this I wrote the following
(defun c:test () (setq sel (ssget)) (setq p1 (getpoint "
Origine: ")) (setq p2 (gettpoint p1 "
Destination: ")) (command "_.copy" sel "" p1 p2))
works, but this way I can not see objects dynamically attached to the mouse cursor.
To visualize this effect, I noticed that I can use:
(command "_.copy" sel "" pause pause)
but in this way I can not save the variables p1 and p2: I need for these, subsequently in the rest of thefunctions lisp.
View 4 Replies
View Related
Apr 15, 2012
To get the 'File Selection dialog box' in AutoCAD via LISP, which command should I use other than 'GETFILED' ?
I have a program which using GETFILED to select the drawing file , but I think this dialog box size is too small to browse folder/file , as you cant see the favorites list and you cant resize the dialog box.
View 3 Replies
View Related
Aug 10, 2012
I'm working on a lisp that goes through a whole list of files and does different things to those files. I've been racking my brain for a way to select just a folder via a dialogue box, but haven't found a way. I'm sure it can be done with dcl, but I don't know where to start.
This would not be the standard "file" selection box, but would only list the folders and let me select one even if there are others "under" them. This is what I'd like it to look like.
I'm not sure if there is a standard AutoCAD box that I could call for this or not
View 5 Replies
View Related
Nov 1, 2011
I have a lisp routine that creates a "frame wall" and I want to be able to automatically dimension said wall within the same routine. I have created two sets of points, each set being on its own new layer. I have made selection sets of each set of points, and want to cycle through each set dimensioning as required. This what I have so far for this part of the routine:
(command "DIMSCALE" 24)
(setq sel1 (ssget "x" '("VPOINTS")))
(setq TC (polar (ssname sel1 0) (dtr 180.0) 9))
(command "DIMLINEAR" (ssname sel1 0) (ssname sel1 1)) "V" (polar TC (dtr 180.0) 9) "")
[code]...
When I run the program I get the error: bad point argument. So what I think is happening is that the ssname command is not returning the actual value but just the name? I am new to AutoLisp and even newer to selection sets so be easy... Along with this, I am also curious as to how a selection set is ordered when it is chosen ie how does it determine what would be in (ssname sel1 0). Also, how would one go about deleting the points in these selection sets after the dimensioning has been completed.
View 5 Replies
View Related
Jan 12, 2012
How to Set a previous selection to nil from say a move command?
View 5 Replies
View Related
Nov 1, 2011
Looking to make a selection set of points that are on a specific layer, and then create a dimension between, in this case, two points. I feel like it should be very simple, but I can't get it to work for the life of me. Here is the test code I've been playing around with:
(defun c:test (/ sel1 TC)
(setq sel1 (ssget "X" '((8 . "VPOINTS"))))
(setq TC (polar (entget (assoc 10 (ssname sel1 0))) (dtr 180.0) 9))
(command "DIMLINEAR" (entget (assoc 10 (ssname sel1 0))) (entget (assoc 10 (ssname sel1 1))) "V" (polar TC (dtr 180.0) 9) "")
[code].......
View 1 Replies
View Related
Jan 10, 2002
I wish to collect a selection set of blocks in paperspace of a certain name. For model space I would use the following line:
(setq x1 (ssget "_x" '((2 . "*etc*") (410 . "model"))))
when it comes to setting paperspace as the 410 ssget list value as the name can be modified and I need it to work in all drawings. I tried
setting a variable to the paperspace layout name and using a print function at the (410 . "model") point but without sucess.
View 9 Replies
View Related
Feb 8, 2012
How to get the individual components of a block that has just been exploded within a lisp routine into a selection set. I want to alter the layer of each element to the insert layer of the block. I may also make one or two other changes according to what I find in the block.
View 8 Replies
View Related
Oct 3, 2011
I wrote a lisp program which creates a selection set using ssget. Then I use the bounding box commands to get the lowest point of that selection set. Now I want to move that selection set as a whole using the vla-move command. I am having trouble doing this. Is this possible? Can we vla-move a selection set? Is there a workaround?
View 2 Replies
View Related
Oct 16, 2012
I downloaded a lisp routine that will align block attributes. The problem is I can only select the attributes one at a time. I'd like to be able select multiple attributes using the selection window or a crossing window, but I haven't had much luck. If you use the AEATTSHOW command, it give you a prompt to "select using window" by pressing W. I'd like to have the same functionality for my Align attributes routine.
Below is the portion of code I currently have to select attributes one at a time:
;* Select all attributes to align with the parent selected above and add the attribute entname and the block
;* entname to a list in format ( (AttrEntName BlkEntName) (AttrEntName BlkEntName) (AttrEntName BlkEntName) )
;*
while (/= TempAttr nil)
(setq
TempAttr (nentsel "
Select Attributes to align: ")
[Code] .........
View 5 Replies
View Related
Sep 5, 2012
I need the same funcionality as in code below, but without using "command".
The main idea is alowed user to modify Existing Selection Set.
(defun gt:ss->lst (a:ss / i lst ) ;_ / (setq i 0) (if a:ss (progn (repeat (sslength a:ss) (setq lst (cons (ssname a:ss i) lst) i (1+ i) ) ;_ setq ) ;_ repeat (reverse lst) ) ;_ progn ) ;_ if) ;_ defun gt:ss->lst(defun gt:ss_modify (a:en-lst / ) ;_ / ;;create Selection set (setq ss2 (ssadd)) (foreach f:en a:en-lst (ssadd f:en ss2) ) ;_ foreach ;;Run command and fill with initial content (command "_select" ss2) ;;Alow the user to modify the contents (while (/= (getvar "cmdnames") "") (command pause) ) ;_ while ;;get back the list of enames from modified selection set (setq ss3 (ssget "_P")) (setq ss3-lst (gt:ss->lst ss3))) ;_ defun gt:ss_modify(defun tst:gt:ss_modify ( / ) ;_ / (gt:ss_modify (gt:ss->lst (ssget)))) ;_ defum tst:gt:ss_modify
View 8 Replies
View Related
Feb 7, 2013
Tried retrieving an ActiveX selection set in AutoCAD 2013 (AutoCAD Architecture 64bit on Windows 7 is what I am using)?
Using a piece of LISP I got from the ADN developer site, it no longer works and gives this error....
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
(defun c:erset (/ acApp acDoc selSets ss1)
(vl-load-com)
(setq acApp (vlax-get-acad-object))
(setq acDoc (vla-get-activeDocument acApp))
(setq selSets (vla-get-SelectionSets acDoc))
[code].....
Unfortunately my lisp is very basic.
(defun c:getSset()
(vl-load-com)
(setq ss-vba (vla-item
(vla-get-selectionsets
(vla-get-activedocument
[code]......
What about creating an AutoLisp selection set from .NET - is it possible, if so I would prefer to do that instead?
The goal is to create some objects in .NET (using activeX or managed code) and then have some way to access these objects via the command line I'm assuming they only way is using an AutoLISP selection set.
View 5 Replies
View Related
May 7, 2012
I use menu's based upon the following snippet:
(if (or (equal choose "1"))(MYFUNCTIONSDEFINITION))
works a treat, its easy for me to understand even if maybe not totally orthadox in method.
So I can populate my code to have multiple selections such as follows.
(if (or (equal choose "1"))(MYfunctionDEFINITION1))(if (or (equal choose "2"))(MYfunctionDEFINITION2))(if (or (equal choose "3"))(MYfunctionDEFINITION3))
and so on, but the example above caters for situations the users enter the values of 1, 2, or 3. If the user enters anything else I get a nil response from AutoCAD. So I devised the following
(if nil (alert "Wrong selection"))
but no response from AutoCAD qua an alert
also tried to be more in uniform with the rest of the lisp and wrote
(if nil (MYalertRESPONSE))(defun MYalertRESPONSE ()(alert "Wrong selection"))
also fails to yield the desired response.
View 5 Replies
View Related
Apr 20, 2012
I have some strings like the ones below. They are always in the same format. The first line is Cold Water, the second is Hot Water and the third is Hot Water Return.
I want to build a selection set based on whether it is CW, HWS or HWR. Right now I have a routine to retrieve the string by using ENTSEL. In other words if I want to use the line of text for Cold Water I have to select it.
I'd like to be able to window them all and filter the SS for only the string containing CW and conversly HWS and HWR. SSGET function filter.
"2''CW-52.0 WSFU"
"2''HWS-48.0 WSFU+12 GPM"
"1"HWR-12 GPM "
View 8 Replies
View Related
Jul 11, 2012
It's possible make a fillet with window selection?
View 4 Replies
View Related
Jul 30, 2013
When you select similar using autocad it select similar in entire drawing. What i want is i am able to select similar using the same setting of selecting similar but with window selection instead of entire drawing ?
View 6 Replies
View Related
Jul 27, 2013
I need to create a command which could change a color of an allready existing selection set when activated. For example i have a command which creates a cube, where each specific group of lines were added to different selection sets. how can i recall any created selection set by its name and change its color?
View 9 Replies
View Related
Dec 15, 2011
can do a routine that zooms into a coordinate, based on input. So for 1A, it would zoom into the coordinate for 1A.
1A = 1,1
1B = 1,2
1C = 1,3
1D = 1,4
I will try to attempt one shortly and will post it within 1 hour.
View 9 Replies
View Related
Nov 19, 2011
The following function
(command "_break" ent1 p1 p2)
break a polyline into two separate polylines. How can I get a selection set with two separate polylines?
View 4 Replies
View Related
Mar 22, 2012
how to create a text selection set using rotation and oblique angles. I am working isometric drawings from a Microstation conversion and want to create a lisp to set text style to conform to current standards. For example, iso text in the right plane would be rotated 30 degrees and have an oblique angle of 30 degrees based on the style from the conversion. however,
(setq txtisor (ssget "X" '((0 . "MTEXT,TEXT")(50 . 0.523599)(51 . 0.523599)))) returns nil.
since (setq txt0 (ssget "X" '((0 . "MTEXT,TEXT")(50 . 0)))) returns all text at zero degrees, I figure there is something wrong about the way the angles are being entered.
View 9 Replies
View Related
Nov 17, 2011
I am creating a selection set using ssget...
Then I copy that selection set multiple times in a loop. What I would like to do is then rotate (or otherwise modify) the last copied group of items. If I rotate "last" it will only accept the last drawn item, so only one item in the group of copied objects will rotate.
Here is the portion of simple code I am using right now (it's in a loop so all variables with 'Next' are changing each time):
(command "_.copy" SS1 "" SS1Base NextPT)
(command "_.Rotate" "l" "" NextPT NextAng)
This works fine with a single object, but I can't figure out how to call up the entire group of objects.
Civil 3D 2011
Windows 7 x64
View 6 Replies
View Related
Nov 19, 2013
I have redined AutoCAD's copy command alias to C, but to also do other things, like set a few important variables in the background. One of the lisps I've incororated are making new viewports, that also create layers that are visibly specific to the viewport being created.
We were tasked a while ago to do an easy job of copying entities (dimensions, text and what not) in a layout. The problem is, users are copying the viewports too, which is bit more ineffificent than using the create viewport command I developed.
Is there a way to see if a selection set includes (0 . "VIEWPORT") entities? If the check returns nil, well then all is good. If the check returns "true", then I can prompt the user that a "VIEWPORT" entity is selected. I can then exit the command, or ask the user if they are sure they want to copy the "VIEWPORT" entity.
View 6 Replies
View Related
May 9, 2013
What I am trying to do is create a selection set of the "y" values of text. I've started by pulling out all the text on the drawing, but I need it to continue to grab only the "y" values of the text on the drawing.
(setq alltext (ssget "_x" (list '(0 . "TEXT"))
)
)
I've tried a bunch of different things but I am still new to lisp.
View 5 Replies
View Related