Author Topic: Recover a zoom in modell space after a change  (Read 1005 times)

0 Members and 1 Guest are viewing this topic.

ttechnik

  • Newt
  • Posts: 24
Recover a zoom in modell space after a change
« on: April 23, 2012, 06:52:53 PM »
Hi,

How to recover a zoom in modell space after a change?

I probe store the window properties with this code:

Code: [Select]

(setq acadObject   (vlax-get-acad-object))
(setq acadDocument (vla-get-ActiveDocument acadObject))
  (setq acadViewport (vla-get-ActiveViewPort acadDocument))

(setq center (vla-get-Center acadViewport))
  (setq center_safe (vlax-variant-value center))
  (setq centerlista (vlax-safearray->list center_safe))
  (setq height (vla-get-Height acadViewport))
  (setq width (vla-get-Width acadViewport))

  (setq bal_also (vlax-make-safearray vlax-vbDouble (cons 0  2)))
  (vlax-safearray-put-element bal_also 0 (- (car centerlista) (/ width 2)))
  (vlax-safearray-put-element bal_also 1 (- (cadr centerlista) (/ height 2)))
  (vlax-safearray-put-element bal_also 2 0)

  (setq jobb_felso (vlax-make-safearray vlax-vbDouble (cons 0  2)))
  (vlax-safearray-put-element jobb_felso 0 (+ (car centerlista) (/ width 2)))
  (vlax-safearray-put-element jobb_felso 1 (+ (cadr centerlista) (/ height 2)))
  (vlax-safearray-put-element jobb_felso 2 0)



This code bring the center.....
But from the saved document. Not actual!

The center is same....same..., while I saved the file...

Thomas
Tamás Csepcsényi

ttechnik

  • Newt
  • Posts: 24
Re: Recover a zoom in modell space after a change
« Reply #1 on: April 24, 2012, 05:04:00 AM »
This is good:
Code: [Select]
(setq acadObject   (vlax-get-acad-object))
  (setq center (getvar "VIEWCTR"))
  (setq height (getvar "VIEWSIZE"))
  (setvar "CMDECHO" 0)
  (vla-ZoomAll acadObject)

.
.
.
.

(vla-ZoomCenter acadObject (vlax-3d-point center) height)
  (setvar "CMDECHO" 1)



Tamás Csepcsényi

Peter2

  • Swamp Rat
  • Posts: 568
Re: Recover a zoom in modell space after a change
« Reply #2 on: April 26, 2019, 04:38:09 AM »
Thanks ttechnik (after exactly 7 years  :laugh: )
Peter

AutoCAD Map 3D 2018 German (so some technical terms will be badly retranslated to English)
BricsCAD V19