Jump to content

How to select an object created by entmakex ?


vanowm

Recommended Posts

Hello.

I have a function that draw line:

(defun drawLine (start end)
   (entmakex (list
                 '(0 . "LINE")
                 '(100 . "AcDbEntity")
                 '(100 . "AcDbLine")
                 '(8 . "")
                 (cons 9 start)
                 (cons 10 end)
             )
   )
)

 

How do I make it select that line so it would show with grips?

 

Thank you.

Link to comment
Share on other sites

odd why you use 9 as startpoint

 

(defun drawLine (start end)
   (entmakex (list
                 '(0 . "LINE")
                 '(100 . "AcDbEntity")
                 '(100 . "AcDbLine")
                 [b];'(8 . "")[/b]
                 (cons [b]10 [/b]start)
                 (cons 11 end)
             )
   )
)

 

 

(defun c:demo ()
 (setq ss (ssadd))
(setq p1 (getpoint))
(setq p2 (getpoint p1))

 	(setq newline (drawLine p1 p2))
(sssetfirst nil (ssadd newline ss ))
)

Link to comment
Share on other sites

Note that if ssadd is called without the selection set argument, the supplied entity will be automatically added to a new selection set, e.g.:

(defun c:test ( / p q )
   (if (and (setq p (getpoint "\nStart: "))
            (setq q (getpoint "\nEnd: " p))
       )
       (sssetfirst nil (ssadd (drawline (trans p 1 0) (trans q 1 0))))
   )
   (princ)
)

Also, note that the subclass markers (DXF group 100) are not required for LINE entities:

(defun drawLine ( start end )
   (entmakex
       (list
          '(0 . "LINE")
           (cons 10 start)
           (cons 11 end)
       )
   )
)

Link to comment
Share on other sites

Thank you very much.

These little details are very useful for newbies! Thanks again for taking your time to teach us ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...