Does ActiveX have an impact on AutoLISP's speed?

Does ActiveX have an impact on AutoLISP's speed?

surfer96
Advocate Advocate
2,449 Views
23 Replies
Message 1 of 24

Does ActiveX have an impact on AutoLISP's speed?

surfer96
Advocate
Advocate

Does using ActiveX methods have an impact on AutoLISP's calculation speed? Will AutoLISP get faster, slower or stay the same?

I don't mean addressing some external program like Excel or whatever, but the use of "genuine" AutoCAD methods such as creating or editing objects like lines or circles via vla- or vlax-methods. Is this faster or slower compared with pure AutoLISP using simple Autodesk commands like "_line" or "_circle"?

0 Likes
Accepted solutions (3)
2,450 Views
23 Replies
Replies (23)
Message 21 of 24

surfer96
Advocate
Advocate

@ActivistInvestor,

Is what you call an "external database" a dwg-file just not opened in AutoCAD at the moment?

If so, do I have to create that (empty) dwg-file before starting to code in VLISP or is it created while coding in VLISP?

 

Or is the "external database" something virtual which does not physically exist as a dwg-file?

0 Likes
Message 22 of 24

ActivistInvestor
Mentor
Mentor

By default, you are working in a new document when you create an instance of an AxDbDocument, but you can also open an existing DWG file and work with that as well.

 

With a new document there is no DWG file until you save the database. You can find many

examples here showing how to work with ObjectDBX.

 

 


@surfer96 wrote:

@ActivistInvestor,

Is what you call an "external database" a dwg-file just not opened in AutoCAD at the moment?

If so, do I have to create that (empty) dwg-file before starting to code in VLISP or is it created while coding in VLISP?

 

Or is the "external database" something virtual which does not physically exist as a dwg-file?


 

 

0 Likes
Message 23 of 24

surfer96
Advocate
Advocate

At the moment I do have ActiveX-VLISP code running through a while loop until the random-based loop's condition (e. g. all point distances in a 100-200-range) is met. The lsp is then loaded into the current dwg-file where the loop is executed "live" and the resulting geometry generated.  But this method turned out to be far too slow.

 

I thought a workaround might be:

  • create an instance of an AxDbDocument
  • write code for geometry creation and looping within that instance
  • looping codition is met, result (e.g. 100 random lines) is generated
  • at the end the final geometry is copied to AutoCAD's current dwg-file (vla-get-ActiveDocument acadObj)

In the end the lsp-file will have to be loaded into the open dwg-file, which will trigger the loop. But this will only speed up the loop if the latter is run through inside the "isolated" AxDbDocument without contact to AutoCAD. Only at the end of the loop the result will be handed over to AutoCAD.

 

This "solution" feels like a "wrapped and isolated" loop, where isolation is only ended when the conditional statement is met. Could this basic idea possibly work? Or is it wishful thinking...

0 Likes
Message 24 of 24

ActivistInvestor
Mentor
Mentor

Generally, ObjectDBX is useful when there is a large amount of geometry that must be created in a drawing file. It doesn't offer any advantages insofar as speeding up the computations needed to create the geometry however. 

 

 


@surfer96 wrote:

At the moment I do have ActiveX-VLISP code running through a while loop until the random-based loop's condition (e. g. all point distances in a 100-200-range) is met. The lsp is then loaded into the current dwg-file where the loop is executed "live" and the resulting geometry generated.  But this method turned out to be far too slow.

 

I thought a workaround might be:

  • create an instance of an AxDbDocument
  • write code for geometry creation and looping within that instance
  • looping codition is met, result (e.g. 100 random lines) is generated
  • at the end the final geometry is copied to AutoCAD's current dwg-file (vla-get-ActiveDocument acadObj)

In the end the lsp-file will have to be loaded into the open dwg-file, which will trigger the loop. But this will only speed up the loop if the latter is run through inside the "isolated" AxDbDocument without contact to AutoCAD. Only at the end of the loop the result will be handed over to AutoCAD.

 

This "solution" feels like a "wrapped and isolated" loop, where isolation is only ended when the conditional statement is met. Could this basic idea possibly work? Or is it wishful thinking...


 

 

0 Likes