In addition to the extents, limits, and associations, the layout object uses the following properties: tab order, tab order status, annotative display status, linetype scale status, and insertion base point. In the following examples, the pLayout variable stores a pointer to the layout object, and the pDb variable stores a pointer to the database object.
The tab order defines the sequence number of the layout in the database as an Integer value; counting begins at zero (0). The predefined "Model" layout usually has the number zero. New layouts get an initial number of zero which should be changed to an actual number. The tab order can be changed for paper layouts (whose model type is False). The value is zero by default.
To get the tab order, use the getTabOrder() method which returns the number as an Integer value. For example:
odPrintConsoleString(L"\nLayout tab order = %d", pLayout->getTabOrder());
To set the tab order, use the setTabOrder() method which requires the number as an Integer value. The value must be in the range of one up to the maximum number of tabs. You cannot set the tab order to zero or a non-existing number. For example:
pLayout->setTabOrder(2);
Note: When a new layout is added using the dictionary interface, it gets assigned the number zero which should be changed to an actual number using the countLayouts() method of the database object. For example:
pLayout->setTabOrder( pDb->countLayouts() );
The tab selection status is a Boolean value that determines whether the layout is included in the selection set for operations that affect multiple tabs. The tab selection status is True if the layout is selected, or False if the layout is not selected. The initial value is False.
To check the status, use the getTabSelected() method which returns the status as a Boolean value. For example:
odPrintConsoleString(L"\nLayout %s selected", (pLayout->getTabSelected()) ? L"is" : L"is not");
To switch the status, use the setTabSelected() method which requires the status as a Boolean argument. For example:
// Make the layout selected
pLayout->setTabSelected(true);
// Make the layout non-selected
pLayout->setTabSelected(false);
The annotative display status is a Boolean value that determines whether annotative objects that do not support the current annotation scale are displayed or hidden. The annotative display status is True if all annotative objects of the layout are shown, or it is False if only annotative objects that support the current annotation scale are shown and annotative objects that do not are hidden. The initial value is False.
To check the status, use the annoAllVisible() method which returns the status as a Boolean value. For example:
odPrintConsoleString(L"\n%s are displayed", (pLayout->annoAllVisible()) ? L"All annotative objects" :
L"Only annotative objects supported the current annotation scale");
To switch the status, use the setAnnoAllVisible() method which requires the status as a Boolean argument. For example:
// All annotative objects
pLayout->setAnnoAllVisible(true);
// Only annotative objects supported the current annotation scale
pLayout->setAnnoAllVisible(false);
The linetype scale status is a Boolean value that determines whether plotting the dash lengths of linetypes is based on model space or paper space drawing units. The linetype scale status is True if the linetype dashes are plotted based on paper space units, or it is False if the linetype dashes are plotted based on model space units. The initial value is True.
To check the status, use the getPSLTSCALE() method which returns the status as a Boolean value. For example:
odPrintConsoleString(L"\nLinetype dash lengths are based on %s units",
(pLayout->getPSLTSCALE()) ? L"modelspace" : L"paperspace");
To switch the status, use the setPSLTSCALE() method which requires the status as a Boolean argument. For example:
// Plot on base of paperspace units
pLayout->setPSLTSCALE(true);
// Plot on base of modelspace units
pLayout->setPSLTSCALE(false);
The database object has similar methods for getting and setting the linetype scale status. The getPSLTSCALE() method returns the status, and the setPSLTSCALE() method specifies the status for the current active layout. For example:
odPrintConsoleString(L"\nLinetype scale status %s", (pDb->getPSLTSCALE()) ? L"On" : L"Off");
pDb->setPSLTSCALE(true);
Note: The PSLTSCALE system variable provides access to the linetype scale status.
The insertion base defines the three-dimensional coordinates of the point used for transforming block entities, keeping the origin as (0,0,0) when the model space block of one drawing is inserted as a block in another drawing. The initial value is (0,0,0).
To get the insertion base, use the getINSBASE() method which returns the three-dimensional point as an instance of the OdGePoint3d type. For example:
OdGePoint3d position = pLayout->getINSBASE();
odPrintConsoleString(L"\nInsertion base = (%f,%f,%f)", position.x, position.y, position.z);
To set the insertion base, use the setINSBASE() method which requires one argument — the three-dimensional point as an instance of the OdGePoint3d type — and does not return a value. For example:
OdGePoint3d position(10, 30, 20);
pLayout->setINSBASE(position);
The database object has the similar methods for getting and setting the insertion base point. The getINSBASE() method returns the insertion base point, and the setINSBASE() method specifies the insertion base point for the current active layout. For example:
OdGePoint3d position = pDb->getINSBASE();
pDb->setINSBASE( OdGePoint3d(1,2,3) );
Note: The INSBASE system variable provides access to the insertion base point.
Extents and Limits of the Layout Object
Creating and Manipulating Layouts
Example of Working with the Layout Object
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|