Author Topic: Create Viewport in Paper Space and Set Scale  (Read 2701 times)

0 Members and 1 Guest are viewing this topic.

Bill Tillman

  • Newt
  • Posts: 90
Create Viewport in Paper Space and Set Scale
« on: February 03, 2012, 07:39:45 PM »
The project at work is moving along and so far we're all pleased with it. The next phase will be to jump to one of the layout tabs, which will already be formatted and have the title block on it for 11 x 17 paper. Eventually we will want to use 17 x 22 paper.

I would like to create code which will jump to Layout Tab 1, create a viewport, set the scale to say 1" = 1'-0", and then position the objects that the code created in model space centered or to at least some desired view position in the viewport. Oh, yes, I guess after that I should lock the viewport. As I speak through this it sounds like it might be easier to manually create the viewport, set the scale and view to the model space area. The objects created in model space are created by VLISP code and are the same three orthographic views of the product, the size of course will change, but the scale of 1"=1'-0" should allow them to fit comfortably in the viewport on 11 x 17 or 17 x 22 paper.

Just a few pointers should help me get off in the right direction on this.
Of all the things I've lost, I miss my mind the most!


  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Create Viewport in Paper Space and Set Scale
« Reply #1 on: February 04, 2012, 08:12:01 AM »
Do you want to do this using true lisp code instead of simply command calls? Otherwise it's a rather trivial task to simply read the position of the MS objects, change the UCS according to side, issue the plan command, and zoom to them inside the VP, then zoom to a scale in the VP using the "Zoom" "#/#XP" option. The trick is to figure out what the command-line versions of the relevant commands need.

If you want to entmod the VP, then the dxf code 10 hold the MS's WCS XYZ value of the center of the VP (like a target point for a camera). 16 holds the direction vector (similar to a UCS's direction) - like an inclination and rotation around the target point given in XYZ coordinates. 45 is the MS unit length of the VP's display height, 41 is the PS height - so the factor between these is the zoom factor (effectively the scale factor).

If you want to go the ActiveX route then look at the help here:
Note the same properties can be applied through the Center, Direction and CustomScale/StandardScale properties.

Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.


  • Swamp Rat
  • Posts: 619
Re: Create Viewport in Paper Space and Set Scale
« Reply #2 on: February 04, 2012, 05:51:21 PM »
maybe something from this topic will help you