AutoCAD Visual LISP / AutoLISP :: Filter Selection Set By Substring With SSGET?

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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: SSGET With Additional Filter?

Jan 6, 2014

I've been twigging around with a selectionset, but no luck. I need to build a ss with several named blocks and a few dynamic blocks which get selected as anonymous. Unfortunately not all dynamic blocks should be selected and I can find no way of either filtering out a list of dynamic blocks to exclude nor any way to campare to a list of dynamic blocks that I want selected. Below is the best idea that I had but if I wrap it into a foreach with an exclusion list, I get an empty selection set returned. (I'm guessing that I need to trim the pairs each iteration and only return the matches instead.)

(SETQ blklst (LIST "Cleaner" "DRAIN" "Return" "Therapy""PoolLight" "Paraleveler" "Waterleveler" "Skimmer" "UMSLEEVE") blst "Cleaner, DRAIN, Return, Therapy,PoolLight,Paraleveler,Waterleveler,Skimmer,UMSLEEVE")(IF (AND (SETQ ss (SSGET "x" (LIST '(0 . "INSERT") (CONS 2 (STRCAT "`*U*" blst)) '(410 . "Model")))) (FOREACH i blklst (MAPCAR '(LAMBDA (x)(IF (NOT (EQ i (VLA-GET-EFFECTIVENAME (VLAX-ENAME->VLA-OBJECT (CADR x)))))(SSDEL (CADR x) ss) ) ) (SSNAMEX ss)) ) ) (WHILE (SETQ Ent (SSNAME ss 0)) (SETQ BlkName (CDR (ASSOC 2 (ENTGET Ent)))) (IF(SETQ tempList (ASSOC BlkName EndList)) (SETQ EndList (SUBST (CONS BlkName (1+ (CDR tempList))) tempList EndList))(SETQ EndList (CONS (CONS BlkName 1) EndList)) ) (SSDEL Ent ss) ))

 The other code is long and I'd rather not confuse things; if I do not try to filter out any Unames, then everything works great and fast. Once I add in the "foreach i blklst" the code breaks and I get:
 
; error: null interface pointer: #<VLA-OBJECT 0000000000000000>
 returned.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Filter If SSGet Is Empty

Jan 23, 2013

I wonder if I have to check if the "ssget" is empty.

I have a lisp to zoom extents in visible objects on the screen.

My interest is to filter before applying:If I have selected objects, it zooms in these objects. If I'm not have selected objects, continue as it is today, applying a zoom in the visible scene.

The result would be similar to a zoom of "3dsmax" (press the Z key)

The atual code

(defun c:ZOBJECTS(/ selectprev)(SETQ selectprev (SSGET "_P"))(command "._UCS" "View")(command "._zoom" "extents")(command ".__zoom" "object" "cross" "-1e99,-1e99" "1e99,1e99" "")(command "._UCS" "previous")(command "._select" selectprev ""))

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selection Set Filter

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

AutoCAD Visual LISP / AutoLISP :: How To Retrieve The SSGET Output

Jan 9, 2013

I try to use the SSGET function, and it returnes a string.

How to access the data?

Which function to use?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: SSGET Filters - Isolate Portion Of DXF 10

Jun 28, 2012

Is there any way to isolate an item in a list for a filter?  I'm setting a filter for SSGET and know that I can use the dotted pairs and I know I can use logical comparisions but what I really want to do is filter a single varialbe in the DXF group 10.  For example, I'd like to only get entities with a specific Z value in DXF 10.  Or even better to filter for a specified range of Y value or X value in DXF 10.  If I could write something like (cons 10 (list * * 8.0)) where the asterisks were wild cards, that would do it but I'm not aware of such a wildcard.  Is there any way to isolate a portion of DXF 10 in the filter?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: SSGET For Selecting Multiple Objects

Nov 27, 2012

I have this code that I wrote years ago that I want to update to select two types of civil3d objects and show them selected with grips on the screen. This function works fine

(defun CELFEATURE ()
(ssget "_X" '((0 . "AECC_FEATURE_LINE")))
(setq sset (ssget "P"))
(if sset
(progn
(sssetfirst sset sset)
;(command "_.PROPERTIES")
)
)
)
(defun cF () (CELFEATURE))

but if I add the extra object like this which I assume is the wrong syntax i only get the second type of objects. Need correct syntax I should be using for selecting more than one object in an ssget statement.

(defun CELFEATURE ()
(ssget "_X" '((0 . "AECC_FEATURE_LINE","AECC_AUTO_CORRIDOR_FEATURE_LINE")))
(setq sset (ssget "P"))
(if sset
(progn
(sssetfirst sset sset)
;(command "_.PROPERTIES")
)
)
)

(defun cF () (CELFEATURE))

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Distinctions Between Ssget And C# PromptSelectionOption Method

Feb 5, 2012

Distinctions between AutoLISP functions ssget and C# PromptSelectionOption method.AutoLISP ssget function is apply a function with no options and does not require an object selection.pre-selected target object should respond to the selection set.

However, and C# PromptSelectionOption, ignoring the pre-selected objects, select the new object is required.using the features of C# Prompt Selection Option expressed AutoLISP ssget do the same in,

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using SSGET To Select A Block To Move It

Feb 3, 2012

I'm having an issue with using the SSGET to select a block so I can move it. I'm changing the UCS to be at the center of the top view in the program(user selects center) and the block is at 0,0,0 after changing the UCS. However when I use SSGET it doesn't select it. So I used:

(setq en(car (entsel "
Select a block :")))(setq enlist(entget en))
 
and it lists the DXF Code of 10 as

(10 15.0893 13.5165 0.0)
 
How can I then select it if I don't necessarily know where the block is going to be?

If needed: AutoCAD 2013 User using Visual LISP for editing LISP and DCL files Also I have AutoCAD 2011 currently still available for us, but we are using AutoCAD 2013 for 99.9% of AutoCAD use

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert Polyline - Bad SSGET List

Feb 5, 2013

I have a data structure called LayerList in the format [LIST "LayerName" "Linetype" Thickness Color]I then use the following piece of code to go through the structure selecting polylines and converting all polylines on a given layer to the correct thickness

   (foreach layr layerlist
       (setq player (car layr))
              (if (setq ss (ssget "x" '((0 . "*polyLINE") (8 . player ) )))
                      (command "pedit" "m" ss "" "w" 0.15 "")
                      (princ "
No polylines exist!")
      )
   ) 

However all i keep getting is Bad SSGET list value at the command line,

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: SSGet Specific Dynamic Block / Since They Are Anonymous

Sep 19, 2011

If you do a LIST command on a dynamic block... AutoCAD tells you the Block Name as well as the Anonymous Block name.

How can I use ssget to snag all Dynamic Blocks that use the 'Real Block'?

View 3 Replies View Related

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 View Related

AutoCAD Visual LISP / AutoLISP :: Unreconciled Layer Filter

Jun 2, 2013

How to automate the unreconciled layer list to automatically freeze all the layers in the list when opening drawing.  This would force the user to select what layers they want shown rather than freezing / turning off the layers they don't want.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Filter For Specific Attribute Tag

Aug 30, 2011

How would one modify

(= (cdr (assoc 0 data)) "ATTRIB")

in order to filter for a certain attribute tag named MYTAG

I am working with a custom LISP routine which reports out to a CSV file, an attribute extraction file - but I need my routine to ONLY evaluate blocks which have the MYTAG attribute tag. Then, if it passes that first check, it evaluates another list of Tags within those blocks - a list of tags which I have specified elsewhere in the code.

I am trying to modify my existing code as little as possible, and I think that if I do it at the line (which I've pasted above) - that will "pre-qualify" my selection set....

ATTACHED LISP IS THE FILE I AM WORKING WITH --- THE ACTUAL LINE I WANT TO MODIFY IS AT:

"(while (eq ENSUB "ATTRIB")"

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Selection Set During Pasteblock?

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

AutoCAD Visual LISP / AutoLISP :: Selection Set By Block Name?

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

AutoCAD Visual LISP / AutoLISP :: Getting A Selection Set After Paste

Feb 28, 2013

Is it possible to get a selection set of what was just pasted into drawing? 

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Selection Set For Routine?

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

AutoCAD Visual LISP / AutoLISP :: Adding To A Selection Set

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

AutoCAD Visual LISP / AutoLISP :: VLA-MOVE A Selection Set?

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

AutoCAD Visual LISP / AutoLISP :: Copy Selection Set From P1 To P2?

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

AutoCAD Visual LISP / AutoLISP :: Extended Data On 2D Entity - Filter List

Apr 30, 2012

I use extended data on 2d entity in AutoCAD 2010. In a lisp program, I have filtered with extended data selection. Filters work with entity like: line, polyline and Mline but with insert entity it don’t work.

The end get result for a block :

((-1 . <Nom d'entité: 7ffffbe7d90>) (0 . "INSERT") (330 . <Nom d'entité: 7ffffb039f0>) (5 . "18CA91") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Fam_POTEAU_ROND_INSERT_021") (100 . "AcDbBlockReference") (2 . "POTEAU_ROND") (10 155239.0 -100209.0 0.0) (41 . 16.05) (42 . 16.05) (43 . 16.05) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0) (-3 ("CREEMET000" (1000 . "Fam021") (1040 . -14.0) (1040 . 434.0) (1071 . 0)) ("CREEMET001" (1071 . 2) (1071 . 3) (1071 . 0)) ("CREEMET014" (1000 . "Poteau rond mixte (a completer)")) ("CREEMET002" (1000 . "_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_-1_-1_-1"))))

The filter list use :

((-4 . "<OR") (2 . "POTEAU_ROND*") (-4 . "OR>") (-3 ("CREEMET002" (1000 . "_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_-1_-1_-1"))))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Browse For DWG File Selection?

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

AutoCAD Visual LISP / AutoLISP :: Folder Selection Dialogue Box?

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

AutoCAD Visual LISP / AutoLISP :: Dimensions And Selection Sets

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

AutoCAD Visual LISP / AutoLISP :: Setting A Previous Selection To Nil?

Jan 12, 2012

How to Set a previous selection to nil from say a move command? 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Dimension Between Two Points In A Selection Set

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

AutoCAD Visual LISP / AutoLISP :: Paperspace Selection Sets

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

AutoCAD Visual LISP / AutoLISP :: Get Exploded Block Into A Selection Set

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

AutoCAD Visual LISP / AutoLISP :: VLA Move With Selection Sets

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

AutoCAD Visual LISP / AutoLISP :: Window Selection Of Attributes

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







Copyrights 2005-15 www.BigResource.com, All rights reserved