Set Viewport scale, pause and end function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I got this program from one of the forums. It is working for most of what I want to do but at the end it bails out on me. Im trying to draw a viewport on a specific layer (works), click on where I want the center point to be (works), then set the viewport scale to 1/8"=1'0" (12 drawing units), then pause to fine tune the pan setting, then hit enter and have it finish (just go back to paper space). The scale, pause and finish is where Im lost (not a programmer).
Note that I commented out the MPL and LRG programs as they were external items that I did not have access to, possible they would have helped I dont know. Thanks for looking.
(defun c:vpt()
;===================Turn off command line responses==============
(command "CMDECHO" 0);DO NOT CHANGE THIS LINE
;=======================================================
(setq userlayer (getvar "clayer"))
(setq ds2 (getvar "dimscale"))
(setq userview (getvar "ctab"))
;(setq myTile (getvar "TILEMODE"))
;(autoload "LRG" '("LRG"))
;(autoload "MPL" '("MPL"))
(if (> 0 myTile)
(prompt "\n Switching view tab......")
(command "tilemode" 0)
)
;(c:LRG)
(setvar "CLAYER" "VP")
(princ "\n")
;(command "osmode" "523")
;(princ "\n")
(command "mview")
(princ "\n")
(command (setq p1 (getpoint "\n Select first corner of window opening: ")))
(prompt "\n ")
(command (getcorner p1 "\n Select opposite corner of window opening: "))
(prompt "\n ")
(command "mspace")
; moved MPL for set scale to invoke in mspace only
;(c:MPL)
(princ "\n")
(command "zoom" "e")
(princ "\n")
(command "zoom" "c")
(princ "\n")
(command (getpoint "\n Select center of view:")) ;;;;<<<<<<< WORKS UP TO HERE
(princ "\n")
(command (strcat "1/" (rtos (getvar "dimscale") 2 0) "xp"))
(princ "\n")
(command "pspace")
(princ "\n")
(setvar "psltscale" 0)
(princ "\n")
(prompt "\n DIMSCALE returning to original setting. ")
(princ "\n")
(setvar "dimscale" ds2)
;===================Turn on command line responses==============
(command "CMDECHO" 1);DO NOT CHANGE THIS LINE
;======================================================
(prompt "\n Returning view and layer.....")
(command "ctab" userview)
(command "clayer" userlayer)
(prompt "\n View and layer returned!")
(princ)
)