ModelItem
This section describes the the VB API methods that enable you to access and manipulate ModelItems.
Solid Geometry Traversal
Solid models are made up of 11 distinct types of IpfcModelItem, as follows:
•  IpfcFeature
•  IpfcSurface
•  IpfcEdge
•  IpfcCurve (datum curve)
•  IpfcAxis (datum axis)
•  IpfcPoint (datum point)
•  IpfcQuilt (datum quilt)
•  IpfcLayer
•  IpfcNote
•  IpfcDimension
•  IpfcRefDimension
Each model item is assigned a unique identification number that will never change. In addition, each model item can be assigned a string name. Layers, points, axes, dimensions, and reference dimensions are automatically assigned a name that can be changed.
Getting ModelItem Objects
Methods and Properties Introduced:
  • IpfcModelItemOwner.ListItems()
  • IpfcFeature.ListSubItems()
  • IpfcLayer.ListItems()
  • IpfcModelItemOwner.GetItemById()
  • IpfcModelItemOwner.GetItemByName()
  • IpfcFamColModelItem.RefItem
  • IpfcSelection.SelItem
  • All models inherit from the interface IpfcModelItemOwner. The method IpfcModelItemOwner.ListItems() returns a sequence of IpfcModelItems contained in the model. You can specify which type of IpfcModelItem to collect by passing in one of the enumerated EpfcModelItemType values, or you can collect all IpfcModelItems by passing null as the model item type.
    If the model has multiple bodies, the method IpfcModelItemOwner.ListItems() returns the exception IpfcXToolkitMultibodyUnsupported.
    Note
    The part modeling features introduced in Creo Parametric 1.0 will be excluded from the list of features returned by the method IpfcModelItemOwner.ListItems() if the model item type is specified asEpfcITEM_FEATURE. For example edit round features, flexible modeling features, and so on will be excluded from the list.
    The methods IpfcFeature.ListSubItems() and IpfcLayer.ListItems() produce similar results for specific features and layers. These methods return a list of subitems in the feature or items in the layer.
    To access specific model items, call the method IpfcModelItemOwner.GetItemById(). This methods enables you to access the model item by identifier.
    To access specific model items, call the method IpfcModelItemOwner.GetItemByName(). This methods enables you to access the model item by name.
    The property IpfcFamColModelItem.RefItem returns the dimension or feature used as a header for a family table.
    The property IpfcSelection.SelItem returns the item selected interactively by the user.
    ModelItem Information
    Methods and Properties Introduced:
  • IpfcModelItem.GetName()
  • IpfcModelItem.SetName()
  • IpfcModelItem.Id
  • IpfcModelItem.Type
  • Certain IpfcModelItems also have a string name that can be changed at any time. The methods IpfcModelItem.GetName() and IpfcModelItem.SetName() access this name.
    The property IpfcModelItem.Id returns the unique integer identifier for the IpfcModelItem.
    The IpfcModelItem.Type property returns an enumeration object that indicates the model item type of the specified IpfcModelItem. See the section Solid Geometry Traversal for the list of possible model item types.
    Duplicating ModelItems
    Methods and Properties Introduced:
  • IpfcBaseSession.AllowDuplicateModelItems()
  • You can control the creation of ModelItems more than twice for the same Creo Parametric item. The method IpfcBaseSession.AllowDuplicateModelItems() allows you to turn ON or OFF the option to duplicate model items. By default, this option is OFF. To turn the option ON, set the boolean value to FALSE.
    Note
    If this option is not handled properly on the application side, it can cause memory corruption. Thus, although you can turn ON and OFF this option as many times as you want, PTC recommends turning ON and OFF this option only once, right after the session is obtained.
    Layer Objects
    In the VB API, layers are instances of IpfcModelItem. The following sections describe how to get layer objects and the operations you can perform on them.
    Getting Layer Objects
    Method Introduced:
  • IpfcModel.CreateLayer()
  • The method IpfcModel.CreateLayer() returns a new layer with the name you specify.
    See the section Getting ModelItem Objects for other methods that can return layer objects.
    Layer Operations
    Methods and Properties Introduced:
  • IpfcLayer.Status
  • IpfcLayer.ListItems()
  • IpfcLayer.AddItem()
  • IpfcLayer.RemoveItem()
  • IpfcLayer.Delete()
  • IpfcLayer.CountUnsupportedItems()
  • Superseded Method:
  • IpfcLayer.HasUnsupportedItems()
  • The property IpfcLayer.Status enables you to access the display status of a layer. The corresponding enumeration class is EpfcDisplayStatus and the possible values are Normal, Displayed, Blank, or Hidden.
    Use the methods IpfcLayer.ListItems(), IpfcLayer.AddItem(), and IpfcLayer.RemoveItem() to control the contents of a layer.
    Note
    You cannot add the following items to a layer:
    •  ITEM_SURFACE,
    •  ITEM_EDGE,
    •  ITEM_COORD_SYS,
    •  ITEM_AXIS,
    •  ITEM_SIMPREP,
    •  ITEM_DTL_SYM_DEFINITION,
    •  ITEM_DTL_OLE_OBJECT,
    •  ITEM_EXPLODED_STATE.
    For these items the method will throw the exception IpfcXToolkitInvalidType.
    The method IpfcLayer.Delete() removes the layer (but not the items it contains) from the model.
    The method IpfcLayer.CountUnsupportedItems() returns the number of item types not supported as a IpfcModelItem object in the specified layer. This method deprecates the method IpfcLayer.HasUnsupportedItems().