Results 1 to 2 of 2

Thread: Is possible to select entities from a selection set obtained by using ssget command?

  1. #1
    100 Club
    Join Date
    2007-02
    Posts
    148
    Login to Give a bone
    0

    Default Is possible to select entities from a selection set obtained by using ssget command?

    hi i would like to know if it is possible to select entities from a selection set obtained by using ssget command, and process the entities for point coordinates (eg center point of circle square, extreme points of a square or end points of a line). thank you.

  2. #2
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Is possible to select entities from a selection set obtained by using ssget command?

    Quote Originally Posted by tany0070
    hi i would like to know if it is possible to select entities from a selection set obtained by using ssget command, and process the entities for point coordinates (eg center point of circle square, extreme points of a square or end points of a line). thank you.
    Hi,

    Try the following code. This will select all the circles in a drawing and draw a line.

    Code:
     
    (defun c:fc (/ circles numCircle cenCircle radCircle count cEnt LineStPt LineEdPt)
    (setq circles (ssget "x" '((0 . "Circle")))) ; select all the circles
    (if circles ; if circles found
    	(progn
    	 (setq numCircle (sslength circles) ; total number of circles in the selection
    	 count	 0 ; initiate a counter
    	 )
    	 (repeat numCircle
    (setq cEnt (entget (ssname circles count))) ; entity data
    (setq cenCircle (cdr (assoc 10 cEnt))) ; center of the circle
    (setq radCircle (cdr (assoc 40 cEnt))) ; radius of the circle
    (setq LineStPt (polar cenCircle (dtr 180) radCircle); determine start point of a line
    	 LineEdPt (polar cenCircle (dtr 0) radCircle); end point of the line
     
    )
    (entmake
    (list
    	 '(0 . "LINE")
    	 '(100 . "AcDbLine")
    	 (cons 10 LineStPt)
    	 (cons 11 LineEdPt)
    )
    )	; draw the line
     
    (setq count (1+ count)) ; do for the next circle
    	 )	 ; end of repeat
    	)	 ; progn
    )	 ; if
    (princ)
    )
    	 ; function to covert degree to radian angle
    (defun dtr (a)
    (* pi (/ a 180))
    )
    Similar for all the entities, but have a look at entities group codes.

    Regards,

    Abdul Huck

Similar Threads

  1. Replies: 20
    Last Post: 2015-03-16, 10:59 PM
  2. Inverting an SSGET selection set
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 3
    Last Post: 2014-03-25, 04:05 PM
  3. SelSet of entities obtained after ARRAY command
    By marko_ribar in forum AutoLISP
    Replies: 6
    Last Post: 2011-02-01, 12:06 PM
  4. Replies: 6
    Last Post: 2007-03-21, 10:58 PM
  5. Replies: 3
    Last Post: 2006-10-25, 03:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •