ModelItem
This section describes the Web.Link methods that enable you to access and manipulate ModelItems.
Solid Geometry Traversal
Solid models are made up of 11 distinct types of pfcModelItem, as follows:
•  pfcFeature
•  pfcSurface
•  pfcEdge
•  pfcCurve (datum curve)
•  pfcAxis (datum axis)
•  pfcPoint (datum point)
•  pfcQuilt (datum quilt)
•  pfcLayer
•  pfcNote
•  pfcDimension
•  pfcRefDimension
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:
  • pfcModelItemOwner.ListItems()
  • pfcFeature.ListSubItems()
  • pfcLayer.ListItems()
  • pfcModelItemOwner.GetItemById()
  • pfcModelItemOwner.GetItemByName()
  • pfcFamColModelItem.RefItem
  • pfcSelection.SelItem
  • All models inherit from the class pfcModelItemOwner. The method pfcModelItemOwner.ListItems returns a sequence of pfcModelItems contained in the model. You can specify which type of pfcModelItem to collect by passing in one of the enumerated pfcModelItemType values, or you can collect all pfcModelItems by passing null as the model item type.
    If the model has multiple bodies, the method pfcModelItemOwner.ListItems() returns the exception pfcXToolkitMultibodyUnsupported.
    Note
    The part modeling features introduced in Creo Parametric1.0 will be excluded from the list of features returned by the method pfcModelItemOwner.ListItems() if the model item type is specified asITEM_FEATURE. For example edit round features, flexible modeling features, and so on will be excluded from the list.
    The methods pfcFeature.ListSubItems() and pfcModelItemOwner.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 pfcModelItemOwner.GetItemById(). This methods enables you to access the model item by identifier.
    To access specific model items, call the method pfcModelItemOwner.GetItemByName(). This methods enables you to access the model item by name.
    The property pfcFamColModelItem.RefItem returns the dimension or feature used as a header for a family table.
    The property pfcSelection.SelItem returns the item selected interactively by the user.
    ModelItem Information
    Methods and Properties Introduced:
  • pfcModelItem.GetName()
  • pfcModelItem.SetName()
  • pfcModelItem.Id
  • pfcModelItem.Type
  • Certain pfcModelItems also have a string name that can be changed at any time. The methods GetName and SetName access this name.
    The property Id returns the unique integer identifier for the pfcModelItem.
    The Type property returns an enumeration object that indicates the model item type of the specified pfcModelItem. See the section Solid Geometry Traversal for the list of possible model item types.
    Duplicating ModelItems
    Methods and Properties Introduced:
  • pfcBaseSession.AllowDuplicateModelItems()
  • You can control the creation of ModelItems more than twice for the same Creo Parametric item. The method pfcBaseSession.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 Web.Link, layers are instances of pfcModelItem. The following sections describe how to get layer objects and the operations you can perform on them.
    Getting Layer Objects
    Method Introduced:
  • pfcModel.CreateLayer()
  • The method pfcModel.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:
  • pfcLayer.Status
  • pfcLayer.ListItems()
  • pfcLayer.AddItem()
  • pfcLayer.RemoveItem()
  • pfcLayer.Delete()
  • pfcLayer.CountUnsupportedItems()
  • Superseded Method:
  • pfcLayer.HasUnsupportedItems()
  • The property pfcLayer.Status enables you to access the display status of a layer. The corresponding enumeration class is pfcDisplayStatus and the possible values are Normal, Displayed, Blank, or Hidden.
    Use the methods pfcLayer.ListItems(), pfcLayer.AddItem(), and pfcLayer.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 pfcXToolkitInvalidType.
    The method pfcLayer.Delete() removes the layer (but not the items it contains) from the model.
    The method pfcLayer.CountUnsupportedItems() returns the number of item types not supported as a pfcModelItem object in the specified layer. This method deprecates the method pfcLayer.HasUnsupportedItems.