Jump to content

Speed question


Lt Dan's legs

Recommended Posts

is it faster to entmake something and then vlax-ename->vla-object or vla-add(object)?

 

 

Example:

 

(vlax-ename->vla-object
 (entmakex
   (list
     (cons 0 "line")
     (cons 10 (list 0. 0. 0.))
     (cons 11 (list 10. 10. 0.))
   )
 )
)

 

or

 

(vla-addline
 (vla-get-modelspace
   (vla-get-activedocument
     (vlax-get-acad-object)
   )
 )
 (vlax-3d-point (list 0. 0. 0.))
 (vlax-3d-point (list 10. 10. 0.))
)

Link to comment
Share on other sites

The ent* functions are quicker for modification to the drawing database, the difference will be made more significant if you are repeatedly retrieving the application, document and modelspace objects.

Link to comment
Share on other sites

I entmake lines, polylines, mtext and leaders a lot.

 

I really have it setup like

(defun polyline ( pointslst layer flag / e )
 (and pointslst (laycheck layer)
   (setq e 
     (entmakex
       (append
         (list
           (cons 0 "LWPOLYLINE")
           (cons 100 "AcDbEntity")
           (cons 100 "AcDbPolyline")
           (cons 90 (length pointslst))
           (cons 70 1)
           (cons 8 layer)
           (cons 43 0.0)
         )
         (mapcar
           (function
             (lambda ( x ) 
               (if (listp x)(cons 10 x)
                 (cons 42 x)
               )
             )
           ) pointslst
         )
       )
     )
   )
 )
 (if (and e flag)
   (vlax-ename->vla-object e) e
 )
)

 

 

 

 

and Thanks for the

(setq *acdoc*
 (cond  ( *acdoc* )
   (  (vla-get-activedocument (vlax-get-acad-object))  ) 
 )
)

I use this whenever I can

Link to comment
Share on other sites

It's also nicer when using ent* because you can create the object with the properties you want, rather than put'ing them after the object has been created. Of course, if the object is annotative (*text, blocks, mleaders, dimensions) I recommend vla all day.

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...