Save-Change-Restore back the UCS via VisualLISP

Alexander V. Koshman

Usenet Archive
Joined
Dec 16, 2003
Messages
61
Reaction score
0
Hello!
Can you tell me how can I do with VisualLISP (ActiveX) the following:

1. Save 'Current UCS' parameters.
2. Create a temporary 'New UCS' with some changed parameters of 'Current UCS'.
3. (...do what I want...)
4. Restore back 'Current UCS'.
5. Delete this temporary 'New UCS'.

And all of that *without* having "_ActiveNN"-named UCS!

My own way was:
1. Make VLA-object (the new UCS named something like "_ActiveNN") with 'ActiveUCS property and save its parameters.
2. Modify the Current\Active UCS VLA-object with (vla-put-property ...).
3. (...do what I want...)
4. Modify the same Current\Active UCS VLA-object back with (vla-put-property ...).
5. Then I try to delete the UCS VLA-object...
....and get the Error message because of this UCS ("_ActiveNN") is still current and can't be deleted...

My question:
Is there any way to simply Restore Previous UCS via VisualLISP similar to (command "_ucs" "_p") in the step(4)? Then I could easily delete this temporary named UCS VLA-object.

Details:
=====
;;
;; Step 1
;;
(setq acad (vlax-get-acad-object))

(setq doc (vla-get-ActiveDocument acad))

;; This Creates new "_ActiveNN" named UCS:

(setq prevUcs (vlax-get-property doc 'ActiveUCS))

;; Get its properties:

(setq prevOriginPt (vlax-get-property prevUcs 'Origin))

(setq prevXDir (vlax-get-property prevUcs 'XVector))

(setq prevYDir (vlax-get-property prevUcs 'YVector))

;;
;; Step 2
;;
(setq curUCSXdir
....
) ; - 'setq'

(setq curUCSYdir
....
) ; - 'setq'

;; Make xDir & yDir values with 'vlax-make-safearray' & 'vlax-make-variant' .... .... ;; Make Changes in the 'prevUcs'

(vlax-put-property prevUcs 'XVector xDir)

(vlax-put-property prevUcs 'YVector yDir)

;; Make changed UCS Active:

;; (This makes "_ActiveNN" UCS Current)

(vlax-put-property doc 'ActiveUCS prevUcs)
 

Latest threads

Back
Top