Complete the code to create a new viewport in AutoCAD.
vport = acad.ActiveDocument.ModelSpace.Add[1]()To create a viewport, use the AddViewport() method or AddViewport object. Here, AddViewport() is the correct method to add a viewport.
Complete the code to set the scale of the viewport to 1:50.
vport.CustomScale = [1]The scale factor for 1:50 is 1 divided by 50, which is 0.02. So, setting CustomScale to 0.02 applies the correct scale.
Fix the error in the code to activate the viewport.
acad.ActiveDocument.ActiveLayout.[1] = vportThe property to set the active viewport is ActiveViewport. Assigning the viewport object to this activates it.
Fill both blanks to set the viewport center and width.
vport.Center = [1] vport.Width = [2]
The viewport center is set using a Point object, here at (5,5,0). The width is a numeric value, here 10 units.
Fill all three blanks to create a viewport, set its scale, and activate it.
vport = acad.ActiveDocument.ModelSpace.Add[1]() vport.CustomScale = [2] acad.ActiveDocument.ActiveLayout.[3] = vport
First, create a viewport with AddViewport(). Then set the scale to 0.05 (1:20 scale). Finally, activate the viewport by assigning it to ActiveViewport.
