Set Viewport scale, pause and end function

Set Viewport scale, pause and end function

murmanator
Advocate Advocate
870 Views
3 Replies
Message 1 of 4

Set Viewport scale, pause and end function

murmanator
Advocate
Advocate

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)
)

0 Likes
871 Views
3 Replies
Replies (3)
Message 2 of 4

scot-65
Advisor
Advisor
>> (command (getpoint "\n Select center of view:"))
(setq a (getpoint "\n Select center of view:"))
There is something wrong with this line. It should be
a variable to be used later [inside a command], however
I do not see the command to use it in.

>> (command (strcat "1/" (rtos (getvar "dimscale") 2 0) "xp"))
(setq b (strcat "1/" (rtos (getvar "dimscale") 2 0) "xp"))

Perhaps place the revised lines ABOVE (c:MPL), strip out
everything from that point to (command "pspace") and
un-cancel the MPL?

...
(c:MPL)
(read a)
(read b)
(command "pspace")
...

>> (command "CMDECHO" 1)
(setvar "CMDECHO" 1)
Is the desired method.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 4

murmanator
Advocate
Advocate

Thanks for checking it out Scot. I tried your revised lines but no luck. When I went to click for the center point it returned "Invalid Selection".

0 Likes
Message 4 of 4

scot-65
Advisor
Advisor
Apologies for the incorrect answer as my mind slipped a little...

There is a command called MPL.
In this instance it is accessed from inside another LISP.

I will call these "Source" and "Destination".
The source requires the scale factor and the center point.
Currently, one cannot supply these values from within the destination
and, one cannot supply arguments to the source from the destination
(unless you remove the "c:" part inside the source and add place
holders for the two arguments that will be supplied from the
destination).

Source Example:
(defun c:MPL (/...)... is changed to
(defun MPL ( c d / ...)...

Destination Example:
(setq a ...)
(setq b ...)
(MPL a b)

To resolve (choose one):
a) Follow the above.
b) Go inside the source and include these prompts (more clarification required).
c) Include the contents form the source into the destination and remove (c:MPL).

My question is:
Does MPL prompt for the scale factor and center point?

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes