powered by CADENAS

Manual

Manual

1.2.2.7.2.1. Example 1: Set import path via “pdmProxyPdmDocumentI“

A small example for setting the import path of an item (using pdmProxyPdmDocumentI).

  1. Create a VBS filter node directly after the Conversion service (meaning before the converter has been processed). Set VBS file (plugin_template.vbs) and VB Class (_AfterConversion).

    VBS filter node

    VBS filter node

    Node Editor

    Node Editor

  2. Open the VBS script

    Go to the function „AfterConversion“

    Add the following lines of code:

    dim docProp = item.GetPropertiesObject()
    dim pathProp = Application.GetObject("pdmProxies.ObjectFactory").createPdmProxiesObject
     ("pdmProxyPropertyObjectC", "Testpath/test")
    pathProp.setType("STRING")
    docProp.setProperty("path",pathProp)
    

    Explanations:

    • Get the root properties object (Return value pdmProxyAttributeContainerC)

      dim docProp = item.GetPropertiesObject()

    • Create new pdmProxyPropertyObjectC & setValue and Type

      dim pathProp = Application.GetObject("pdmProxies.ObjectFactory").
       createPdmProxiesObject("pdmProxyPropertyObjectC", "Testpath/test")

      pathProp.setType("STRING")

    • Add pdmProxyPropertyObjectC to pdmProxyAttributeContainerC

      docProp.setProperty("path",pathProp)
      

    The converter.vbs (processed during AttributeMapper) converts this attribute „path“ to a classification of the product.

    In classification:
       "Name": "path",
       "Group": "document",
       "Value": {
                      "Text": "Testpath/test"
       },
                      "Id": "path"
       },

  3. Edit Structure Node in PARTdataCenter

    Document Path: $document::path.

    (Group: document; Name: path --> see Classification PARTdataCenter)

Additional information

Depending on which function is used in the code, the proper group has to be chosen in the Structure Node:

Example from Script:

dim docProp = item.GetPropertiesObject() -->

Mapping of functions to groups:

GetPropertiesObject() --> document
GetFileProperties() --> file
GetCadAttributes() --> cad
GetCadDimensions() --> dimension
GetPdmAttributes() --> pdm
GetCustomAttributes() --> custom