23
Figure Set Functions
This chapter includes the following topics:
FigSet Functions
A FigSet is a high performance, ordered grouping of database geometric objects or other FigSets. A member of a FigSet is unique within that FigSet, but an object can be added to multiple FigSets. The name of a FigSet is unique within the cellview it is associated with.
FigSets offer high performance because they are not database objects and are not saved to the disk. Consequently, operations performed on a FigSet cannot be undone. If you delete an object that is a member of a FigSet, the object is removed from the FigSet, and when you undo delete, the object is restored, but it is not added back to the FigSet. To store the contents of a FigSet on the disk, you need to create a corresponding FigSetGroup. For information about FigSetGroups, see FigSetGroup Functions.
FigSet C APIs are used to create, find, move, copy, append, prepend, clone, clear, and delete objects from FigSets; to access FigSet parameters; and to iterate over the objects stored in a cellview.
To learn how to use FigSet and FigSetGroup functions, see Example- Using the FigSet and FigSetGroup Code.
-
txAppendFig
-
txAppendFigSet
-
txClearFigSet
-
txCloneFigSet
-
txConcatFigSet
-
txCopyFigSet
-
txCreateFigSet
-
txDeleteFigSet
-
txFindFigSet
-
txGetCellViewFigSets
-
txGetFigSetBBox
-
txGetFigSetCellView
-
txGetFigSetEntry
-
txGetFigSetLength
-
txGetFigSetName
-
txIsFigSet
-
txMakeFigSet
-
txMoveFigSet
-
txPrependFig
-
txPrependFigSet
-
txRemoveFig
-
txRemoveFigSet
-
txRemoveFigSetEntry
txAppendFig
Boolean
txAppendFig( txFigSetIdfsId, dbFigIdfigId);
Description
Adds the specified figure as a member to the end of the given FigSet.
Arguments
Return Value
txAppendFigSet
Boolean
txAppendFigSet( txFigSetIdfsId, txFigSetIdfsId2);
Description
Adds the second FigSet as a member to the end of the first FigSet.
Arguments
Return Value
txClearFigSet
Boolean
txClearFigSet(
txFigSetId fsId
);
Description
Clears the contents of the specified FigSet.
Arguments
Return Value
txCloneFigSet
Boolean
txCloneFigSet( txFigSetIdfsId, txFigSetIdfsId2);
Description
Clears the contents of the first FigSet and then, copies the contents of the second FigSet to the first FigSet. The name for the first FigSet is copied from the name of the second FigSet.
Arguments
Return Value
txConcatFigSet
Boolean
txConcatFigSet( txFigSetIdfsId, txFigSetIdfsId2);
Description
Concatenates the contents of the second FigSet to the end of the first FigSet. The contents of the second FigSet remain unchanged.
Arguments
Return Value
txCopyFigSet
txFigSetId
txCopyFigSet( txFigSetIdsrcFigSetId, dbTransformtransform);
Description
Creates copies of each figure in the specified FigSet with the specified transform. A new FigSet containing the copied figures is returned. The copies are named automatically by using the convention FS_n, where n is a generated number that makes the name unique. So, the first FigSet name will be FS_0, then FS_1 and so on.
Arguments
|
The transformation object that is applied while copying figures in the given FigSet. |
Return Value
txCreateFigSet
txFigSetId
txCreateFigSet( dbCellViewIdcvId, constStringname);
Description
Creates an empty FigSet in the specified cellview. If the name argument is specified, the FigSet is created with the specified name. If the name argument is not specified (NULL), the FigSet is named automatically. Automatic naming is done using the convention FS_n, where n is a generated number that makes the name unique. So, the first FigSet name will be FS_0, then FS_1 and so on.
Arguments
Return Value
txDeleteFigSet
Boolean
txDeleteFigSet( txFigSetIdfsId, Booleandeep);
Description
Deletes the specified FigSet, but the objects that it contains are not deleted. If the FigSet is a member of another FigSet, it is removed from that FigSet before it is deleted. Deleting the FigSet frees its associated memory immediately.
Arguments
|
Specifies whether referenced FigSets should be deleted or not. |
Return Value
txFindFigSet
txFigSetId
txFindFigSet (dbCellViewIdcvId, constStringname);
Description
Searches the cellview for a FigSet with the specified name. When searching for the FigSet, a matching FigSetGroup is also searched and, if necessary, a corresponding FigSet is resurrected automatically from it.
Arguments
Return Value
txGetCellViewFigSets
txFigSetId *
txGetCellViewFigSets(
dbCellViewId cvId
);
Description
Returns an array of FigSets contained in the given design. The array is terminated by txcNullFigSetId.
Arguments
Return Value
|
Array containing IDs of all FigSets in the specified cellview. |
txGetFigSetBBox
dbBBox *
txGetFigSetBBox( txFigSetIdfsId, unsigned intnumIncludeLayers, dbLayer*includeLayers, unsigned intnumExcludeLayers, dbLayer*excludeLayers, unsigned intnumIncludeLPPs, txLPP*includeLPPs, unsigned intnumExcludeLPPs, txLPP*excludeLPPs, unsigned intnumIncludeTypes, dbType*includeTypes, unsigned intnumExcludeTypes, dbType*excludeTypes);
Description
Calculates the bounding box for the objects in the specified FigSet and returns a pointer to the resulting bounding box. Optionally, included and excluded layers, LPPs, and object types can also be specified.
Arguments
Return Value
|
Pointer to the resulting bounding box.
Returns |
txGetFigSetCellView
dbCellViewId
txGetFigSetCellView(
txFigSetId fsId
);
Description
Returns the ID of the parent cellview for the specified FigSet.
Arguments
Return Value
txGetFigSetEntry
txGetFigSetEntry( txFigSetIdfsId, unsigned intindex, txFigSetEntry *entry);
Description
Retrieves the FigSet element at the specified index location and places it at the memory area specified using entry.
Arguments
|
Pointer to the memory area where the FigSet entry will be placed. |
Return Value
txGetFigSetLength
unsigned int
txGetFigSetLength(
txFigSetId fsId
);
Description
Returns the number of objects in the specified FigSet.
Arguments
Return Value
txGetFigSetName
String
txGetFigSetName(
txFigSetId fsId
);
Description
Returns the name for the specified FigSet.
Arguments
Return Value
txIsFigSet
Boolean
txIsFigSet(
txId id
);
Description
Determines whether the specified database object is a FigSet object.
Arguments
Return Value
|
|
txMakeFigSet
txFigSetId
txMakeFigSet(
dbFigSetGroupId figSetGroupId
);
Description
Creates a FigSet from the given FigSetGroup and returns the new FigSet. The FigSet will be created if it does not exist; if it already exists, its contents will be replaced.
Arguments
Return Value
txMoveFigSet
Boolean
txMoveFigSet( txFigSetIdfigSetId, dbTransformtransform);
Description
Moves each figure in the specified FigSet by the specified transform.
Arguments
|
Transformation object that is applied while moving the figures in the specified FigSet |
Return Value
txPrependFig
Boolean
txPrependFig( txFigSetIdfsId, dbFigIdfigId);
Description
Adds the specified figure as a member at the beginning of the specified FigSet.
Arguments
Return Value
txPrependFigSet
Boolean
txPrependFigSet( txFigSetIdfsId, txFigSetIdfsId2);
Description
Adds the second FigSet as a member to the beginning of the first FigSet.
Arguments
Return Value
txRemoveFig
Boolean
txRemoveFig( txFigSetIdfsId, dbFigIdfigId);
Description
Removes the specified figure from the specified FigSet.
Arguments Return Value
txRemoveFigSet
txRemoveFigSet( txFigSetIdfsId, txFigSetIdfsId2);
Description
Removes the second FigSet from the first FigSet.
Arguments
Return Value
txRemoveFigSetEntry
Boolean
txRemoveFigSetEntry( txFigSetIdfsId, unsigned intindex);
Description
Removes the entry at the specified index from the specified FigSet.
Arguments
|
Index of an entry in the array of elements of the specified FigSet. |
Return Value
FigSetGroup Functions
A FigSetGroup is a method to store the contents of a FigSet in a database for use in different sessions.
FigSetGroup C APIs are used to create, delete, access, manage, and search FigSetGroup objects.
To learn how to use FigSet and FigSetGroup functions, see Example- Using the FigSet and FigSetGroup Code.
- dbDeleteFigSetGroup
- dbFindFigSetGroup
- dbFindFigSetGroupByName
- dbGenFigSetGroups
- dbGetFigSetGroupName
- dbIsFigSetGroup
- dbMakeFigSetGroup
- dbStartGenFigSetGroups
dbDeleteFigSetGroup
Boolean
dbDeleteFigSetGroup(
dbFigSetGroupId figSetGroupId,
);
Description
Deletes the specified FigSetGroup and the hierarchy of FigSetGroups that might exist in it.
Arguments
Return Value
dbFindFigSetGroup
dbFigSetGroupId
dbFindFigSetGroup( dbCellViewIdcvId, txFigSetIdfigSetId);
Description
Searches the specified cellview for a FigSetGroup that has the same name as the specified FigSet.
Arguments
|
ID of the FigSet for which the matching FigSetGroup is being searched. |
Return Value
dbFindFigSetGroupByName
dbFigSetGroupId
dbFindFigSetGroupByName( dbCellViewIdcvId, constStringname);
Description
Searches the specified cellview for a FigSetGroup with the specified name.
Arguments
Return Value
dbGenFigSetGroups
Boolean
dbGenFigSetGroups( dbGenStateIdpState, dbFigSetGroup *figSetGroupId);
Description
Retrieves the next FigSetGroup ID from the generator with the given dbGenStateId. The FigSetGroup ID is returned in the figSetGroupId argument.
Arguments
|
ID of the next FigSetGroup produced by the generator. This value is undefined if |
Return Value
dbGetFigSetGroupName
String
dbGetFigSetGroupName(
dbFigSetGroupId figSetGroupId
);
Description
Returns the name for the specified FigSetGroup object.
Arguments
Return Value
dbIsFigSetGroup
Boolean
dbIsFigSetGroup(
dbId id
);
Description
Indicates whether the specified dbId is a FigSetGroup object.
Arguments
Return Value
|
|
dbMakeFigSetGroup
dbFigSetGroupId
dbMakeFigSetGroup( dbCellViewIdcvId, txFigSetIdfigSetId);
Description
Makes a FigSetGroup in the specified cellview that is associated with the specified FigSet and populates it with the contents of the FigSet. If a FigSetGroup with the same name as the specified FigSet does not exist, it is created and assigned the name of the FigSet. If such a FigSetGroup exists, its contents are cleared and replaced with the contents of the FigSet.
Arguments
Return Value
dbStartGenFigSetGroups
dbGenStateId
dbStartGenFigSetGroups(
dbCellViewId cellViewId
);
Description
Initializes a generator for all FigSetGroup objects in the specified cellview. A generator state is returned, which is used with the function.
Arguments
|
ID of the cellview containing the FigSetGroups to be generated. |
Return Value
Example- Using the FigSet and FigSetGroup Code
The following example illustrates how to use the FigSet and FigSetGroup APIs.
void print(txFigSetId figSet) {
txFigSetEntry entry;
printf(" %s=> [", txGetFigSetName(figSet));
for (unsigned int i = 0; i < txGetFigSetLength(figSet);i++) {
txGetFigSetEntry(figSet, i, &entry);
if (entry.type == txcFigureSetFig) {
printf("rect%d ", dbGetShapeRec(entry.data.figId)->layer);
} else {
print(entry.data.figSetId);
}
}
printf("] ");
}
void example() {
dbBBox bbox0;
dbBBox bbox1;
dbFillBBox(&bbox0, 0, 0, 100, 100);
dbFillBBox(&bbox1, -100, -100, 0, 0);
dbCellViewId cvId = dbOpenCellViewByType(libName, "rect", "layout",
"maskLayout", "r", dbcNullCellViewId);
dbRectId rect0 = dbCreateRect(cvId, 0, dbcDrawingPurpose, &bbox0);
dbRectId rect1 = dbCreateRect(cvId, 1, dbcDrawingPurpose, &bbox1);
// Create a FigSet hierarchy
txFigSetId figSetTop = txCreateFigSet(cvId, "topFigSet");
txFigSetId figSet0 = txCreateFigSet(cvId, NULL); // Auto-named ->"FS_0"
txFigSetId figSet1 = txCreateFigSet(cvId, NULL); // Auto-named ->"FS_1"
txAppendFig(figSet0, rect0);
txAppendFig(figSet1, rect1);
txAppendFigSet(figSetTop, figSet1);
txPrependFigSet(figSetTop, figSet0);
txPrependFig(figSetTop, rect1);
printf("Initial state\n");
print(figSetTop);
printf("\n");
txFigSetId clone = txCreateFigSet(cvId, "clone");
if (txCloneFigSet(clone, figSetTop)) {
printf("Clone\n");
print(clone);
printf("\n");
}
if (txClearFigSet(clone)) {
printf("After clearing the contents of the clone\n");
print(clone);
printf("\n");
}
dbTransform transform;
transform.offset.x = 50000;
transform.offset.y = 0;
transform.orient = dbcR0;
transform.mag = 1.;
txFigSetId copy = txCopyFigSet(figSetTop, transform);
printf("Copy\n");
print(copy);
printf("\n");
dbBBox *figSetBBox = txGetFigSetBBox(figSetTop, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL);
dbLayer layers[1] = {0};
dbLayer layers2[2] = {0, 1};
printf("BBox of figSetTop : (%d, %d), (%d, %d)\n",
figSetBBox->lowerLeft.x, figSetBBox->lowerLeft.y,
figSetBBox->upperRight.x, figSetBBox->upperRight.y);
figSetBBox = txGetFigSetBBox(figSetTop, 1, layers, 0, NULL, 0, NULL,
0, NULL, 0, NULL, 0, NULL);
printf("BBox of figSetTop including only Layer 0: (%d, %d), (%d, %d)\n",
figSetBBox->lowerLeft.x, figSetBBox->lowerLeft.y,
figSetBBox->upperRight.x, figSetBBox->upperRight.y);
figSetBBox = txGetFigSetBBox(figSetTop, 0, NULL, 1, layers, 0, NULL,
0, NULL, 0, NULL, 0, NULL);
printf("BBox of figSetTop excluding only Layer 0: (%d, %d), (%d, %d)\n",
figSetBBox->lowerLeft.x, figSetBBox->lowerLeft.y,
figSetBBox->upperRight.x, figSetBBox->upperRight.y);
figSetBBox = txGetFigSetBBox(figSetTop, 0, NULL, 2, layers2, 0, NULL,
0, NULL, 0, NULL, 0, NULL);
printf("BBox of figSetTop excluding Layer 0 and 1: (%d, %d), (%d, %d)\n",
figSetBBox->lowerLeft.x, figSetBBox->lowerLeft.y,
figSetBBox->upperRight.x, figSetBBox->upperRight.y);
// Make a figSetGRoup and vice-versa.
dbFigSetGroupId figSetGrouTop0 = dbMakeFigSetGroup(cvId, figSetTop);
if (txClearFigSet(figSetTop)) {
txMakeFigSet(figSetGrouTop0);
printf("After resurecting the top FigSet from a FigSet group\n");
print(figSetTop);
printf("\n");
}
// Iterate on all the existing FigSetGroups and print their name.
printf("Existing FigSet group : ");
dbGenStateId genState = dbStartGenFigSetGroups(cvId);
dbFigSetGroupId figSetGroupId;
while (dbGenFigSetGroups(genState, &figSetGroupId)) {
printf("%s ", dbGetFigSetGroupName(figSetGroupId));
}
}
The example above generates the following output:
topFigSet=> [rect1 FS_0=> [rect0 ] FS_1=> [rect1 ] ]
clone=> [rect1 FS_0=> [rect0 ] FS_1=> [rect1 ] ]
Clear the contents of the clone
FS_2=> [rect1 FS_3=> [rect0 ] FS_4=> [rect1 ] ]
BBox of figSetTop : (-100, -100), (100, 100)
BBox of figSetTop including only Layer 0: (0, 0), (100, 100)
BBox of figSetTop excluding only Layer 0: (-100, -100), (0, 0)
BBox of figSetTop excluding Layer 0 and 1: (0, 0), (0, 0)
After resurrecting the top FigSet from a FigSetGroup
topFigSet=> [rect1 FS_0=> [rect0 ] FS_1=> [rect1 ] ]
Existing FigSetGroup : topFigSet FS_0 FS_1
Return to top