TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Marc'Antonio Alessi on September 22, 2018, 11:00:22 AM
-
Is it possible to pass a point list with a fuzz factor?
Example: (ssget "_X" (list '(0 . "MULTILEADER") (list 15 999.0 999.0 0.0)))
-
Your point list does not have DXF group code... I suppose it should be 10 or 11 or ...
-
I think I found the solution here by Lee Mac:
https://www.cadtutor.net/forum/topic/65020-select-object-by-insertion-point/
... I also found my similar question from some years ago …
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-to-filter-entities-by-points/td-p/790381
:grumpy: :whistling:
-
Code by Lee Mac simplified for my purpose:
(defun SsgetMLeaderByDxf15 (PntLst FuzFac)
(ssget "_X"
(list
'(0 . "MULTILEADER")
'(-4 . ">=,>=,>=")
(cons 15 (mapcar '- PntLst (list FuzFac FuzFac FuzFac)))
'(-4 . "<=,<=,<=")
(cons 15 (mapcar '+ PntLst (list FuzFac FuzFac FuzFac)))
)
)
)
(SsgetMLeaderByDxf15 '(1905.13 2043.22 0.0) 0.1)
Updated by Lee suggestion.
-
You're welcome :-)
Note that the additional <AND ... AND> items in the filter list are no longer required when only filtering for a single point - the AND logic is inherent in the way that filter list is interpreted.
-
You're welcome :-)
Note that the additional <AND ... AND> items in the filter list are no longer required when only filtering for a single point - the AND logic is inherent in the way that filter list is interpreted.
Thanks Lee :-) I update the code now.
-
New request:
(defun Ctr_Utils_SsgetByDxf10 (ObjTyp LyrNam PntLst FuzFac)
(ssget "_X"
(list
(cons 0 ObjTyp) (cons 8 LyrNam)
'(-4 . ">=,>=,>=") (cons 10 (mapcar '- PntLst (list FuzFac FuzFac 0)))
'(-4 . "<=,<=,<=") (cons 10 (mapcar '+ PntLst (list FuzFac FuzFac 0)))
)
)
)
(Ctr_Utils_SsgetByDxf10 "LWPOLYLINE" "Mylayer" '(10.0 10.0 0.) 0.01)
On polylines there are many situations in which the result is wrong. The more vertices there are, the greater the probability of error.
Solutions?
-
@Marc'Antonio Alessi:
What you want to do is not possible for LW polylines with ssget only. The function will have to be extended with a 'post-process'. It is not the number of vertices that is the issue, but their location relative to PntLst. Your code will select any rectangle around PntLst for example.
-
@Marc'Antonio Alessi:
What you want to do is not possible for LW polylines with ssget only. The function will have to be extended with a 'post-process'. It is not the number of vertices that is the issue, but their location relative to PntLst. Your code will select any rectangle around PntLst for example.
Yes, that's what I found… Thanks.