Simplified Representations
Creo Object TOOLKIT Java 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 Java, you can create and manipulate assembly simplified representations just as you can using Creo application interactively.
Note
Creo Object TOOLKIT Java supports simplified representation of assemblies only, not parts.
Simplified representations are identified by the pfcSimpRep.SimRep class. This class is a child of pfcModelItem.ModelItem, 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 pfcSimpRep.SimpRepInstructions which contains several data objects and fields, including:
•  String—The name of the simplified representation
•  pfcSimpRep.SimpRepAction—The rule that controls the default treatment of items in the simplified representation.
•  pfcSimpRep.SimpRepItem—An array of assembly components and the actions applied to them in the simplified representation.
A pfcSimpRep.SimpRepItem is identified by the assembly component path to that item. Each pfcSimpRep.SimpRepItem has it’s own pfcSimpRep.SimpRepAction assigned to it. pfcSimpRep.SimpRepAction is a visible data object that includes a field of type pfcSimpRep.SimpRepActionType. You can use the method pfcSimpRep.SimpRepAction.Action() to set the actions. To delete an existing item, you must set the action as NULL.
pfcSimpRep.SimpRepActionType 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:
You can retrieve a named simplified representation from a model using the method pfcSession.BaseSession.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 pfcSimpRep.pfcSimpRep.RetrieveExistingSimpRepInstructions_Create and specify its name as the second argument to this method. Creo application 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 pfcSession.BaseSession.RetrieveGeomSimpRep, pfcSession.BaseSession.RetrieveGraphicsSimpRep, and pfcSession.BaseSession.RetrieveSymbolicSimpRep respectively. Like pfcSession.BaseSession.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 wfcSession.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 wfcSession.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 pfcSimpRep.SimpRepInstructions object by calling the method pfcSimpRep.pfcSimpRep.CreateNewSimpRepInstructions_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 pfcSolid.Solid.CreateSimpRep. This method returns the pfcSimpRep.SimpRep object for the new representation.
The method pfcSolid.Solid.DeleteSimpRep deletes a simplified representation from its model owner. The method requires only the pfcSimpRep.SimpRep object as input.
Extracting Information About Simplified Representations
Methods Introduced:
Given the object to a simplified representation, pfcSimpRep.SimpRep.GetInstructions fills out the pfcSimpRep.SimpRepInstructions object.
The pfcSimpRep.SimpRepInstructions.GetDefaultAction, pfcSimpRep.CreateNewSimpRepInstructions.GetNewSimpName, and pfcSimpRep.SimpRepInstructions.GetIsTemporary methods return the associated values contained in the pfcSimpRep.SimpRepInstructionsobject.
The method pfcSimpRep.SimpRepInstructions.GetItems returns all the items that make up the simplified representation.
The method wfcCombState.WSimpRep.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 wfcCombState.WSimpRep.IsSimpRepInstructionDefault determines if the specified simplified representation is the default representation for the owner model.
Use the method wfcCombState.WSimpRep.SetSimpRepInstructionDefaultAction to set the default action for the simplified representation using the enumerated type SimpRepActionType.
Modifying Simplified Representations
Methods Introduced:
Using Creo Object TOOLKIT Java, 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 pfcSimpRep.SimpRepInstructions object.
To modify an existing simplified representation retrieve it and then get the pfcSimpRep.SimpRepInstructions object by calling pfcSimpRep.SimpRep.GetInstructions. If you created the representation programmatically within the same application, the pfcSimpRep.SimpRepInstructions object is already available. Once you have modified the data object, reassign it to the corresponding simplified representation by calling the method pfcSimpRep.SimpRep.SetInstructions.
The method wfcCombState.WSimpRep.GetSimprepdataTempvalue returns a boolean value that specifies if the simplified representation is a temporary one.
Use the method wfcCombState.WSimpRep.SetSimprepdataName to set the name of the simplified representation in the SimpRepInstructions 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 Java. 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 pfcSimpRep.SimpRepActionType to SIMPREP_EXCLUDE.
The method wfcCombState.WSimpRep.DeleteSimpRepInstructionItem deletes the specified item from SimpRepInstructions object.
How to Add Items
1. Get the pfcSimpRep.SimpRepInstructions 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 pfcSimpRep.SimpRepItem object for the item by calling the method pfcSimpRep.pfcSimpRep.SimpRepItem_Create.
4. Add the item to the pfcSimpRep.SimpRepItem sequence. Put the new pfcSimpRep.SimpRepInstructions using pfcSimpRep.SimpRepInstructions.SetItems.
5. Reassign the pfcSimpRep.SimpRepInstructions object to the corresponding pfcSimpRep.SimpRep object by calling pfcSimpRep.SimpRep.SetInstructions
How to Remove Items
Follow the procedure above, except remove the unwanted pfcSimpRep.SimpRepItem from the sequence.
Simplified Representation Utilities
Methods Introduced:
This section describes the utility methods that relate to simplified representations.
The method pfcModelItem.ModelItemOwner.ListItems can list all of the simplified representations in a Solid.
The method pfcModelItem.ModelItemOwner.GetItemById initializes a pfcSimpRep.SimpRep object. It takes an integer id.
Note
Creo Object TOOLKIT Java supports simplified representation of Assemblies only, not Parts.
The method pfcSolid.Solid.GetSimpRep initializes a pfcSimpRep.SimpRep 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.Solid.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.Solid.GetActiveSimpRep and pfcSolid.Solid.ActivateSimpRep enable you to find and get the currently active simplified representation, respectively. Given an assembly object, pfcSolid.Solid.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.Solid.ActivateSimpRep activates the requested simplified representation.
To set a simplified representation to be the currently displayed model, you must also call pfcModel.Model.Display.
The method wfcSolid.WSolid.ActivateAutomaticSimpRep activates a user-defined representation as automatic simplified representation.
The method wfcSolid.WSolid.ConvertAutomaticSimpRep converts a user-defined representation to automatic simplified representation while maintaining the excluded or substituted components in the representation.
Use the method wfcSolid.WSolid.RetrieveAutomaticSimpRep to retrieve a user-defined simplified representation as an 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 wfcAssembly.WAssembly.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 wfcAssembly.LightweightGraphicsSimprepLevel. The valid values for this enumerated class type are:
  LWG_SIMPREP_LEVEL_NEXT—Specifies the expansion of the 3D Thumbnail to the next level.
  LWG_SIMPREP_LEVEL_ALL-Specifies the expansion of the 3D Thumbnail to all levels.