The following examples explain how to configure the SPCRetrieveMapping.xlsm workbook and how an example processor traverses the data for a Plant Design System (PDS®) weld.
Mapping a PDS weld for material, thickness, size
The following image is an excerpt from the delivered SPCRetrieveMappings.xlsm. The PDS_Dwg_Weld class definition maps to the SPCInterface definition via a custom property processor. The custom processor uses the data to calculate the property SPC_ComponentItem_Size.
The Material, Thickness, and Size on the EFInterface definition are not present in the view definition VD_SPC_Weld, as seen in the previous image. A custom processor must be defined for the EFInterface to map the values for Material, Thickness, Size, and Units. Because a custom processor is used, an EFProperty value does not need to be defined.
Example custom property processor for a PDS weld
A PDS weld does not get the Material Category published on the Weld object from PDS. A custom processor allows Smart Construction to traverse the item that the weld belongs to, such as a pipe, piping component, or instrument. From the object the weld belongs to, Smart Construction can get the desired property from that object.
The following sample shows a weld processor for PDS that retrieves the item the weld belongs to and returns the Material Category from that object.
<TargetType("PDS_Dwg_Weld", "P3DWeld", "CR3DWeld")> _
Public Class WeldPropertyProcessor
Inherits BaseRetrievePropertyProcessor
TargetType defines targeted tools with the property that the WeldPropertyProcessor processes.
Some tools publish multiple values for the same property. A custom property processor traverses the tool interface to expose a property and extract a value. For example, a tool like PDS exposes the property Thickness with multiple values for Pipe Spool, Welds, and Pipe Run. There can be only one thickness value for any component. PDS Weld does not expose the Material Category property (like Carbon Steel or Stainless Steel) directly on the published weld from the tools. With a custom property processor, Smart Construction can look for the tool interface that exposes such properties to extract the value, as seen in the following excerpt.
-
Include the SPC.Server.Common.dll as a reference assembly to your custom project.
-
Import the namespace SPC.Server.Common.Extensions in your project or VB file.
Public Overrides Sub OnProcessProperty(publishedObject As SPF.Server.Schema.Interface.Generated.IObject, spcComponentObject As SPF.Server.Schema.Interface.Generated.IObject, propertyMapping As RetrieveMapping)
Try
Select Case propertyMapping.SPCPropertyDefUID.ToUpper
Case PROPERTYDEF_COMPONENTITEM_COMPONENTMATERIAL.ToUpper
' Do custom processing for Material
Dim impliedItem As IObject = CustomProcessorHelpers.GetImpliedItem(publishedObject)
If impliedItem IsNot Nothing Then
' Determine type of object and then get Material accordingly
Dim value As String = String.Empty
value = CustomProcessorHelpers.GetPublishedPropertyValue(impliedItem, INTERFACEDEF_SPECIFIEDMATLITEM, PROPERTYDEF_MATERIALSCATEGORY)
' If value found set it on component
If Not String.IsNullOrEmpty(value) Then
spcComponentObject.SPC_SetPropertyValue(propertyMapping.SPCInterfaceDefUID, propertyMapping.SPCPropertyDefUID, value, Nothing)
End If
End If