Author Topic: Viewports (and PViewports?)!  (Read 2757 times)

0 Members and 1 Guest are viewing this topic.

sparky

  • Guest
Viewports (and PViewports?)!
« on: October 11, 2004, 04:15:02 PM »
(#<VLA-OBJECT IAcadLWPolyline 0174292c> ("96x126" . "9"))

The 'Blatt' variable looks like the above.
Then what I am trying to do in the code below is

1. Go through all Layouts in the collection...and if it finds one with a name equal to the car of the dotted pair...then make it the ActiveLayout.

2. Get the one and only viewport on the Activelayout  (there is only one on all the layouts) and make it the Active Viewport...BUT

; error: Automation Error. No active viewport in paperspace
(see.... that's what I'm trying to create???)

3. Get a View whose name is the cdr of the Dotted pair in 'Blatt' and Set the View in the ActiveViewport (ERROR above) with that view.

4. Call the ActiveViewport property again with the updated Viewport object for the View changes to appear.

ERROR...because the SetView Method returns nill.

Code: [Select]

(vlax-for ALayout LayoutsCollect
    (if (= (vla-get-Name ALayout) (caadr Blatt))
      (vla-put-ActiveLayout ActDoc ALayout)      
     )
   )
 
  (setq ViewprtsCollect (vla-get-Viewports ActDoc))
  (setq viewprt (vla-Item ViewprtsCollect 0))
  (setq viewprt (vla-put-ActiveViewport ActDoc viewprt)

  (setq ViewsCollect (vla-get-Views Actdoc)
NewViewName (cdadr Blatt))
  (vlax-for AView  ViewsCollect
    (if (= NewViewName (vla-get-Name AView))
      (setq vlView (vla-Item ViewsCollect NewViewName))
    )
  )

  (setq viewprt (vla-SetView viewprt vlView))
  (setq viewprt (vla-put-ActiveViewport ActDoc viewprt)


Can anyone tell me why there is no active viewport, and if not why I'm not able to create one with the code above. If I can figure that out maybe I can get the rest to work and the second call to the AvtiveViewport property to reflect the view changes!