RepCad Posted February 5 Posted February 5 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" Quote
marko_ribar Posted February 5 Posted February 5 Not sure, but have you tried : Instead : (vla-put-activeviewport d vla) This : (vla-put-activepviewport d vla) 1 Quote
RepCad Posted February 5 Author Posted February 5 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 ? Quote
ronjonp Posted February 5 Posted February 5 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)))) Quote
BIGAL Posted February 6 Posted February 6 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. Quote
Recommended Posts
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.