Author Topic: Need help for ssget the line and the circle  (Read 1676 times)

0 Members and 1 Guest are viewing this topic.

xiaxiang

  • Guest
Need help for ssget the line and the circle
« on: December 19, 2010, 08:36:22 PM »
Recently I make a routine for ssget the line and the circle
Code: [Select]
 (setq ss1 (ssget '((0 . "LINE"))))
  (setq ss2 (ssget '((0 . "circle"))))
But I don't want to select twice,so I modify it
Code: [Select]
(setq sss (ssget  '((0 . "LINE,circle"))))  
but how can I Specify the entity of line to SelectionSet ss1,and the entity of circle to SelectionSet ss2?
I use the function http://www.theswamp.org/index.php?topic=20164.0 By Mr Ron.
And I use this routine to Cascade(connect) the Discrete lines and circles. I must Select Twice! Help me,thanks.
« Last Edit: December 20, 2010, 01:31:54 AM by xiaxiang »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Need help for ssget the line and the circle
« Reply #1 on: December 19, 2010, 08:58:33 PM »
Look at this, it separates the ss1. Places circles in ss2. NOTE: no error handling.

Code: [Select]
(defun c:test ()
  (setq ss1 nil ss2 nil)
  (if (setq ss1 (ssget '((0 . "LINE,circle"))))
    (foreach itm (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss1)))
      (if (= (cdr (assoc 0 (entget itm))) "CIRCLE")
        (progn
          (or ss2 (setq ss2 (ssadd)))
          (ssadd itm ss2)
          (ssdel itm ss1)
        )
      )
    )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

xiaxiang

  • Guest
Re: Need help for ssget the line and the circle
« Reply #2 on: December 19, 2010, 09:40:18 PM »
Thank you Alan :-D
The code is updated.
« Last Edit: December 20, 2010, 01:34:03 AM by xiaxiang »