Author Topic: Ssget "_X" by DXF point with fuzz  (Read 3741 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Ssget "_X" by DXF point with fuzz
« 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)))

ribarm

  • Gator
  • Posts: 3249
  • Marko Ribar, architect
Re: Ssget "_X" by DXF point with fuzz
« Reply #1 on: September 22, 2018, 11:09:41 AM »
Your point list does not have DXF group code... I suppose it should be 10 or 11 or ...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube


Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Ssget "_X" by DXF point with fuzz
« Reply #3 on: September 22, 2018, 12:01:05 PM »
Code by Lee Mac simplified for my purpose:
Code: [Select]
(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.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Ssget "_X" by DXF point with fuzz
« Reply #4 on: September 22, 2018, 01:46:03 PM »
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.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Ssget "_X" by DXF point with fuzz
« Reply #5 on: September 22, 2018, 03:17:19 PM »
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.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Ssget "_X" by DXF point with fuzz
« Reply #6 on: October 23, 2018, 02:42:38 AM »
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?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Ssget "_X" by DXF point with fuzz
« Reply #7 on: October 23, 2018, 09:32:49 AM »
@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

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Ssget "_X" by DXF point with fuzz
« Reply #8 on: October 23, 2018, 10:09:02 AM »
@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.