Jump to content

activated (modelspace) viewport in paperspace after startup routine


chulse

Recommended Posts

I have a seemingly strange and annoying issue with my startup routine. Most of the time, when I pern a dwg, the paperspace viewport is activated (in mspace). I have added this to my startup routine (in the acaddoc.lsp) but it is still happening.

 

(if (zerop (getvar 'tilemode)) (vla-put-mspace (vla-get-activedocument (vlax-get-acad-object)) :vlax-false))

 

the code seems to work on the command line, but isn't helping when I open a dwg.

 

Any thoughts? I can't see where/why it always activates the vports...

 

Thanks

Link to comment
Share on other sites

Perhaps ?

 

(if (and (zerop (getvar 'tilemode))
        (eq (vla-get-mspace
              (vla-get-activedocument (vlax-get-acad-object))
            )
            :vlax-true
        )
   )
 (vla-put-mspace
   (vla-get-activedocument (vlax-get-acad-object))
   :vlax-false
 )
)

Link to comment
Share on other sites

(defun _toPaper (doc)
 (if (and (zerop (getvar 'TILEMODE)) (> (getvar 'CVPORT) 1))
   (vla-put-mspace doc :vlax-false)
 )
)

Link to comment
Share on other sites

@Chulse - With your code commented out, do your drawings still open with the PViewport activated, even if you were to save the drawing with the PViewport not activated?

 

*IF* so, this suggests that there is separate code that is activating the PViewport(s), which *may* be executed after acaddoc.lsp (S::Startup perhaps?). This is just a guess, I could be totally wrong.

 

@Tharwat - I would avoid calling the ActiveDocument (or any other) Object more than once, unless there has been a change made where calling the object subsequent times makes the desired change(s) available. For the purposes of this thread, consider storing to a local variable (ActiveDoc?).

Link to comment
Share on other sites

@Tharwat - I would avoid calling the ActiveDocument (or any other) Object more than once, unless there has been a change made where calling the object subsequent times makes the desired change(s) available. For the purposes of this thread, consider storing to a local variable (ActiveDoc?).

 

That's right and faster . :)

 

Thank you.

Link to comment
Share on other sites

@Chulse - With your code commented out, do your drawings still open with the PViewport activated, even if you were to save the drawing with the PViewport not activated?

 

*IF* so, this suggests that there is separate code that is activating the PViewport(s), which *may* be executed after acaddoc.lsp (S::Startup perhaps?). This is just a guess, I could be totally wrong..

 

I suppose I should test more... I added that code to counter this behavior in the first place. I was trying to avoid a snipe hunt.

Link to comment
Share on other sites

I suppose I should test more... I added that code to counter this behavior in the first place. I was trying to avoid a snipe hunt.

 

Simply save a drawing in the desired state (where PViewport(s) are not activated), and reopen said drawing.

 

*IF* the Pviewport is in the same state, then this may not be the root of your problem.

 

However, *IF* the Pviewport is activated upon reopening, then you need to evaluate what code is being loaded at startup (acaddoc.lsp, startup suite, etc.). Any file(s) you have access to open an view contents (compiled code like .FAS, .VLX etc are non-readable) is where I would start.

 

Good luck!

Link to comment
Share on other sites

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