Creating a Representation from a Local File
Using this request, you can create a representation from a local supported file that simulates the client-side viewable.
The request allows you to create a representation from a local file containing either 2D or 3D content for a Windchill representable, such as a part, document, dynamic document, EPM document, and so on.
You can create a representation and the associated thumbnail from a local file by specifying the representable OID in the request URI and the parameters File, RepresentationName, Description, OverWrite, and SetAsDefault, and GenerateThumbnail in the request body.
The attributes are described in the following table:
Attribute
Description
Representable ID
Required.
ID of the representable for which you want to create a representation from a local file.
File
Required.
File uploaded from your local machine. The supported file types for creating a representation are PVZ, ZIP, JAR, OL, PDF, DXF, and DWG.
RepresentationName
Required.
Name of the representation.
Description
Optional.
Description for the representation.
OverWrite
Optional.
You can specify the value as true or false. Default is false.
Specify the value as true to overwrite a representation.
* 
The request deletes the existing representation and creates a new one only if the specified representation name already exists and OverWrite is specified as true; otherwise it creates a new representation.
The request returns an error if the specified representation name already exists and OverWrite is specified as false.
GenerateThumbnail
Optional.
* 
If not specified, the default value is true.
Generates a thumbnail for the representation.
Specify the value as false if you do not want to generate a thumbnail for the representation being created.
* 
To generate a thumbnail, the thumbnail worker must be configured and running.
SetAsDefault
Optional.
You can specify the value as true or false. Default is false.
Specify the value as true to set the newly created representation as the default representation.
Example: Creating a Representation from a Local PVZ File for a Part
Consider an existing representation that is not the default and does not have an associated thumbnail.
This example shows how to create a representation from a local PVZ file for a part by specifying the part OID in the request URI and providing the local PVZ file from which you want to create the representation in the request body. In this example, the values for the OverWrite and SetAsDefault attributes are specified as true in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:158982')/PTC.ProdMgmt.CreateRepresentationFromLocalFile
Request Headers
CSRF_NONCE: <CSRF_NONCE_TOKEN>
Content-Length: <total_Body_Size>
Content-Type: multipart/form-data; boundary=----contentBoundary
Request Body
Content-Disposition: form-data; name="File"; filename="TableAnnotation.zip"
Content-Type: application/zip

(data)
Content-Disposition: form-data; name="RepresentationName"

DynDocRepresentation
Content-Disposition: form-data; name="Description"

New Representation
Content-Disposition: form-data; name="OverWrite"

true
Content-Disposition: form-data; name="SetAsDefault"

true
The request overwrites the existing representation with the newly created representation, sets it as the default representation, and generates a thumbnail for it.
The new representation and its thumbnail are displayed in the Representations/Annotations table in Windchill. The new representation is displayed as default in the table.
Was this helpful?