Jump to content

make current specific ViewPort


RepCad

Recommended Posts

Hello everyone,

There are two Viewports in a layout and I want to enable ModelSpace of selected viewport : 
 

  (setq d (vla-get-activedocument (vlax-get-acad-object)))

  (setq vp (car (entsel)))

  (setq vla (vlax-ename->vla-object vp))

  (vla-put-activeviewport d vla)

  (vla-put-mspace d :vlax-true)

 

It gives error after selecting a viewport : 
"Automation Error. Object was erased"

Link to comment
Share on other sites

Not sure, but have you tried :

Instead :

 

(vla-put-activeviewport d vla)

 

This :

 

(vla-put-activepviewport d vla)

  • Like 1
Link to comment
Share on other sites

8 hours ago, marko_ribar said:

Not sure, but have you tried :

Instead :

 

(vla-put-activeviewport d vla)

 

This :

 

(vla-put-activepviewport d vla)

 

Thanks, I try to use CHSPACE command to transfer polyline from model to layout in "activepviewport", but the program stops and returns this message 

Set the SOURCE viewport active and press ENTER to continue.:

 

* This problem just happens when viewport is more than one.

 

How do I pass this message ?

Link to comment
Share on other sites

Here's a quick example with no error checking You need to get the viewport ID then set CVPORT:

(setq e (car (entsel "\nPick a viewport: ")))
(vla-put-mspace (vla-get-ActiveDocument (vlax-get-acad-object)) :vlax-true)
(setvar 'cvport (cdr (assoc 69 (entget e))))

 

Link to comment
Share on other sites

I am not sure why need code to select viewport, if you can see the layout dbl click inside viewport goes straight to model. Then do CHSPACE.

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