Jump to content

Recommended Posts

Posted

Yesterday I continued working on getting myself familiar with the Active X Model. Late in the evening most of you saw that I accomplished a task of getting some dimtext overrides inserted into objects using the handles for identification method.

 

Today, while studying some more on this I came across an example submitted by Fixo which did basically the same thing but without using vlax-put-property....etc method. He did something like this:

 

(entmod (subst (cons 1 "<>CM")(assoc 1 elist) elist))

 

There was more to this code than shown I just put up the part of the code which took care of the dimtext override insertion. Like so many things in AutoCAD there is more than one way of doing something so my question is are there any advantages the entmode method has over the Active X methods. And I'm speaking about straight AutoCAD environment. I realize Active X takes on interfacing with other Apps like Excel but when working strictly with AutoCAD is there a real advantage of one method over the other.

Posted (edited)

It depends on the scope of the routine being executed. Specifically if your routine does not require ActiveX properties and methods then sticking with vanilla AutoLISP functions will save you the overhead of convering entity names to vla-objects.

 

I find the performance difference negligible, given my hardware configuration, and find ActiveX simply easier to read.

Edited by BlackBox
Posted

.... so my question is are there any advantages the entmode method has over the Active X methods. .

 

With the introduction of Annotative Objects. sometimes entmod doesnt cut it anymore.

I agree with Renderman said about avoiding the overhead of convering entity names to vla-objects, soemtimes its best to use vanilla expecially when starting with enames for selections.

But some entities behaves differently depending on you want to modify. so if know i'll be using ActiveX properties, i use something like this

 

 
(if (ssget '((0 . "ENTITY")))
(progn
(vlax-for itm (setq sel (vla-get-activeselectionset
(vla-get-ActiveDocument (vlax-get-acad-object))))
.......
)
(vla-delete sel)
)

Posted

Its all about using the right tools for the job. Some tasks are easier accomplished using Vanilla, others are easier (and may even only be possible) using Visual.

 

As a quick comparison, here is a table taken from an AU-2007 handout by Doug Broad:

 

MethodComparison.png

 

A quote from one of my previous posts:

 

Lee I've noticed that you tend to use entmakex in favour of vla-add and similar. Can I ask your reasoning?

 

A number of reasons.

 

LISP is designed for list manipulation and offers many functions to do so. This means many tasks are far more concise using the DXF data list and furthermore, you needn't use Variants and Safearrays.

 

The DXF structure allows you to modify any or all properties of the entity with a single call to an ent* function, without digging through each and every property separately. Also I find it much easier to make programs compatible in all UCS planes using Vanilla AutoLISP.

 

The Vanilla AutoLISP functions (such as entmake) are usually a whole lot faster than the Visual LISP equivalents.

 

Other than that, being profficient in Vanilla methods enables you to write programs for systems without access to Visual LISP.

Posted

Great post(s), Lee - that really is the key - using the right tool for the job.

 

Separately, would you be able to provideto the AU course # referenced above? I'd really like to save a copy.

 

Cheers! :beer:

Posted
Great post(s), Lee - that really is the key - using the right tool for the job.

 

Thanks RenderMan :)

 

Separately, would you be able to provideto the AU course # referenced above? I'd really like to save a copy.

 

Sure thing, the course number is CP311-4

Posted

Thanks RenderMan :)

 

Welcome. :thumbsup:

 

Sure thing, the course number is CP311-4

 

Interestingly I had a difficult time actually finding this course both on AU's online course listings (which WAS comprehensive), and via Google search (much to my surprise). So I changed my search string, and actually came across an old(-er) thread at TheSwamp where you (Lee) reference this AU course document. The link you provided is in fact dead today, but it was all I needed to find the source PDF... thanks to one of my favorite sites (image is linked):

 

wayback.gif

 

... Now, I've got a live, direct link to the course PDF, which I share here (image is linked):

 

pdf_icon_128.png

Posted
Great detective work Sherlock Renderman :)

 

That is kind of you to say; I do what I can.

 

sherlock2.gif

Z

Posted

In regards to command being the only thing affected by system variables, I agree with this 99%, but one should be aware that all (command, entmake(x), vla-add*) are affected by system variables such as CECOLOR and CELTYPE when creating an object.

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