Search the Community
Showing results for tags 'selection set'.
Found 11 results
Processing a selection set of LightWeight Polylines to provide midpoints
KarlG posted a topic in AutoLISP, Visual LISP & DCLI cant seem to pass in any way a selection set for each polyline to place a point at the midpoint of a each polyline? Its driving me nuts, I have tried modifying the origianal code to select the list and process that way but it still isnt working (defun c:MidPoly ( / ent ename entl en oname param len hLen MidPt OS ) (vl-load-com) (setq ent (entsel "\nSelect polyline:")) (if ent (progn (setq ename (car ent) entl (entget ename) en (cdr (assoc 0 entl)) ) (if (member en (list "POLYLINE" "LWPOLYLINE")) (progn (setq oname (vlax-ename->vla-object ename) param (vlax-curve-getEndParam oname) len (vlax-curve-getDistAtParam oname param) hLen (* 0.5 len) MidPt (vlax-curve-getPointAtDist oname hLen) ) (vlax-release-object oname) (setq OS (getvar "OSMODE")) (setvar "OSMODE" 0) (command "._Point" MidPt) (princ "\nPoint object created at mid-point:")(princ MidPt) (setvar "OSMODE" OS) ) (princ "\nYou must pick a polyline object only.") ) ) ) (prin1) ) (defun c:test1 ( / e i s x ) (if (setq s (ssget "_X" (list (cons 8 "MGA55_ROW_Stripping_Depth") (cons 0 "LWPOLYLINE")))) (progn (setq i (1- (sslength s))) (while (<= 0 i) (setq e (ssname s i) x (cdr (assoc 0 (entget e))) i (1- i) ) (command "(c:MIDPOLY)" e) (print x) ) ) ) (princ) ) (defun c:test2 ( / e i s x ) (if (setq s (ssget "_X" (list (cons 8 "MGA55_ROW_Stripping_Depth") (cons 0 "LWPOLYLINE")))) (progn (setq i 0) (repeat (sslength s) (setq e (ssname s i) x (cdr (assoc 0 (entget e))) i (1+ i) ) (command "(c:MIDPOLY)" e) (print x) ) ) ) (princ) ) (defun c:test3 ( / s ) (if (setq s (ssget "_X" (list (cons 8 "MGA55_ROW_Stripping_Depth") (cons 0 "LWPOLYLINE")))) (foreach e (ssnamex s) (if (= 'ename (type (cadr e))) (command "(c:MIDPOLY)" (cdr (assoc 0 (entget (cadr e))))) ) ) ) (princ) ) (defun c:test4 ( / e s ) (if (setq s (ssget "_X" (list (cons 8 "MGA55_ROW_Stripping_Depth") (cons 0 "LWPOLYLINE")))) (while (setq e (ssname s 0)) (print (cdr (assoc 0 (entget e)))) (setq x (cdr (assoc 0 (entget e)))) (command "(c:MIDPOLY)" e) (ssdel e s) ) ) (princ) ) I also want to do the same for Lines using this: (defun c:MIDLINE ( / ent nPt p2 p1 ) (if (setq ent (car (entsel "\nSelect line:"))) (progn (setq p1 (cdr (assoc 10 (entget ent))) p2 (cdr (assoc 11 (entget ent))) ) (setq npt (Line-centroid p1 p2)) (setq OS (getvar "OSMODE")) (setvar "OSMODE" 0) (command "._Point" nPt) (princ "\nPoint object created at mid-point:")(princ nPt) (setvar "OSMODE" OS) ) ) ) (defun Line-centroid (p1 p2) (mapcar '(lambda (x1 x2) (/ (+ x1 x2) 2.0)) p1 p2) )
accessing entity in a codes windows selection set
maerfl posted a topic in AutoLISP, Visual LISP & DCLHello I'm not able to figure out how to easily access the first entity of a slection set created with coded windows selection. I want to read out coodinates of the first point of 2 different objects which are "grabed" in a coded windows selection set. One polyline, one line. Then I want to copy the line from it's first point as basepoint to the first point of the polyline. Advanced I would like to copy it to all the other points of the polyline too. So it would be further more interesting to know how to access (read out the coordinates of) the second, the third and so on point of an object...using visual lisp. The following code is using first a pick up of the object where the line should be copied to and a static coordinate for the basepoint of the line instead of a read out coodinate: (vl-load-com) (setq sel1 (ssget "_w" '(-2 -2) '(115 10))) (setq e (car (entsel))) (setq topoint (vlax-curve-getStartPoint e)) (command "_.COPY" sel1 "" "0,0" topoint)
Count Occurrences of Specific String
bcarlso2 posted a topic in The CUI, Hatches, Linetypes, Scripts & MacrosI am trying to script a counter of specific strings. How can I select all occurrences of text that has a specific value? I cannot use filter or quickselect, and I cannot get selection sets to find specified values. Any help would be greatly appreciated. I am using ACADE 2015.
empty selection sets
symysgames posted a topic in AutoCAD Beginners' AreaI often use selection sets in my programming but always encounter difficulties when they are empty. why is it so problematic? is it because of the nature of nil who is a atom and a list at the same time. Most of the time I make sure my selection set is never empty, I insert a dummy object and then remove once I don't need it, and I found it works ok . There are filters but I don't see how they can be of any use. For example if I have a selction set ss1 and then do (setq lg (sslength ss1)) if my selection set is empty it will not set lg to 0 but to nil. how can I overcome this without having to insert a dummy object.
Boundary Creation Lisp- by Text selections
zefreestijl posted a topic in AutoLISP, Visual LISP & DCL
selection set with point and filters
MJLM posted a topic in AutoLISP, Visual LISP & DCLI 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.
martinle posted a topic in AutoLISP, Visual LISP & DCLHello, I have chosen a selection set with ssget and stored in a variable "AWS". How should programiert a selection set that you want to do the following. If the layer A is present in the selection set AWS, then search all the dimensions in the selection set AWS. When dimensions in AWS are present, change the dimensions in layer B. If no dimensions are present, then exit the Lisp. Please for help. Martin
Selection Within a Block
AGove4123Sonnnnn posted a topic in .NET, ObjectARX & VBAI need a way to select everything but the centerlines within a block. They extend beyond the part which I hope to find the actual envelope dimensions of. I will then iterate through the remaining parts to find the max/envelope dimensions. The issue is this block is in a document with many other objects (blocks, lines, points, etc.) so exploding is not ideal as it would be a pain to recollect the parts. Also opening a seperate file is too time consuming, this must be done within the file at hand. Is this even possible? EDIT: Oh! A little drilling, and you can easily and directly access a block within a document, then iterate through them as I mentioned above. No inception-style selection sets needed! Nice. Looks very roughly like this: Dim blkTestBlock As AcadBlock Set blkTestBlock = AutoCAD.Application.ActiveDocument.Blocks("ACT1") For Each ACADEntity in blkTestBlock If linetype="Continuous" then getboundingbox....blahblahblah
VBA Selection Set Issue
meyerforhire posted a topic in .NET, ObjectARX & VBAHey gang! Quick question (hopefully).... Would there be any reason why several block references with (Locked and Constant) attributes do not get added to a Selection Set created using the .Select acSelectionSetWindow method? It's picking up all of the other items including block references, text, and even a block reference with an attribute that is not locked nor constant. The problem blocks are right in the middle of the window surrounded by everything else that is getting added. I am not attempting to use a filter. I am using AutoCAD 2012.
Ahankhah posted a topic in AutoLISP, Visual LISP & DCLHi 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.
Take properties from selected object
aboychuk posted a topic in AutoLISP, Visual LISP & DCLHi everybody. I am new to lisp, so I need your help. I have a diagram with different lines. I need to select each line separately and change a color and a line weight of it. I have one problem right now. here is the example of my selection set line (setq ssLine (ssget "X"(list (cons 0 "LWpolyline")(cons 8 "0")(cons 62 253)))) I want to keep everything the same except the last CONS (cons 62 253). I want it to take a value of a color from a object that I will select in my drawing. First, I need some command or variable to prompt me to select a line. After that, I need my selection set to change the last cons from color 222 to a color of the selected object. Thank you, AB