Bolt Size with iLogic

Bolt Size with iLogic

Anonymous
Not applicable
2,505 Views
10 Replies
Message 1 of 11

Bolt Size with iLogic

Anonymous
Not applicable

Hi, 

All of the sudden I am having lots of issues with inventor :). I have reported a very similar issue before which has been confirmed as a defect here.

 

http://knowledge.autodesk.com/article/Bolted-Connection-Automatic-Solve-Does-not-update-the-bolt-len...

 

and I have also looked at the code to potentially solve my issue here..

 

http://forums.autodesk.com/t5/inventor-customization/ilogic-to-change-size-on-content-center-compone...

 

My issue is that a simply want my bolt length to change!! The bolted connection with the Design Accelerator is glitchy as ever and I really hope that using the ridiculously long code on the last link is not the solution.

 

In my assembly I simply want my bolt to lengthen or shorten depending on the thickness of the material it is passing through. This is accomplished VERY easily by manually clicking on the bolt, select replace part, and selecting the new size. SIMPLE! If this really requires a rule then so be it but I just cant wrap my head around needing that giant code to be placed under every single option of thickness I have.

 

If Thickness = .5 Then

"Giant code" use line 4

Else If Thickess = .75 Then

"Giant Code" use line 5

etc... for every thickess

 

End If

 

I would really apprecaite the help!!

Thanks

Sandro

0 Likes
2,506 Views
10 Replies
Replies (10)
Message 2 of 11

Owner2229
Advisor
Advisor

Hi, that's why there is the row specifed at the start of the code. You can use it for preselection and then run the code:

And believe me, this code is quite short. "Giant code" would be 10000+ lines.

 

 

' Row number of the new family member
Dim NewRow As Integer

' Pick the new family member by tickness
Select Case Thickness
Case .5: NewRow = 4 Case .75: NewRow = 5
'... And so on
End Select

' Active assembly Dim oMainAsm As AssemblyDocument = ThisDoc.Document Dim oAsmDef As AssemblyComponentDefinition = oMainAsm.ComponentDefinition ' Get the occurrence by its position in the occurrences collection Dim oOcc As ComponentOccurrence = oAsmDef.Occurrences.Item(1) Dim oDef As PartComponentDefinition = oOcc.Definition Dim oDoc As PartDocument = oDef.Document ' Reference to the CC properties - oProps Dim oPropSets As PropertySets = oDoc.PropertySets Dim oProps As PropertySet = oPropSets.Item("Content Library Component Properties")
' Family id Dim oProp As Inventor.Property = oProps.Item("FamilyId") Dim FamilyId As String = oProp.Value
' Reference to the ContentFamily Dim oContentCenter As ContentCenter = ThisApplication.ContentCenter Dim oFamily As ContentFamily = oContentCenter.GetContentObject("v3#" + FamilyId + "#")
' Create new member file Dim ErrorType As MemberManagerErrorsEnum Dim strContentPartFileName As String Dim strErrorMessage As String strContentPartFileName = oFamily.CreateMember(NewRow, ErrorType, strErrorMessage)
' Replace the existing component with the new one oOcc.Replace(strContentPartFileName, False)

 

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 3 of 11

rossano_praderi
Collaborator
Collaborator

Hi Sandro,

the follow Ilogic rule is an alternative solution to solve this issue.

 

On Error Resume Next
Dim oAss As AssemblyDocument = ThisApplication.ActiveEditDocument
Dim bp As BrowserPane = ThisApplication.ActiveDocument.BrowserPanes.ActivePane
Dim node As BrowserNode

For Each node In bp.TopNode.BrowserNodes
    If InStr(1, UCase(node.BrowserNodeDefinition.Label), "BOLTED") > 0 Then ' part of code to adapt
        oAss.SelectSet.Select(node.NativeObject)
        Call ThisApplication.CommandManager.ControlDefinitions.Item("FDSolveAuto").Execute
'   	Call ThisApplication.CommandManager.ControlDefinitions.Item("FDSolveManual").Execute ' alternative command
    End If
Next

 

To work correctly, is supposed that you have all the "Bolted connections" with the word "BOLTED" as part of the name.

 

Which should be changed on the basis of your requirements.

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 4 of 11

Anonymous
Not applicable

Hi Mike, 

 

Ive been trying to figure out how to respond to this..

 

Only because of my lack of experience, which is zero, I have tried very hard to stay completely away from API Code and stick to nice simple iLogic Snippets. They have gotten me pretty far in my models but obviously there are not enough snippets to cover everything I want to do. Until right now I didn't even want to try that code. 

Instead of this code I simply made a messagebox pop up whenever I change a parameter that would require a content center update, but the more I think about it and how often this box will pop up and how many bolts I would then have to go manually change, It just seems horrible.

 

Anway, What im really getting to is that I am upset with Autodesk for this AND that I dont know how to use this code..The part where I have to reference the bolt library is whats got me stuck right now..it shows "v3" and "#". I have no idea what this means or what to change it to. I would appreciate your help!

 

Thanks

Sandro

0 Likes
Message 5 of 11

Anonymous
Not applicable
as for Rossano, Thank you very much for showing me this code. I havent tried it but based on what you say that the name has to read BOLTED, this will not work for me I dont think. I am using custom fasteners with very custom names so I am assuming this will not work correctly. Thanks anyways!
0 Likes
Message 6 of 11

Anonymous
Not applicable
ok quick upate...

I've tried the code and it works! I am still VERY afraid to use it though because I have no idea how it works. I have some issues with this though. My fasteners are custom named because I wanted them set up a certain way for my BOM. This code basically removed the custom bolt and replaced it with the standard bolt from the content center. Is there no code that can simply change the length of a bolt ?
My other issue is that if use a row to change the diameter of the bolt, all of my flat washers, nuts, etc, do not also change. Please help!

Thanks
Sandro
0 Likes
Message 7 of 11

rossano_praderi
Collaborator
Collaborator

Hi Sandro,

Can you post some sample files?

 

If you will, we will try to find a possible solution.

 

 

Bregs
Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
0 Likes
Message 8 of 11

Jef_E
Collaborator
Collaborator

In this topic, there is a file attached that contains code to do this operation.

 

https://forums.autodesk.com/t5/inventor-customization/ilogic-to-change-size-on-content-center-compon...

 

It allows you to change the size of an content center component without having to replace it. So a custom part stays a custom part.

Only thing is.. It's alot longer than the other code, and more complex. You will also need to add a search for the table row for the bolt size you want.

 

I Could help you with that if you are interested.



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 9 of 11

Anonymous
Not applicable
Hey Jeff,

Thank you for your response, I checked out that link and found the file but i could not open it for some reason. I am willing to at least give it a try because nothing else seems to be working. I am definitely interested in your help!
0 Likes
Message 10 of 11

Anonymous
Not applicable
Jeff,

I read that whole thread from that link and it seems like I am trying to do EXACTLY what you were trying to do almost a year ago...
Looking at those dates crushed my hopes that Autodesk would include a snippet for this anytime soon.
After seeing your last comment that whatever code he attached actually worked for you I cant wait to try it. Unfortunately like I said in my last comment, the .zip file will not open for me for some reason. Could you perhaps send me the code another way? I look forward to hearing back from you!

Thanks
Sandro
0 Likes
Message 11 of 11

Jef_E
Collaborator
Collaborator

Some adjustment may be required for your needs.

 

Some comments are done by me in dutch, where you find dutch comments I edited some things to the original code. Here you should also make edits I guess.

 

 Private Sub WN_RF(ByVal oAsmDoc As AssemblyDocument,
                      ByVal oAsmDef As AssemblyComponentDefinition,
                      ByRef oPipeDiameter As String,
                      ByRef oFlangeHeight As String,
                      ByRef oFlangeChange As Boolean)

        Dim i As Integer
        ' get the some occurrence - should be a custom CC member
        Dim oOcc As ComponentOccurrence
        oOcc = oAsmDef.Occurrences.ItemByName("Noz_Flange")

        Dim oDef As PartComponentDefinition
        oDef = oOcc.Definition

        'check: if this component is custom or standard?
        If oDef.IsContentMember Then
            MsgBox("this sample works with the custom CC member only")
            Exit Sub
        Else
            Debug.Print("It's a Custom CC member")
        End If

        Dim oDoc As PartDocument
        oDoc = oDef.Document

        'reference to the CC properties - oProps
        Dim oProps As PropertySet
        oProps = oDoc.PropertySets.Item("Content Library Component Properties")

        'get the family id
        Dim oProp As Inventor.Property
        oProp = oProps.Item("FamilyId")
        Dim FamilyId As String
        FamilyId = oProp.Value

        Debug.Print("--------------------------------------------")
        Debug.Print("*** Content Family Info from iProperties ***")
        Debug.Print("--------------------------------------------")
        For i = 1 To oProps.Count
            oProp = oProps.Item(i)
            Debug.Print(oProp.Name & " =   " & oProp.Value)
        Next i

        'reference to the CC family
        Dim oContentCenter As ContentCenter
        oContentCenter = oInvApp.ContentCenter
        Dim oFamily As ContentFamily
        oFamily = oContentCenter.GetContentObject("v3#" + FamilyId + "#")

        'information on the family from the ContentFamily object
        Debug.Print("-----------------------------------------------------")
        Debug.Print("*** Content Family Info from ContentFamily object ***")
        Debug.Print("-----------------------------------------------------")
        Call PrintFamilyInfo(oFamily)

        '----------------------------------------


        ' get the current MemberId
        oProp = oProps.Item("MemberId")
        Dim MemberId As String
        MemberId = oProp.Value
        Debug.Print("Current MemberId (row): " & MemberId)

        ' search for the new row ID
        Dim newRow As Integer
        newRow = -1

        Dim oSizeColumnIndex As Integer
        oSizeColumnIndex = -1

        Dim oRatingColumnIndex As Integer
        oRatingColumnIndex = -1

        ' Zoeken naar de sturende kolommen
        For i = 1 To oFamily.TableColumns.Count

            If oFamily.TableColumns.Item(i).InternalName = "ND" Then
                oSizeColumnIndex = i
            ElseIf oFamily.TableColumns.Item(i).InternalName = "Rating" Then
                oRatingColumnIndex = i
            End If

            ' Controleren als de sturende kolommen gevonden zijn
            If oSizeColumnIndex > 0 And oRatingColumnIndex > 0 Then
                Exit For
            End If
        Next

        ' Stoppen als de juiste kolommen niet gevonden zijn
        If oSizeColumnIndex = -1 Or oRatingColumnIndex = -1 Then
            MsgBox("Something has gone wrong. Search column(s) not found.",
                   MsgBoxStyle.Critical, "Error: Change flange size")
            Exit Sub
        End If

        ' Zoeken naar de rij met de juiste afmetingen van flens
        For i = 1 To oFamily.TableRows.Count

            If oFamily.TableRows.Item(i).Item(oSizeColumnIndex).Value = WN_ND.Text And
                oFamily.TableRows.Item(i).Item(oRatingColumnIndex).Value = WN_RATING.Text Then

                newRow = i
                Debug.Print("The row searched for = " & newRow)
                Exit For

            End If

        Next

        ' Controleren als de rij gevonden is
        If newRow = -1 Then
            MsgBox("The dimensions are not found in the librairy." & vbLf &
                   "Please change size or add the dimensions in the Content center.",
                   MsgBoxStyle.Information, "Info: Flange not found")
            Exit Sub

        ElseIf MemberId = newRow Then

            oFlangeChange = False
            Debug.Print("Same component size. No change needed")
            Exit Sub

        End If

        'ask user for the new row number:
        'Dim newRow As Integer
        'newRow = InputBox("Current Family row is " & MemberId _
        '        & vbNewLine & vbNewLine & "New Family row:", _
        '        "New Family Row:", MemberId)
        'Debug.Print("newRow: " & newRow)

        '----------------------------------------

        Dim oRow As ContentTableRow
        oRow = oFamily.TableRows.Item(newRow)

        Dim nCol As Integer 'table column for this oPar
        Dim oColumn As ContentTableColumn


        'read CC table row data and update user parameters
        '"""""""""""""""""""""""""""""""""""""""""""""""""
        Dim oPar As UserParameter
        Dim x As Double = 0 ' flens hoogte optellen
        Dim y As String = "" ' flens hoogte eenheid

        For Each oPar In oDef.Parameters.UserParameters

            'ignore parameters that depends on the other parameters
            If oPar.DrivenBy.Count = 0 Then

                Debug.Print("Par name: " & oPar.Name)
                Debug.Print("Current value: " & oPar.Value)

                'find nCol - table column for oPar.Name
                nCol = -1
                For i = 1 To oFamily.TableColumns.Count
                    If oFamily.TableColumns.Item(i).InternalName = oPar.Name Then
                        nCol = i
                        Exit For
                    End If
                Next
                If nCol = -1 Then
                    Debug.Print("Column not found, so parameter was not changed")
                Else

                    oColumn = oFamily.TableColumns.Item(nCol)

                    If oColumn.KeyColumnOrder > 0 Then
                        'leave this value untouched
                        'e.g.,  "B_L" (Bar Length)
                        Debug.Print("Key value (not changed): " & oPar.Expression)
                    Else
                        Dim units As String
                        units = oColumn.Units

                        Dim oCell As ContentTableCell
                        oCell = oRow.Item(nCol)

                        Dim value As String
                        value = oCell.Value & " " & units

                        oPar.Expression = value
                        Debug.Print("New value: " & value)

                        If oPar.Name = "A" Then
                            oPipeDiameter = value
                            Debug.Print("Diameter pipe = " & value)
                        End If

                        If oPar.Name = "Y" Or oPar.Name = "RF_t" Then
                            x = x + oCell.Value
                            y = units
                        End If

                    End If
                End If

            End If 'oPar is not driven by other parameters

        Next

        oFlangeHeight = x & " " & y
        Debug.Print("Flens hoogte = " & oFlangeHeight)
        '----------------------------------------
        '--------------------------
        '    Update iProperties
        '--------------------------

        Debug.Print(vbNewLine & "*** Update iProperties ***" & vbNewLine)

        '1) "Content Library Component Properties"

        'update iProperty "MemberId"
        oProp = oProps.Item("MemberId")
        oProp.Value = newRow
        Debug.Print("MemberId =  " & newRow)

        ' update iProperty "Member Revision" with new GUID
        oProp = oProps.Item("Member Revision")
        oProp.Value = CreateGuid()
        Debug.Print("Member Revision =  " & oProp.Value)


        '2) "Design Tracking Properties"
        Dim oDesignProps As PropertySet
        oDesignProps = oDoc.PropertySets.Item("Design Tracking Properties")

        ' update iProperty "Part Number"
        Dim partNumber As String
        partNumber = NewPropertyValue(oDef, oFamily, newRow, "PARTNUMBER")
        oProp = oDesignProps.Item("Part Number")
        oProp.Value = partNumber
        Debug.Print("Part Number  =  " & partNumber)

        ' update iProperty "Description"
        Dim Description As String
        Description = NewPropertyValue(oDef, oFamily, newRow, "Description")
        oProp = oDesignProps.Item("Description")
        oProp.Value = partNumber
        Debug.Print("Description  =  " & Description)

        ' update iProperty "Stock Number"
        Dim stockNumber As String
        stockNumber = NewPropertyValue(oDef, oFamily, newRow, "STOCKNUMBER")
        oProp = oDesignProps.Item("Stock Number")
        oProp.Value = stockNumber
        Debug.Print("Stock Number =  " & stockNumber)

        '----------------------------------------

        oDoc.Update()
        oDoc.Save()
        Debug.Print(vbNewLine & "member document updated and saved")

        'update component name in the browser
        On Error Resume Next
        oOcc.Name = "Noz_Flange"
        'If Err() Then
        'name is already used
        'oOcc.Name = partNumber & ":1"
        'End If
        On Error GoTo 0

        oAsmDoc.Update()


    End Sub  'CustomMember_ChangeRow



    '********************************************

    Private Sub PrintFamilyInfo(ByRef oFamily As ContentFamily)
        ' Print Content Family Info

        Dim st As String
        Debug.Print("Family DisplayName:  " + oFamily.DisplayName)
        Debug.Print("Description       :  " & oFamily.Description)

        'what type of family this family is: part or feature?
        Select Case oFamily.FamilyType
            Case ContentFamilyTypeEnum.kContentFeatureFamily
                Debug.Print("Family Type:  " & "Content Feature Family")
            Case ContentFamilyTypeEnum.kContentPartFamily
                Debug.Print("Family Type:  " & "Content Part Family")
        End Select

        Debug.Print("Internal name              :  " + oFamily.InternalName)
        Debug.Print("Is Custom                  :  " & oFamily.IsCustom)
        Debug.Print("Is Modifiable              :  " & oFamily.IsModifiable)

        Debug.Print("Family Library Name        : " & oFamily.LibraryName)
        Debug.Print("Family Library InternalName: " & oFamily.LibraryInternalName)
        Debug.Print("Library Manufacturer       : " & oFamily.Manufacturer)

        Debug.Print("Family MemberDirectory     : " & oFamily.MemberDirectory)
        Debug.Print("Family RevisionId          : " & oFamily.RevisionId)
        Debug.Print("Family Standard            : " & oFamily.Standard)
        Debug.Print("Family StandardOrganization: " & oFamily.StandardOrganization)
        Debug.Print("Family StandardRevision    : " & oFamily.StandardRevision)

        Debug.Print("Family Columns : " & oFamily.TableColumns.Count)
        Debug.Print("Family Rows    : " & oFamily.TableRows.Count)
        Debug.Print("")

        Debug.Print("-------------------------------")
        Debug.Print("***** Family Columns Info *****")
        Debug.Print("-------------------------------")

        Dim i As Integer
        Dim oCol As ContentTableColumn
        For i = 1 To oFamily.TableColumns.Count
            oCol = oFamily.TableColumns.Item(i)

            ' the name of this column.
            Debug.Print(i & "" & oCol.InternalName)

            ' the type of value defined for this column.
            Select Case oCol.DataType
                Case ValueTypeEnum.kIntegerType
                    st = "Integer"
                Case ValueTypeEnum.kDoubleType
                    st = "Double"
                Case ValueTypeEnum.kStringType
                    st = "String"
                Case ValueTypeEnum.kBooleanType
                    st = "Boolean"
            End Select
            Debug.Print(st)

            'display name of this column.
            Debug.Print("DisplayHeading: " & oCol.DisplayHeading)

            'units of the column.
            If oCol.Units <> "" Then _
                Debug.Print("    Units: " & oCol.Units)

            'indicates if this column is mapped to an iProperty
            If oCol.HasPropertyMap Then _
                Debug.Print("    HasPropertyMap: " & oCol.HasPropertyMap)

            'KeyColumnOrder: specifies if this column is a key column
            'and what order this column should be in the key column list.
            'The key columns are displayed on the Select tab when placing a content part.
            If oCol.KeyColumnOrder > 0 Then
                Debug.Print("KeyColumnOrder: " & oCol.KeyColumnOrder)
            Else
                Debug.Print(" ")
            End If

            'Expression: is used to automatically populate the rows of this column.
            If TypeOf oCol.Expression Is ExpressionLimits Then
                Dim limits As ExpressionLimits
                limits = oCol.Expression
                Debug.Print("     Expression limits.DefaultValue = " & limits.DefaultValue)
                Debug.Print("     Expression limits.MaximumValue = " & limits.MaximumValue)
                Debug.Print("     Expression limits.MinimumValue = " & limits.MinimumValue)
            ElseIf oCol.Expression = Nothing Then
                'Debug.Print "    Expression: empty"
            Else
                Dim expr As Object
                expr = oCol.Expression
                Debug.Print("     Expression: " & expr)
            End If
        Next
        Debug.Print("--------------------------------")

    End Sub  'PrintFamilyInfo


    '********************************************


    Private Function NewPropertyValue( _
                ByRef oDef As PartComponentDefinition, _
                ByRef family As ContentFamily, _
                ByRef newRow As Integer, _
                ByVal ColumnName As String) As String
        'fills the template expressions in PARTNUMBER
        'and STOCKNUMBER columns with actual data.
        'to update the corresponding member's iProperties
        '(Part Number and Stock Number)
        Debug.Print("")
        Debug.Print("enter f-n NewPropertyValue")
        Debug.Print("ColumnName =  " & ColumnName)

        Dim nCol As Integer
        nCol = GetColumnByName(family, ColumnName)
        If nCol = -1 Then
            'error - column not found  :-(
            NewPropertyValue = ""
            Exit Function
        End If

        Dim oColumn As ContentTableColumn
        oColumn = family.TableColumns.Item(nCol)

        Dim expr As String
        expr = oColumn.Expression
        Debug.Print("Column.Expression (template) =  " & expr)

        'CC table row for this member
        Dim oRow As ContentTableRow
        oRow = family.TableRows.Item(newRow)

        'fill template string with values from oRow
        expr = FillPropWithValues(oDef, family, oRow, expr)

        Debug.Print("Template filled with data =  " & expr)

        NewPropertyValue = expr
    End Function

    '********************************************


    Private Function FillPropWithValues( _
                    ByRef oDef As PartComponentDefinition, _
                    ByRef oFamily As ContentFamily, _
                    ByRef oRow As ContentTableRow, _
                    ByVal template As String) As String
        ' Replaces placeholders in the column 'template' expression
        ' with the actual data from the given family row.
        ' Example:
        ' template:  "Angle {Size Designation}-{B_L} GOST 13617-97"
        ' result  :  "Angle 511349-23 GOST 13618-97"

        ' Important note: this code doesn't analyse nested curly braces

        Debug.Print("*** FillPropWithValues ***")
        Debug.Print("template =  " & template)

        Dim s As String
        Dim oColl As New Collection

        'concatenation
        'from:  "AISC" & " - " & {G_D} & " - " & {B_L}
        'to:     AISC - {G_D} - {B_L}
        template = Replace(Replace(template, " & ", ""), Chr(34), "")

        Call GetNames(template, oColl)

        'replace parameters' names with values
        Dim ss As Object
        For Each ss In oColl
            s = GetValueByColumnName(oDef, oFamily, oRow, ss)
            template = Replace$(template, "{" & ss & "}", s)
        Next
        Debug.Print("Final property value:  " & template)

        FillPropWithValues = template
        oColl = Nothing

    End Function  'FillPropWithValues

    '********************************************


    Private Sub GetNames(ByVal inS As String, ByRef oColl As Collection)
        ' Finds all the column names in curly braces that exist in the string inS,
        ' and adds them to the collection oColl.
        ' Example:  for the template
        '     inS = "Angle {Size Designation}-{B_L} GOST 13617-97"
        ' it will add two column names to oColl:
        '     Size Designation
        '     B_L
        '
        ' Will give an error if inS contains nested curly braces.

        Dim s As String
        Dim i As Integer, j As Integer
        Do
            ' next pair of {..}
            i = InStr(1, inS, "{")
            j = InStr(1, inS, "}")
            If (i = 0) Or (j = 0) Then Exit Do
            'what is inside curly braces?
            s = Mid$(inS, i + 1, j - i - 1)
            If s <> "" Then
                'add name s to the collection
                Call oColl.Add(s)
                inS = Mid$(inS, j + 1, Len(inS))
            End If
        Loop Until s = ""

    End Sub  'GetNames

    '********************************************

    Private Function GetValueByColumnName( _
                    ByRef oDef As PartComponentDefinition, _
                    ByRef family As ContentFamily, _
                    ByRef row As ContentTableRow, _
                    ByVal ColumnName As String) As String

        'returns the value that is stored in the CC family table
        'in the row in the column with the given ColumnName

        Dim nCol As Integer
        nCol = GetColumnByName(family, ColumnName)
        If nCol = -1 Then
            GetValueByColumnName = ""
            Exit Function
        End If

        Dim oColumn As ContentTableColumn
        oColumn = family.TableColumns.Item(nCol)

        If (oColumn.KeyColumnOrder > 0) Then
            'value should be taken from user parameters as it could be overridden
            On Error Resume Next
            Dim oPar As UserParameter
            oPar = oDef.Parameters.UserParameters.Item(ColumnName)
            'If Err Then
            'GetValueByColumnName = row.Item(nCol).Value
            'Err.Clear()
            'Else
            Dim s As String
            s = oPar.Expression
            'remove units of measure
            'GetValueByColumnName = Left(s, InStr(s, " ") - 1)
            'End If
            On Error GoTo 0
        Else
            GetValueByColumnName = row.Item(nCol).Value
        End If

    End Function  'GetValueByColumnName



    '********************************************

    Private Function GetColumnByName( _
                ByRef family As ContentFamily, _
                ByVal ColumnName As String) As Integer
        'find CC family table column by its name ColumnName
        Dim i As Integer
        For i = 1 To family.TableColumns.Count
            If family.TableColumns.Item(i).InternalName = ColumnName Then
                Debug.Print("f-n GetColumnByName: " & i & "  " & family.TableColumns.Item(i).InternalName)
                GetColumnByName = i
                Exit Function
            End If
        Next
        GetColumnByName = -1
    End Function


    Private Function CreateGuid()
        ' Returns a unique Guid on every call. Removes any cruft.
        ' https://msdn.microsoft.com/en-us/subscriptions/sh9ete15(v=vs.84).aspx
        ' http://stackoverflow.com/questions/968756/how-to-generate-a-guid-in-vbscript
        CreateGuid = Mid$(CreateObject("Scriptlet.TypeLib").GUID, 2, 36)
    End Function


Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes