Search the Community
Showing results for tags 'ssget'.
-
How to make your selection sets shows different from others unselected
CANDOWE posted a topic in AutoLISP, Visual LISP & DCL
HEY MASTERS, I'd like to write a lisp routine to select attributes blocks, first I need to window select those using 2 points, then for those doesn't in this erea, i need to pick the blocks one by one, in order to tell which is selected or unselected , i need those selected display different from those unselected. picture 2 underbelow is prefered. -
select the 4 points on each line and entmake pline
Ajmal posted a topic in AutoLISP, Visual LISP & DCL
Can someone help me to find the solution for some doubts. If someone will make one lisp for this, so I think I will get answer for few doubts I need to draw a pline inside this 4 line using line point like this My doubts 1 how to get “line point” with window selection (4 line all pints not in window only 4 line 4 point) (setq p1 (getpoint "\nSelect object...")) (setq p2 (getcorner p1)) (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2))) (setq p1 (list (nth 0 p1) (nth 1 p1))) (setq p2 (list (nth 0 p2) (nth 1 p2))) (if (not (equal '(nil nil) (sssetfirst nil (ssget "_C" p1 p2 '((0 . "LINE")))))) (setq lines (ssget "_:L"))) (if (/= (sslength lines) 4) (alert "4 lines need to be selected") 2 how to segregate the entity (which one is first which one is last) 3 how to entmake pline -
How can I add a filter in ssget...? Actually, I want to select only unlocked line with cross selection. is it possible with this": L" (setq lines (ssget "_C" p1 p2 (list (cons 0 "LINE")))) like this (ssget "_+.:S:E:L" '((0 . "ARC,CIRCLE,ELLIPSE,LINE"))) this is not getting how. can i add can someone help (ssget "_+.c:L" '((0 . "ARC,CIRCLE,ELLIPSE,LINE"))) i want to edit this lisp (setq p1 (getpoint "\nSelect object...")) (setq p2 (getcorner p1)) (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2))) (setq p1 (list (nth 0 p1) (nth 1 p1))) (setq p2 (list (nth 0 p2) (nth 1 p2))) (setq lines (ssget "_C" p1 p2 (list (cons 0 "LINE")))) (if (/= (sslength lines) 4) (alert "4 lines need to be selected")
-
i need only select lines. But it's not coming. (defun c:DE () (setq p1 (getpoint "\nSelect object...")) (setq p2 (getcorner p1)) (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2))) (setq p1 (list (nth 0 p1) (nth 1 p1))) (setq p2 (list (nth 0 p2) (nth 1 p2))) (setq lines (ssget "_C" p1 p2 ((list (cons "LINE"))))) (if (/= (sslength lines) 4) (alert "4 lines need to be selected")))
-
entsel to ssget (create dimension for multiple block)
Pugazh posted a topic in AutoLISP, Visual LISP & DCL
This lisp for working select single block but i want to need create dimension for multiple block. help me!! (defun C:Bdim ( / ) (if (and (setq sel (entsel "Select a block: ")) (= (cdr (assoc 0 (setq nfo (entget (car sel))))) "INSERT") ) (vlax-for item (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))(cdr (assoc 2 nfo))) (setq items (vlax-vla-object->ename item)) (setq EntityData (entget items)) (if (= (cdr (assoc 0 EntityData)) "LINE") (progn (vl-cmdf "_.dimaligned" "_non" (cdr (assoc 10 EntityData)) "_non" (cdr (assoc 11 EntityData)) "_non" (cdr (assoc 10 EntityData))) ) ) ) (prompt "\nNo block selected") ) (princ) ) -
Hello Everybody, this is my first post and I'd like to know a little bit more about the ssget command. I already searched the world wide web for various search keywords, but couldn't find references / lists, especially of the Associative codes and object types. I also read a lot of articles about that command, but most of them use these Associative codes: http://www.lee-mac.com/ssget.html https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/AutoCAD-AutoLISP/files/GUID-0F37CC5E-1559-4011-B8CF-A3BA0973B2C3-htm.html http://www.afralisp.net/autolisp/tutorials/selection-sets.php They Since I am a total newbie with AutoLISP please explain things easily. What I would like to do in the first place is selecting objects via LISP, since there seems to be no command line version of SELECT, QSELECT etc. and therefore I need: a list of "names" of object types that exist in AutoLISP (eg. TEXT, LINE, etc) all neccessary parameters for the ssget function Let's say I want to select a table in a drawing, how can this be done? What if there are more than one tables? Many thanks in advance
- 24 replies
-
- ssget
- select objects
-
(and 2 more)
Tagged with:
-
selection set based on layer and color of a given object
tsotzo posted a topic in AutoLISP, Visual LISP & DCL
Hi, I am trying something like this: (setq ed (entget (car (entsel)))) (setq lyr (cdr (assoc 8 ed))) (setq clr (cdr (assoc 62 ed))) How can I get a selection set based on layer and color of a given object? Something like: (setq objs (ssget "X" '((cons 8 lyr) (cons 62 clr)) ) ) [i know this is not working I write it just to give the idea.] and then change the objects' layer to "0" and color to 2. Thank you in advance tso- 5 replies
-
- selection sets
- by layer
-
(and 2 more)
Tagged with:
-
Hi, Sorry for the heading, I spelt entsel all wrong. Can someone change that please. I'm selecting a closed polyine using an entsel and the using an ssget to select other objects. How do I filter out that entsel item. Like so: (setq ent_1 (car (entsel "\nPlease select something"))) Then filter it. I read in the docs you can't filter an entity (code 0). So how do I accomplish this? My feeble attempt: (while (not ent_1) (setq ss_1 (ssget '((0 . "LWPOLYLINE") (-4 . "=") (70 . 1)))) )
-
Goal: To select all the the objects I want to manipulate at once using a selection window, then the lisp program modifies the properties of just the Circle Entities in that selection. Below I am currently just changing the color property. After modifying the circles, I would like to modify all polyline & LWpolylines with a separate color change. I do not want to have to select the objects twice. Hopefully if this is possible I would like to followup saving Mtext or Text entites in another list. Below is where I have landed after two days of searching for solution. I am not a novice to programming but am with the lisp language. My assumption is that the ssget "_P" command can only be used once. The lisp runs and works for changes the circle entities, but not he polylines.( Command Output shown after the lisp script below) (defun c:FGT (/ ss sf1 sf2 ) (princ "\nSelect objects to export: ") (setq ss (ssget '((-4 . "<or") (0 . "CIRCLE") (0 . "MTEXT") (0 . "TEXT") (0 . "LWPOLYLINE") (0 . "POLYLINE") (-4 . "or>")))) (setq sf1 (ssget "_P" '((0 . "CIRCLE")))) (command "_chprop" sf1 "" "c" "150" "" ) (setq sf2 (ssget "_P" '((-4 . "<or") (0 . "POLYLINE") (0 . "LWPOLYLINE") (-4 . "or>")))) (command "_chprop" sf2 "" "c" "green" "" ) ) COMMAND: Command: FGT Select objects to export: Select objects: Specify opposite corner: 107 found Select objects: _chprop Select objects: 104 found Select objects: Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: c New color [Truecolor/COlorbook] : 150 Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]: Command: _chprop Select objects: Command: FGT Unknown command "FGT". Press F1 for help. Command: c Unknown command "C". Press F1 for help. Command: green Unknown command "GREEN". Press F1 for help. Command: FGT Unknown command "FGT". Press F1 for help. Command: nil Command: Automatic save to C:\Users\Wesley\appdata\local\temp\Test_1_6214_5330.sv$ ... Command: Command: 'VLIDE Command: Command: Specify opposite corner or [Fence/WPolygon/CPolygon]:
-
(setq axd (vla-AddDimAligned spc d1 d2 ex)) (vla-Copy axd) (vl-cmdf "_.explode" "_l" "") ;could not find an ActiveX equivalent for this (setq del (ssget "_p")) ;errors here, does not set the variable and exits routine Can someone shed some light? What is the deal with the above? I am able to type the last expression at the command line after error and it sets the variable fine, so it seems to recognize the previous entities after lisp exits but not during for some reason. Also, is there a way to explode dims other than the command method? Thanks in advance!
-
How can I filter a selection of hatch by gradient name using ssget fonction? The exeample bellow works well for standard hatch name... it does not work for gardient WORK: (setq ss (ssget "_X" (list '(0 . "HATCH")'(2 . "GRASS")))) DONT WORK: (setq ss (ssget "_X" (list '(0 . "HATCH")'(2 . "gradient")))) OR (setq ss (ssget "_X" (list '(0 . "HATCH")'(2 . "gr_spher")))) Could you help me?
-
Hello everyone. I am having a mental blank as i am sure i know the solution to this but cannot remember I am trying to have a shortcut to select all xrefs starting with X* I have tried this but i does not work. (defun c:xrss () (command "SELECT" (ssget "X" (list (cons 0 "INSERT") (cons 2 "X*") ) ) "" ) ) However this does work (defun c:xrerase () (command "erase" (ssget "X" (list (cons 0 "INSERT") (cons 2 "X*") ) ) "" ) ) Can anyone explain what is happening here. I don't need a quick fix but would like to understand the process
-
Allow the user to select a exactly one line
plackowski posted a topic in AutoLISP, Visual LISP & DCL
I need to know the end points (p1 and p2) of a line chosen by the user. How can I let them only select a single line? I'm currently using the following: (if (setq ss (ssget '((0 . "LINE")))) (setq l1ent (entget (ssname ss 0))) (setq p1 (cdr (assoc 10 l1ent))) (setq p2 (cdr (assoc 11 l1ent))) This works, but it still allows the user to grab more objects than necessary. I'm thinking I need to use entsel, but what if they select a different object? Would I need to create a while loop to keep prompting them until they choose a line, or is this functionality built into entsel? -
who can help me to summarize the mode of ssget function
Helchan posted a topic in AutoLISP, Visual LISP & DCL
I want to learn all of the usage about ssget. who can help me to summarize all the mode of ssget and explain how to use it and give some e.g. at the same time can u tell me the symbols "+" ":" in mode expression means what ? thank you very much ! -
Center Text in Box - From ENTSEL to SSGET?
ILoveMadoka posted a topic in AutoLISP, Visual LISP & DCL
I found this code on the web somewhere and it works great for a single line of text. I would like to be able to select multiple lines of text and have it do the same. To center several lines of text in an existing rectangle. I am hoping someone already has code to do this rather than hoping someone would code it for me. I am clueless on how to do this.. Many times what I encounter is multiple lines of individual text items. So it may be TEXT or it may be MTEXT. Here is the existing code which works great for a single line of text: ; PLACE TEXT AT THE CENTER OF A BOX OR A CIRCLE, ; IRRESPECTIVE OF TEXT'S INS.PT ; By G. Ramesh, NPCC, Abu Dhabi. (defun c:CTT(/ e el p1 p2 mid tb sp ll ur mid1 dis) (Princ "\nCenter Text in Box. ") (setvar "cmdecho" 0) (setq e (car(entsel "\nPick the text: ")) el (entget e)) (initget "Window Circle") (setq opt (getkword "\nTo be enclosed within a Window/Circle <W>: ")) (if (or (not opt) (= opt "WINDOW")) (setq p1 (getpoint "\nFirst corner of the enclosing box: ") p2 (getcorner p1 "\nOther corner: ") mid (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)) ) (setq mid (cdr(assoc 10 (entget(car(entsel "\nSelect a CIRCLE: ")))))) ) (setq tb (textbox el) sp (cdr(assoc 10 el)) ll (mapcar '+ (car tb) sp) ur (mapcar '+ ll (mapcar '- (cadr tb) (car tb))) mid1 (polar ll (angle ll ur) (/ (distance ll ur) 2.0)) dis (mapcar '- mid mid1) ) (command ".move" e "" dis "") (prin1) ) Apologies for the formatting being all wonky, it was like that... Thanks much!- 26 replies
-
- box
- center text in box
-
(and 2 more)
Tagged with:
-
Hello everybuddies, I am new to lisp, so please for your advise. I want to pick an existing multi-segment polyline and use it as a selection fence (ssget "_F") As far as I understand I miss a simple piece of code that lists the points of the polyline in a way that ssget can accept them as a list of points to define the fence. (setq POLY (entsel "\n Pick a Fence Line crossing your beloved entities:")) ****POLY---->(please help!)----->POINTLIST**** (setq ss (ssget "_F" POINTLIST ) ) Thanx in advance
- 13 replies
-
- points list
- fence
-
(and 2 more)
Tagged with:
-
I m trying to make a selection set using a point and a couple of lines passing through this point (caution, NOT terminating). I want to select lines of specific layers. What I m typing is this (setq pt (getpoint "\nSelect point: ")) (setq ss (ssget pt '((0 . "LINE") (8 . "mylayer")))) Unfortunately this doesn't work. The only way I could find is to use this instead (ssget "C" pt pt '((0 . "LINE") (8 . "mylayer"))) However I do not find that helpful at all. If there is a line at the back on an other elevation, not crossing the initial line, but coincidentally passing 'visually' through this point (pt) the later ssget command will include both and that is not what I want. How could I use a point and filter together? Any help would be appreciated.
- 5 replies
-
- selection set
- point
-
(and 3 more)
Tagged with:
-
I'm a newbie. And i try to practise some Autolisp example. I write the code below to know how to use entity name in applying command. I collect these entity name in a list and use command "erase to delete it". But some problems happened here. It said " Bad arguments" and i don't know how to resolve it. (defun c:gc (/ p1 p2 data n index) (setq p1 (ssget)) (setq data()) (setq n (sslength p1)) (setq index 0) (repeat n (setq p2 (ssname p1 index)) (setq data (append data p2)) (entmod data) (setq index (+ index 1)) ) (command "erase" p2 "") )
-
Hey Guys, Ive got this routine which is intended to erase everything visible which is of a colour determined by the user. (defun c:ec () (setq ecc (getint "\nEnter COLOUR of objects to ERASE : ")) (setq CODE 62) (setq pt1 '( -50000000000000 -50000000000000 -50000000000000)) (setq pt2 '( 50000000000000 50000000000000 50000000000000)) (setq ssec (ssget "w" pt1 pt2 '(list (cons CODE ecc)))) (command "ERASE" ssec "") ) The plan is to only ERASE objects which are visible at the time. So the routine should not operate on any objects on hidden layers... but should operate on objects off the screen (visible in viewport but cannot be seen due to zoom/pan position... if you follow). The problem I am having is I am finding it difficult to pass the colour variable (ecc) to the SSGET filter list while using the "W" option. If I replace "W" with the "X" option.. the routine works, but it will operate on everything in the database. So... I was just wondering if someone could please advise me of a way to filter the "W" optioned SSGET with a variable defined by the user? Thanks so much for any help. ----------EDIT--------- The problem with using the "W" option and defining the co-ordinates as I have is that it is dependant on my current UCS. I have since amended the routine to work around this issue. Please see below. (defun c:ec () (setq ecc (getint "\nEnter COLOUR of objects to ERASE : ")) (setq CODE 62) (command "ucsicon" "off" "ucs" "view") (setq pt1 '( -50000000000000 -50000000000000 -50000000000000)) (setq pt2 '( 50000000000000 50000000000000 50000000000000)) (setq ssec (ssget "w" pt1 pt2 '(list (cons CODE ecc)))) (command "ERASE" ssec "") (command "ucs" "p" "ucsicon" "on") ) Thanks guys.
-
Problem with code to select a single piece of text using ssget.
Reu posted a topic in AutoLISP, Visual LISP & DCL
What is wrong with my coding? (defun 1ststring () (if (while (= str nil) (setq ss (ssget ":S" '((0 . "TEXT"))) str (cdr (assoc 1 entget ss)) ) ;_end setq (setq str nil) ) ;_end while ) ;_end if ) ;_end defun -
Hi friends, is it possible to add behaviors defined by (initget) function to (ssget) (As most of you know, it is possible for other input functions such as (entsel), (entselp), (getpoint), ...) An example is like this: I appreciate any help
-
Hi all, is it possible to filter selection set to contain only minserted blocks? If so, how? Thanks to anyone who spends her/his time to get any answer to the problem.
- 8 replies
-
- selection set
- minsert
-
(and 2 more)
Tagged with:
-
Could really use some ssget lisp help, please
JasonS posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi all, I'm hoping someone who knows lisp and object codes could help me convert the attached filter setup into a ssget lisp, so I can call it on the command line, please! I've been looking at this thread, but I can't puzzle my way through it so far. My lisp skills are terrible to nonexistent! http://www.cadtutor.net/forum/showthread.php?21217-FILTER-Command I've attached a screenshot of the filter setup, and here's a clip from the filter.nfl file, if that's more helpful: (-4 . "(1 . "ose to any third party.") (1 . "3510") (-4 . "=") (62 . 166) (-4 . "=") (62 . 72) (-4 . "=") (62 . 251) (2 . "attr2-edit") (-4 . "(8 . "Paper Text") (0 . "*POLYLINE") (-4 . "AND>") (-4 . "OR>") :ai_str|PG ** Begin OR Text Value = ose to any third party. Text Value = 3510 Color = Color Color = Color Color = Color Block Name = attr2-edit ** Begin AND Layer = Paper Text Object = Polyline ** End AND ** End OR Thanks so much for the help...this will save me a ton of repetitive grind time!