Search the Community
Showing results for tags 'ssget filter'.
-
Hello everyone! So, i am doing a school project in which i want to select all circles of a given radius and then move them all in the arithmetic mean of all centers. The arithmetic mean is no problem, everything works fine, till i add the "more complex" filter. Here is the part of the code: (initget 7) (setq radius (getint "\nEnter radius: ")) (setq ss (ssget "X" '((0 . "CIRCLE") (-4 . "=") (40 . radius)))) The thing is, when i swap (40 . radius) with, lets say, (40 . 10)... it works for all circles with the radius equal to 10. But i want to give the radius by keyboard. And i get the error from the title. Also... if i put a (princ radius) before the filter, it shows me the value of radius.
-
I've attached two drawings, each containing almost identical blocks named REVBLK. In one case, the test function below finds the block. In the other case, it does not. Why? Some context - I modified our REVBLK a few weeks ago, condensing the attributes so the revision block will fit in a smaller space. My lisp routine to update the title block can no longer locate the revised REVBLK. (defun _TestFunction ( / ) (setq rbname "REVBLK") (setq ss (ssget "_X" (list (cons 2 rbname)))) (if ss (princ "testfunction found revblk") (princ "no revblks found") ) ) blockfound.dwg noblockfound.dwg
-
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 -
Hi everyone, Please help me how to create 2 selection set (one of "MTEXT" and one of "DIMENSION") from this code I made. (setq ss3 (ssget ":L" '((0 . "MTEXT,DIMENSION")))) Thank you so much.
-
ssget: combining logical and relational operators
DeBroiler posted a topic in AutoLISP, Visual LISP & DCL
Hey all, i'm trying to "catch" a line with ssget. I know the x-coordinate of either the start- or the endpoint of the line i'm looking for, but i can't be sure wether it's gonna be the start- or endpoint having that certain x-coordinate. Also i want to include a certain "fuzz" factor, because the drawing is not super-accurate, with some of the entities not residing exactly where they should, but being "off" by about 0.00001 units or some such. So originally i went with the crossing option of ssget (i.e. (ssget "_C" 'pt1 'pt2)), but that didn't quite work right because the crossing option is dependant on objects being visible in the drawing area at the time of calling ssget and i want to iteratively catch lines scattered all over my drawing. So then i thought I'll just use (ssget "X") and filter for my lines, so this a minimal working example of what i've come up with: (defun c:get_line_by_start_or_endpoint ( x tol /) (ssget "X" (list '(-4 . "<OR") '(-4 . "<AND") '(-4 . "<=,*,*") (list 10 (+ x tol) 0.0 0.0) '(-4 . ">=,*,*") (list 10 (- x tol) 0.0 0.0) '(-4 . ">AND") '(-4 . "<AND") '(-4 . "<=,*,*") (list 11 (+ x tol) 0.0 0.0) '(-4 . ">=,*,*") (list 11 (- x tol) 0.0 0.0) '(-4 . ">AND") '(-4 . ">OR") '(0 . "LINE") '(8 . "MyLayer"))) ) Because i don't know wether it's gonna be the start- or the endpoint having the x-coordinate i'm looking, i have to use the whole "<or <and >and <and >and >or"-construct. Well the thing is it didn't work and as far as i can tell the problem seems to be, that the combination of "<and ... >and" with the relational ">=,*,*" / "<=,*,*" operatos. I tried catching lines only by the starting point omitting the whole <or <and and> <and and> or> construct and only using <=,*,* >=,*,* and it's working just fine: (defun c:get_line_by_startpoint ( x tol /) (ssget "X" (list '(-4 . "<=,*,*") (list 10 (+ x tol) 0.0 0.0) '(-4 . ">=,*,*") (list 10 (- x tol) 0.0 0.0) '(0 . "LINE") '(8 . "MyLayer"))) ) The problem is i honestly can't tell beforehand wether it's gonna be the start- or the endpoint having the specific x-coordinate. And of course i could just ssget for startpoints and ssget for endpoints and then combine the two selectionsets, but at this point this has become somewhat a matter of principle for me, because there just has to be a way to combine the operators that i need and make it work. So has anybody experience with combining logical and relational operators in a ssget function and might be able to point me in the right direction? Is there something i am missing? Any help would be greatly appreciated! -
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:
-
Ssget with option "C" and -4 code filters. Unable to select.
MJLM posted a topic in AutoLISP, Visual LISP & DCL
Can somebody elaborate a bit about this -4 code and filters with wildcards in a selection set and explain how it really works? I am using the following: (setq pt '(0 0 2.5)) (setq ss (ssget "C" pt pt (list (cons 0 "LINE") (cons -4 "=,=,*") (cons 10 pt)))) My intent is to pick a line that passes through point 'pt' and make a selection set with this one only regardless how many other are crossing behind this line (visually passing through the pt). If I use the following it gives me always nil eventhough my line passes through this point (pt). (setq ss (ssget "C" pt pt (list (cons 0 "LINE") (cons -4 "=,=,=") (cons 10 pt)))) Why is that?