Simplified Representations
Creo Object TOOLKIT C++ gives programmatic access to all the simplified representation functionality of Creo application. Create simplified representations either permanently or on the fly and save, retrieve, or modify them by adding or deleting items.
Overview
Using Creo Object TOOLKIT C++, you can create and manipulate assembly simplified representations just as you can using Creo application interactively.
Note
Creo Object TOOLKIT C++ 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 method 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
pfcSIMPREP_NONE
No action is specified.
pfcSIMPREP_REVERSE
Reverse the default rule for this component (for example, include it if the default rule is exclude).
pfcSIMPREP_INCLUDE
Include this component in the simplified representation.
pfcSIMPREP_EXCLUDE
Exclude this component from the simplified representation.
pfcSIMPREP_SUBSTITUTE
Substitute the component in the simplified representation.
pfcSIMPREP_GEOM
Use only the geometrical representation of the component.
pfcSIMPREP_GRAPHICS
Use only the graphics representation of the component.
pfcSIMPREP_SYMB
Use the symbolic representation of the component.
pfcSIMPREP_BOUNDBOX
Use the boundary box representation of the component.
pfcSIMPREP_DEFENV
Use the default envelope representation of the component.
pfcSIMPREP_LIGHT_GRAPH
Use the light weight graphics representation of the component.
pfcSIMPREP_AUTO
Use the automatic representation of the component.
Retrieving Simplified Representations
Methods Introduced:
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 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.
The method wfcWSession::RetrieveDefaultEnvelopeSimprep retrieves the simplified representation of the default envelope of an assembly in the session. This method is not supported for parts.
The method wfcWSession::LoadModelRepresentation retrieves the specified simplified representation of a model into memory.
Creating and Deleting Simplified Representations
Methods Introduced:
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 pfcSimpRepItems 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 Introduced:
Given the object to a simplified representation, pfcSimpRep::GetInstructions fills out the pfcSimpRepInstructions object.
The pfcSimpRepInstructions::GetDefaultAction, pfcCreateNewSimpRepInstructions::GetNewSimpName, and pfcSimpRepInstructions::GetIsTemporary methods return the associated values contained in the pfcSimpRepInstructions object.
The method pfcSimpRepInstructions::GetItems returns all the items that make up the simplified representation.
The method wfcWSimpRep::GetSimprepSubstitutionName() returns the name of the substituted representation at the given assembly path. This method returns the name even when the substituted representation is deleted from the model at the given path.
The method wfcWSimpRep::IsSimpRepInstructionDefault determines if the specified simplified representation is the default representation for the owner model.
Use the method wfcWSimpRep::SetSimpRepInstructionDefaultAction to set the default action for the simplified representation using the enumerated type pfcSimpRepActionType.
Modifying Simplified Representations
Methods Introduced:
Using Creo Object TOOLKIT C++, 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.
The method wfcWSimpRep::GetSimprepdataTempvalue returns a boolean value that specifies if the simplified representation is a temporary one.
Use the method wfcWSimpRep::SetSimprepdataName to set the name of the simplified representation in the pfcSimpRepInstructions object.
Adding Items to and Deleting Items from a Simplified Representation
Methods Introduced:
You can add and delete items from the list of components in a simplified representation using Creo Object TOOLKIT C++. 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.
The method wfcWSimpRep::DeleteSimpRepInstructionItem deletes the specified item from pfcSimpRepInstructions object.
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::SetItems.
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:
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::SimpRep object. It takes an integer id.
Note
Creo Object TOOLKIT C++ supports simplified representation of Assemblies only, not Parts.
The method pfcSolid::GetSimpRep initializes a pfcSimpRep object. The method takes the following arguments:
•  SimpRepname— 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 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 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.
The method wfcWSolid::ActivateAutomaticSimpRep activates a user-defined representation as automatic simplified representation.
The method wfcWSolid::ConvertAutomaticSimpRep converts a user-defined representation to automatic simplified representation while maintaining the excluded or substituted components in the representation.
Use the method wfcWSession::RetrieveAutomaticSimpRep to retrieve a user-defined simplified representation as automatic simplified representation. The input arguments follow:
•  AssemName—Name of the assembly to retrieve.
•  FileType—File type of the assembly to retrieve that is specified using by the enumerated data type wfcMdlfileType.
•  UDSrepName—Name of the user defined simplified representation to retrieve as automatic.
Expanding Light Weight Graphics Simplified Representations
Use the method wfcWAssembly::ExpandLightweightGraphicsSimprep to expand the light weight graphics representation to the specified level. The input arguments of this method are:
•  TreeItem—Specify the model feature whose light weight graphic representation is to be expanded.
•  LWGLevel—Specify the level up to which the expansion should take place using the enumerated type LightweightGraphicsSimprepLevel. The valid values for this enumerated type are:
  wfcLWG_SIMPREP_LEVEL_NEXT—Specifies the expansion of the 3D Thumbnail to the next level.
  wfcLWG_SIMPREP_LEVEL_ALL-Specifies the expansion of the 3D Thumbnail to all levels.