Jump to content

Recommended Posts

Posted

How can I identify a drawing that it is not the active one?

vla-get-ActiveDocument?

 

And if so... What is the purpose for vla-sendcommand?

 

I want to run a lisp routine in a drawing that it is not the active one

 

What is proper syntax for both situations?

 

I have been able to make active another drawing than the current one. Even change the screen to this another one but I ahve not been able to run a lisp routine on the last one, I mean from the one I was calling the new one to be active with:

 

vla-activate

 

Thanks in advance

 

Svorgodne

Posted
How can I identify a drawing that it is not the active one?

 

Hi,

 

You can call the system variable "dwgname" and compare it with the drawing name you want , so if matched then it is Active otherwise it is not.

Posted
How can I identify a drawing that it is not the active one?

vla-get-ActiveDocument?

 

To check if a Document Object is the active drawing:

(= :vlax-true (vla-get-active <document-object>))

Posted

Thanks Lee... it's just that I don't understand what's the use of vla-sendcommand since I cannot run a command on a non active drawing...

 

Do you have a simple sample?

 

I have a drawing... want to open another one

(vla-open)

 

Get all opened documents

(setq docs (vla-get-documents (vlax-get-acad-object)))

 

run a command on the second

(vla-sencommand)

 

close the second

(vla-close)

 

and come back to the original

(vla-item docs 0)

 

Is that the way it should work? Or should I stop doing the process. I need to stick to this process.

 

thanks again in advance

Sergio

Posted

More easy... I want to run a lisp routine in a drawing which is not the active.

 

Only that.

Posted

The use of the sendcommand method will cause the target drawing to become the active drawing, and since AutoLISP can only run in the active drawing, making another drawing the active drawing will cause the evaluation of the active AutoLISP program to cease.

 

Certain Visual LISP ActiveX methods are able to operate on non-active drawings (in the same way that you can use ObjectDBX to operate on another drawing without opening the drawing in the AutoCAD Editor), however, the viability of this approach will depend on the operations you are looking to perform with your AutoLISP program.

Posted (edited)

Thanks again Lee,

 

I'll explain my problem as clear as I can.

 

I have a system divided by views per architectural projects

 

Floorplans

_A (working progress phase)

_B (clean drawings)

_C (Layouts, presentation drawings _B xrefs)

 

Sections

_A (working progress phase)

_B (clean drawings)

_C (Layouts, presentation drawings _B xrefs)

 

Elevations

_A (working progress phase)

_B (clean drawings)

_C (Layouts, presentation drawings _B xrefs)

 

Etc...

 

The transfer from _A to _B on each view, demand to run some commands which are basically deleting all not desired information in _C. For example not "Help Layers" "All Layers on" "No Xrefs attached", or whatever kind of process a client may need.

 

That assures the Layouts are always in the last cleaned status, and let the users to keep working on the _A phase without having to "clean manually" a drawing to print it.

 

So far, I have been able to write succesfully a script from each _A to write/overwrite _B. I know I ama little picky, but this is not enough. If it happens that the user may have some _A drawings opened and runs this script in the first one, at the end of the script I have not been able to go back to the original file where I was starting the process.

 

This is the only opened issue.

 

Therefore I thought it could be possible to do it through VLA_ Autolisp commands.

 

I re-wrote the script which is written on the fly and with vla-open and vla-close I opened and close the corresponding _B from _A but in between I have not been able to do anything inside _B. That's why I was asking about a sample how to use these three autolisp commands.

 

vla-open

vla-sendcommand

vla-close

 

That's the whole problem, which lokking it from behind, it is only

 

making a copy from current drawing

open the copy

run some commands on it

close the copy

and make active the original drawing (in case there are more opened drawings)

 

Any suggestion?

 

Thanks again

Sergio

Edited by svorgodne
make it clearer
Posted
So far, I have been able to write succesfully a script from each _A to write/overwrite _B. I know I ama little picky, but this is not enough. If it happens that the user may have some _A drawings opened and runs this script in the first one, at the end of the script I have not been able to go back to the original file where I was starting the process.

 

I faced an identical issue when developing my Batch Attribute Editor program - my solution was to exclude open drawings from processing, and notify the user of such.

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