Simplified Representations
Web.Link 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 Web.Link, you can create and manipulate assembly simplified representations just as you can using Creo Parametric interactively.
Note
Web.Link supports simplified representation of assemblies only, not parts.
Simplified representations are identified by the pfcSimRep class. This class is a child of pfcModelItem, so you can use the methods dealing with pfcModelItems to collect, inspect, and modify simplified representations.
The information required to create and modify a simplified representation is stored in a class called pfcSimpRepInstructions which contains several data objects and fields, including:
•  String—The name of the simplified representation
•  pfcSimpRepAction—The rule that controls the default treatment of items in the simplified representation.
•  pfcSimpRepItem—An array of assembly components and the actions applied to them in the simplified representation.
A pfcSimpRepItem is identified by the assembly component path to that item. Each pfcSimpRepItem has it’s own pfcSimpRepAction assigned to it. pfcSimpRepAction is a visible data object that includes a field of type pfcSimpRepActionType. You can use the property pfcSimpRepAction to set the actions. To delete an existing item, you must set the action as NULL.
pfcSimpRepActionType is an enumerated type that specifies the possible treatment of items in a simplified representation. The possible values are as follows
Values
Action
SIMPREP_NONE
No action is specified.
SIMPREP_REVERSE
Reverse the default rule for this component (for example, include it if the default rule is exclude).
SIMPREP_INCLUDE
Include this component in the simplified representation.
SIMPREP_EXCLUDE
Exclude this component from the simplified representation.
SIMPREP_SUBSTITUTE
Substitute the component in the simplified representation.
SIMPREP_GEOM
Use only the geometrical representation of the component.
SIMPREP_GRAPHICS
Use only the graphics representation of the component.
SIMPREP_SYMB
Use the symbolic representation of the component.
SIMPREP_BOUNDBOX
Use the boundary box representation of the component.
SIMPREP_DEFENV
Use the default envelope representation of the component.
SIMPREP_LIGHT_GRAPH
Use the light weight graphics representation of the component.
SIMPREP_AUTO
Use the automatic representation of the component.
Retrieving Simplified Representations
Methods Introduced:
  • pfcBaseSession.RetrieveAssemSimpRep()
  • pfcBaseSession.RetrieveGeomSimpRep()
  • pfcBaseSession.RetrieveGraphicsSimpRep()
  • pfcBaseSession.RetrieveSymbolicSimpRep()
  • pfcRetrieveExistingSimpRepInstructions.Create()
  • You can retrieve a named simplified representation from a model using the method pfcBaseSession.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 pfcRetrieveExistingSimpRepInstructions.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 pfcAssembly.Assembly object.
    You can retrieve geometry, graphics, and symbolic simplified representations into session using the methods pfcBaseSession.RetrieveGeomSimpRep(), pfcBaseSession.RetrieveGraphicsSimpRep(), and pfcBaseSession.RetrieveSymbolicSimpRep() respectively. Like pfcBaseSession.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:
  • pfcCreateNewSimpRepInstructions.Create()
  • pfcSolid.CreateSimpRep()
  • pfcSolid.DeleteSimpRep()
  • To create a simplified representation, you must allocate and fill a pfcSimpRepInstructions object by calling the method pfcCreateNewSimpRepInstructions.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 pfcSimpRepItem to the object.
    To generate the new simplified representation, call pfcSolid.CreateSimpRep(). This method returns the pfcSimpRep object for the new representation.
    The method pfcSolid.DeleteSimpRep() deletes a simplified representation from its model owner. The method requires only the pfcSimpRep object as input.
    Extracting Information About Simplified Representations
    Methods and Properties Introduced:
  • pfcSimpRep.GetInstructions()
  • pfcSimpRepInstructions.DefaultAction
  • pfcCreateNewSimpRepInstructions.NewSimpName
  • pfcSimpRepInstructions.IsTemporary
  • pfcSimpRepInstructions.Items
  • Given the object to a simplified representation, pfcSimpRep.GetInstructions() fills out the pfcSimpRepInstructions object.
    The pfcSimpRepInstructions.DefaultAction, pfcCreateNewSimpRepInstructions.NewSimpName, and pfcSimpRepInstructions.IsTemporary properties return the associated values contained in the pfcSimpRepInstructionsobject.
    The property pfcSimpRepInstructions.Items returns all the items that make up the simplified representation.
    Modifying Simplified Representations
    Methods and Properties Introduced:
  • pfcSimpRep.GetInstructions()
  • pfcSimpRep.SetInstructions()
  • pfcSimpRepInstructions.DefaultAction
  • pfcCreateNewSimpRepInstructions.NewSimpName
  • pfcSimpRepInstructions.IsTemporary
  • Using Web.Link, 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 pfcSimpRepInstructions object.
    To modify an existing simplified representation retrieve it and then get the pfcSimpRepInstructions object by calling pfcSimpRep.GetInstructions. If you created the representation programmatically within the same application, the pfcSimpRepInstructions object is already available. Once you have modified the data object, reassign it to the corresponding simplified representation by calling the method pfcSimpRep.SetInstructions().
    Adding Items to and Deleting Items from a Simplified Representation
    Methods and Properties Introduced:
  • pfcSimpRepReverse.Create()
  • pfcSimpRepInclude.Create()
  • pfcSimpRepExclude.Create()
  • pfcSimpRepSubstitute.Create()
  • pfcSimpRepGeom.Create()
  • pfcSimpRepGraphics.Create()
  • pfcSimpRepDefaultEnvelope.Create()
  • pfcSimpRepBoundBox.Create()
  • pfcSimpRepLightWeightGraphics.Create()
  • pfcSimpRepItem.Create()
  • pfcSimpRep.SetInstructions()
  • pfcSimpRepInstructions.Items
  • The method pfcSimpRepReverse.Create() creates an object that reverses the default rule for the assembly component in the simplified representation.
    The method pfcSimpRepInclude.Create() creates an object that includes the component in the simplified representation.
    The method pfcSimpRepExclude.Create() creates an object that excludes the component from the simplified representation.
    The method pfcSimpRepSubstitute.Create() creates an object that substitutes the component with a component from the pfcSimpRep.Substitution class in the simplified representation.
    The method pfcSimpRepGeom.Create() creates an object that represents the component that contains complete geometric information in the simplified representation.
    The method pfcSimpRepGraphics.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 pfcSimpRepDefaultEnvelope.Create() creates an object that represents the component in default envelope type of simplified representation.
    The method pfcSimpRepBoundBox.Create() creates an object that represents the component in boundary box type of simplified representation.
    The method pfcSimpRepLightWeightGraphics.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 pfcSimpRepItem.Create() creates an object that defines the status of the component or feature of the simplified representation.
    The method pfcSimpRep.SetInstructions() sets or changes the instructions that specify the internal data required to define the simplified representation.
    The method pfcSimpRepInstructions.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 Web.Link. 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 pfcSimpRepActionType to SIMPREP_EXCLUDE.
    How to Add Items
    1. Get the pfcSimpRepInstructions 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 pfcSimpRepItem object for the item by calling the method pfcSimpRepItem.Create().
    4. Add the item to the pfcSimpRepItem sequence. Put the new pfcSimpRepInstructions using pfcSimpRepInstructions.Items.
    5. Reassign the pfcSimpRepInstructions object to the corresponding pfcSimpRep object by calling pfcSimpRep.SetInstructions()
    How to Remove Items
    Follow the procedure above, except remove the unwanted pfcSimpRepItem from the sequence.
    Simplified Representation Utilities
    Methods Introduced:
  • pfcModelItemOwner.ListItems()
  • pfcModelItemOwner.GetItemById()
  • pfcSolid.GetSimpRep()
  • pfcSolid.SelectSimpRep()
  • pfcSolid.ActivateSimpRep()
  • pfcSolid.GetActiveSimpRep()
  • This section describes the utility methods that relate to simplified representations.
    The method pfcModelItemOwner.ListItems() can list all of the simplified representations in a Solid.
    The method pfcModelItemOwner.GetItemById() initializes a pfcSimpRep object. It takes an integer id.
    Note
    Web.Link supports simplified representation of Assemblies only, not Parts.
    The method pfcSolid.GetSimpRep() initializes a pfcSimpRep object. 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 pfcSolid.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 pfcXToolkitUserAbort
    The methods pfcSolid.GetActiveSimpRep() and pfcSolid.ActivateSimpRep() enable you to find and get the currently active simplified representation, respectively. Given an assembly object, pfcSolid.GetActiveSimpRep() returns the object to the currently active simplified representation. If the current representation is the master representation, the return is null.
    The method pfcSolid.ActivateSimpRep() activates the requested simplified representation.
    To set a simplified representation to be the currently displayed model, you must also call pfcModel.Display().