Adding a special tag handler - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

When using the SmartPlant Foundation SmartConverter, there are cases where the text that is hotspotted does not match the tag stored in the SmartPlant Foundation database. For example, suppose the drawing has a pipe run label of 10.00-PV-20L1009-DD200-000-A, but only the third part of the string, 20L1009, represents a tag stored in the SmartPlant Foundation database. You can configure the SmartConverter to call a method in a custom ActiveX .DLL that changes the text used to look up the tag when the user clicks the label in the drawing.

To create such a method, do the following:

  1. Use Visual Basic to create an ActiveX .DLL project.

  2. Give the project a name, such as SpecialTagHandler.

  3. Create a class and give it a name such as LineSpecial.

  4. Add a function called Special defined as follows:

    Public Function Special(ByVal RuleBase As String, _
                   ByVal Topic As String, _
                   ByVal Item As String, _
                   OutTopic As Variant, OutItem As Variant) As Boolean

    Arguments:

    ArgumentsTable

  5. Add code to the method to set OutItem to the tag you want SmartPlant Foundation to look up when the label is selected in the drawing.

  6. The OutTopic generally should just be set to the input variable Topic.

  7. Compile your .DLL.

  8. If your .DLL is not located on the SmartPlant Foundation server, copy it to the server and register it using the regsvr32 command.

  9. In the SPFHotspotter.ini file, look for the section named [Special] and add the ProgID of the class on a line by itself. The ProgID is the project name, followed by a period, then followed by the class name. For example, using the names mentioned above the ProgID would be SpecialTagHandler.LineSpecial.

    Example Special method:

    ' Method to change line labels to match SPF database
    ' Extracts 3rd substring from label using "-" as delimiter
    ' For example for the pipe run with the label:
    ' 10.00-PV-20L1009-DD200-000-A
    ' Suppose the corresponding tag in the SPF database is
    ' 20LI1009. This function would insure that when the pipe label
    ' is select, SPF will look up 20LI1009 instead of the full
    ' label
    Public Function Special(ByVal RuleBase As String, _
                        ByVal Topic As String, _
                        ByVal Item As String, _
                        OutTopic As Variant, OutItem As Variant) As Boolean
    '       RuleBase        - The rulebase being processed
    '       Topic           - The topic being processed
    '       Item            - The text to be hotspotted
    '       OutputTopic     - The new topic to use
    '       OuptutItem      - The new text to hotspot

    Dim aItem() As String

        Special = True
        OutTopic = Topic
        OutItem = Item
       
        'Is the item label candidate to be a line label?
        'If so extract "tag portion" only
        If InStr(Item, ".") > 0 Then
            'Extract 3 'rd substring from "-" delimiting
            aItem = Split(Item, "-")
            If UBound(aItem) >= 2 Then
                OutItem = aItem(2)
            End If
        End If
    End Function