Author Topic: How to set a document active?  (Read 4663 times)

0 Members and 2 Guests are viewing this topic.

Brick_top

  • Guest
How to set a document active?
« on: December 07, 2011, 04:23:03 AM »
Hi... thread title says it.

I would like to set a document active in this case a dwg using autolisp.

thanks!

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: How to set a document active?
« Reply #1 on: December 07, 2011, 05:32:52 AM »
Code: [Select]
(if (setq filename (vla-open (vla-get-Documents (vlax-get-acad-object))
                         "put here the complete path of your file"
                         :vlax-false
               )
    )
  (vla-activate filename)
)

Brick_top

  • Guest
Re: How to set a document active?
« Reply #2 on: December 07, 2011, 05:48:32 AM »
thanks a lot!  :-)

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: How to set a document active?
« Reply #3 on: December 07, 2011, 05:50:01 AM »

Brick_top

  • Guest
Re: How to set a document active?
« Reply #4 on: December 07, 2011, 06:00:00 AM »
I forgot to mention the file I want to set active is already opened.

do you know how to do it in this case?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to set a document active?
« Reply #5 on: December 07, 2011, 06:34:39 AM »

If the drawing is named "Drawing111.dwg"


Code - Auto/Visual Lisp: [Select]


but keep in mind that your lisp is loaded into the previous document ( the one prior to the change)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Brick_top

  • Guest
Re: How to set a document active?
« Reply #6 on: December 07, 2011, 06:42:26 AM »
Thanks a lot Kerry,

I know the lisp file will not be loaded into the new active drawing.

Thanks again.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to set a document active?
« Reply #7 on: December 07, 2011, 06:46:36 AM »
I would advise against having the VLIDE open when evaluating vla-activate  - the two don't mix too well.  :wink:

Brick_top

  • Guest
Re: How to set a document active?
« Reply #8 on: December 07, 2011, 06:52:44 AM »
oh..

I'll try to remember that!

thanks...

Anyway I could close VLIDE before I use vla-activate?

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to set a document active?
« Reply #9 on: December 07, 2011, 10:52:22 AM »
That might help, though your bigger problem is what you do after the activate. It's near impossible to get lisp to continue working on another drawing from the one you started the routine. Or at least extremely difficult with strange work-arounds.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Brick_top

  • Guest
Re: How to set a document active?
« Reply #10 on: December 07, 2011, 11:02:04 AM »
Hi irneb

I'm not trying to do that now, I just want to set an already opened drawing active without any problems. I intend to run another routine on that drawing.