You are here:

AutoCAD/Changing the active window from Autolisp

Advertisement


Question
I'm trying to build an Autolisp procedure which copies the whole entities in a drawing, changes the active window and makes the copyorig in this second window. The problem is that I can't find the way to swap to that second window... CTRL-TAB (^I) doesn't seem to work and I even tried to "CLOSE" the active window so the second appears but "pasteorig" happens to execute before "close"  asks for saving and a message "can't close because something is executing" appears.
Thanks.
Ricard.

Answer
Ricard.
By "windows", I think you mean active drawing sessions, right?  Because if you meant VIEWPORTS, the toggle between them is ^V and I don't think you're going to get that to work in LISP, even with (menucmd "^V").  The shortcut key for that is CTRL+R, because CTRL+V is PASTECLIP now.  

So if your trying to make one lisp routine work in two drawing sessions, it won't work.  When you load a routine, it's for the drawing session that you opened it in.

Instead of copying and pasting from one drawing session to another, no LISP is required to create a drawing and XREF it into two drawing sessions so that when a change is made to the XREF, the change will appear when the XREFs are reloaded in the two drawing sessions or when the drawing sessions are reopened.

I am not a visual basic, person, but perhaps there would be a Visual Basic for Applications solution to your question, that would transcend the limitation we work under when working with LISP.

Keep in touch
Bill DeShawn
http://my.sterling.net/~bdeshawn

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.