Simplified Representations
The VB API gives programmatic access to all the simplified representation functionality of Creo Parametric. Create simplified representations either permanently or on the fly and save, retrieve, or modify them by adding or deleting items.
Overview
Using the VB API, you can create and manipulate assembly simplified representations just as you can using Creo Parametric interactively.
Note
the VB API supports simplified representation of assemblies only, not parts.
Simplified representations are identified by the IpfcSimRep class. This class is a child of IpfcModelItem, so you can use the methods dealing with IpfcModelItems to collect, inspect, and modify simplified representations.
The information required to create and modify a simplified representation is stored in a class called IpfcSimpRepInstructions which contains several data objects and fields, including:
•  String—The name of the simplified representation
•  IpfcSimpRepAction—The rule that controls the default treatment of items in the simplified representation.
•  IpfcSimpRepItem—An array of assembly components and the actions applied to them in the simplified representation.
A IpfcSimpRepItem is identified by the assembly component path to that item. Each IpfcSimpRepItem has it’s own IpfcSimpRepAction assigned to it. IpfcSimpRepAction is a visible data object that includes a field of type IpfcSimpRepActionType. You can use the method IpfcSimpRepAction.GetType() to set the actions. To delete an existing item, you must set the action as NULL.
EpfcSimpRepActionType is an enumerated type that specifies the possible treatment of items in a simplified representation. The possible values are as follows
Values
Action
EpfcSIMPREP_NONE
No action is specified.
EpfcSIMPREP_REVERSE
Reverse the default rule for this component (for example, include it if the default rule is exclude).
EpfcSIMPREP_INCLUDE
Include this component in the simplified representation.
EpfcSIMPREP_EXCLUDE
Exclude this component from the simplified representation.
EpfcSIMPREP_SUBSTITUTE
Substitute the component in the simplified representation.
EpfcSIMPREP_GEOM
Use only the geometrical representation of the component.
EpfcSIMPREP_GRAPHICS
Use only the graphics representation of the component.
EpfcSIMPREP_SYMB
Use the symbolic representation of the component.
EpfcSIMPREP_BOUNDBOX
Use the boundary box representation of the component.
EpfcSIMPREP_DEFENV
Use the default envelope representation of the component.
EpfcSIMPREP_LIGHT_GRAPH
Use the light weight graphics representation of the component.
EpfcSIMPREP_AUTO
Use the automatic representation of the component.
Retrieving Simplified Representations
Methods Introduced:
  • IpfcBaseSession.RetrieveAssemSimpRep()
  • IpfcBaseSession.RetrieveGeomSimpRep()
  • IpfcBaseSession.RetrieveGraphicsSimpRep()
  • IpfcBaseSession.RetrieveSymbolicSimpRep()
  • CCpfcRetrieveExistingSimpRepInstructions.Create()
  • You can retrieve a named simplified representation from a model using the method IpfcBaseSession.RetrieveAssemSimpRep(), which is analogous to the Assembly mode option Retrieve Rep in the SIMPLFD REP menu. This method retrieves the object of an existing simplified representation from an assembly without fetching the generic representation into memory. The method takes two arguments, the name of the assembly and the simplified representation data.
    To retrieve an existing simplified representation, pass an instance of CCpfcRetrieveExistingSimpRepInstructions.Create() and specify its name as the second argument to this method. Creo Parametric retrieves that representation and any active submodels and returns the object to the simplified representation as a IpfcAssembly.Assembly object.
    You can retrieve geometry, graphics, and symbolic simplified representations into session using the methods IpfcBaseSession.RetrieveGeomSimpRep(), IpfcBaseSession.RetrieveGraphicsSimpRep(), and IpfcBaseSession.RetrieveSymbolicSimpRep() respectively. Like IpfcBaseSession.RetrieveAssemSimpRep(), these methods retrieve the simplified representation without bringing the master representation into memory. Supply the name of the assembly whose simplified representation is to be retrieved as the input parameter for these methods. The methods output the assembly. They do not display the simplified representation.
    Creating and Deleting Simplified Representations
    Methods Introduced:
  • CCpfcCreateNewSimpRepInstructions.Create()
  • IpfcSolid.CreateSimpRep()
  • IpfcSolid.DeleteSimpRep()
  • To create a simplified representation, you must allocate and fill a IpfcSimpRepInstructions object by calling the method CCpfcCreateNewSimpRepInstructions.Create(). Specify the name of the new simplified representation as an input to this method. You should also set the default action type and add SimpRepItems to the object.
    To generate the new simplified representation, call IpfcSolid.CreateSimpRep(). This method returns the IpfcSimpRep object for the new representation.
    The method IpfcSolid.DeleteSimpRep() deletes a simplified representation from its model owner. The method requires only the IpfcSimpRep object as input.
    Extracting Information About Simplified Representations
    Methods and Properties Introduced:
  • IpfcSimpRep.GetInstructions()
  • IpfcSimpRepInstructions.DefaultAction()
  • IpfcCreateNewSimpRepInstructions.NewSimpName
  • IpfcSimpRepInstructions.IsTemporary
  • IpfcSimpRepInstructions.Items
  • Given the object to a simplified representation, IpfcSimpRep.GetInstructions() fills out the IpfcSimpRepInstructions object.
    The properties IpfcSimpRepInstructions.GetDefaultAction, IpfcCreateNewSimpRepInstructions.NewSimpName, and IpfcSimpRepInstructions.IsTemporary return the associated values contained in the IpfcSimpRepInstructionsobject.
    The property IpfcSimpRepInstructions.Items returns all the items that make up the simplified representation.
    Example 1: Working with Simplified Representation
    The sample code in the file pfcSimplifiedRepresentationExamples.vb located at <creo_vbapi_loadpoint>/vbapi_examples demonstrates the functionality used when working with existing simplified representations in Creo Parametric. This function matchSimpRepItem returns an array of simplified representation matching a ComponentPath for a certain feature as well as the IpfcSimpRepActionType for that item's action in the representation. If none are found the method prints the <NOT FOUND> message and returns null.
    Modifying Simplified Representations
    Methods and Properties Introduced:
  • IpfcSimpRep.GetInstructions()
  • IpfcSimpRep.SetInstructions()
  • IpfcSimpRepInstructions.DefaultAction
  • IpfcCreateNewSimpRepInstructions.NewSimpName
  • IpfcSimpRepInstructions.IsTemporary
  • Using the VB API, you can modify the attributes of existing simplified representations. After you create or retrieve a simplified representation, you can make calls to the methods listed in this section to designate new values for the fields in the IpfcSimpRepInstructions object.
    To modify an existing simplified representation retrieve it and then get the IpfcSimpRepInstructions object by calling IpfcSimpRep.GetInstructions(). If you created the representation programmatically within the same application, the IpfcSimpRepInstructions object is already available. Once you have modified the data object, reassign it to the corresponding simplified representation by calling the method IpfcSimpRep.SetInstructions().
    Adding Items to and Deleting Items from a Simplified Representation
    Methods and Properties Introduced:
  • CCpfcSimpRepReverse.Create()
  • CCpfcSimpRepInclude.Create()
  • CCpfcSimpRepExclude.Create()
  • CCpfcSimpRepSubstitute.Create()
  • CCpfcSimpRepGeom.Create()
  • CCpfcSimpRepGraphics.Create()
  • CCpfcSimpRepDefaultEnvelope.Create()
  • CCpfcSimpRepBoundBox.Create()
  • CCpfcSimpRepLightWeightGraphics.Create()
  • CCpfcSimpRepItem.Create()
  • CCpfcSimpRep.SetInstructions()
  • CCpfcSimpRepInstructions.Items()
  • The method CCpfcSimpRepReverse.Create() creates an object that reverses the default rule for the assembly component in the simplified representation.
    The method CCpfcSimpRepInclude.Create() creates an object that includes the component in the simplified representation.
    The method CCpfcSimpRepExclude.Create() creates an object that excludes the component from the simplified representation.
    The method CCpfcSimpRepSubstitute.Create() creates an object that substitutes the component with a component from the IpfcSubstitution class in the simplified representation.
    The method CCpfcSimpRepGeom.Create() creates an object that represents the component that contains complete geometric information in the simplified representation.
    The method CCpfcSimpRepGraphics.Create() creates an object that represents the component that contains only display information in the simplified representation. These graphic representations cannot be modified or referenced, they can only be browsed through.
    Note
    As compared to graphics representations, geometry representations take longer to retrieve and require more memory.
    The method CCpfcSimpRepDefaultEnvelope.Create() creates an object that represents the component in default envelope type of simplified representation.
    The method CCpfcSimpRepBoundBox.Create() creates an object that represents the component in boundary box type of simplified representation.
    The method CCpfcSimpRepLightWeightGraphics.Create() creates an object that represents the component in lightweight type of simplified representation. Light graphics representations of assemblies contain assembly information and 3D thumbnail graphics representations of assembly components.
    The method CCpfcSimpRepItem.Create() creates an object that defines the status of the component or feature of the simplified representation.
    The method CCpfcSimpRep.SetInstructions() sets or changes the instructions that specify the internal data required to define the simplified representation.
    The method CCpfcSimpRepInstructions.Items applies an array of actions to the components or features in the simplified representation.
    You can add and delete items from the list of components in a simplified representation using the VB API. If you created a simplified representation using the option Exclude as the default rule, you would generate a list containing the items you want to include. Similarly, if the default rule for a simplified representation is Include, you can add the items that you want to be excluded from the simplified representation to the list, setting the value of the EpfcSimpRepActionType to EpfcSIMPREP_EXCLUDE.
    How to Add Items
    1. Get the IpfcSimpRepInstructions object, as described in the previous section.
    2. Specify the action to be applied to the item with a call to one of following methods.
    3. Initialize a IpfcSimpRepItem object for the item by calling the method IpfcSimpRepItem.Create().
    4. Add the item to the IpfcSimpRepItem sequence. Put the new IpfcSimpRepInstructions using IpfcSimpRepInstructions.Items.
    5. Reassign the IpfcSimpRepInstructions object to the corresponding IpfcSimpRep object by calling IpfcSimpRep.SetInstructions()
    How to Remove Items
    Follow the procedure above, except remove the unwanted IpfcSimpRepItem from the sequence.
    Simplified Representation Utilities
    Methods Introduced:
  • IpfcModelItemOwner.ListItems()
  • IpfcModelItemOwner.GetItemById()
  • IpfcSolid.GetSimpRep()
  • IpfcSolid.SelectSimpRep()
  • IpfcSolid.ActivateSimpRep()
  • IpfcSolid.GetActiveSimpRep()
  • This section describes the utility methods that relate to simplified representations.
    The method IpfcModelItemOwner.ListItems() can list all of the simplified representations in a Solid.
    The method IpfcModelItemOwner.GetItemById() initializes a IpfcSimpRep object. It takes an integer id.
    Note
    the VB API supports simplified representation of Assemblies only, not Parts.
    The method IpfcSolid.GetSimpRep() initializes a IpfcSimpRep object. The method takes SimpRepname as the input argument. SimpRepname is the name of the simplified representation in the solid. If you specify this argument, the method ignores the rep_id.
    The method IpfcSolid.SelectSimpRep() creates a Creo Parametric menu to enable interactive selection. The method takes the owning solid as input, and outputs the object to the selected simplified representation. If you choose the Quit menu button, the method throws an exception XToolkitUserAbort
    The methods IpfcSolid.GetActiveSimpRep() and IpfcSolid.ActivateSimpRep() enable you to find and get the currently active simplified representation, respectively. Given an assembly object, IpfcSolid.GetActiveSimpRep() returns the object to the currently active simplified representation. If the current representation is the master representation, the return is null.
    The method IpfcSolid.ActivateSimpRep() activates the requested simplified representation.
    To set a simplified representation to be the currently displayed model, you must also call IpfcModel.Display().