Method AddViewport
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
AddViewport(CadDocument, string, double[], string, double[], IEnumerable<string>)
Adds a viewport to a layout that shows model space at a scale, as MVIEW with two corners and the scale of ZOOM nXP:
the frame is the viewport's rectangle on the sheet, the view is centred on a point of model space and shows
scale paper millimetres to the unit, and the layers named are frozen in this viewport only. A frame
200 wide and 100 high at 1:50 shows 10 000 by 5 000 units. One undo step.
public static string AddViewport(CadDocument document, string layout, double[] frame, string scale, double[] center, IEnumerable<string> frozenLayers)
Parameters
documentCadDocumentThe drawing.
layoutstringThe layout, not Model.
framedouble[]The rectangle on the sheet,
[x1, y1, x2, y2]in millimetres, any two opposite corners.scalestringThe scale as
1:50,2:1or paper millimetres to the unit as0.02; not fit.centerdouble[]The point of model space at the middle of the frame,
[x, y]; null for the middle of what model space draws, or the origin where it draws nothing.frozenLayersIEnumerable<string>The layers to freeze in this viewport, or null; each must be in the drawing.
Returns
- string
The handle of the viewport.
Exceptions
- ArgumentNullException
Thrown when the drawing, the layout, the frame or the scale is null.
- ArgumentException
Thrown when the layout is not a sheet of the drawing, the frame has no width or height, the scale is not above nought, the centre is not two finite numbers or a layer is not in the drawing.