Inventor General Discussion

Posts: 24
Registered: ‎10-19-2012
Message 1 of 1 (93 Views)

problem using AddCustomi​PartMember

93 Views, 0 Replies
10-19-2012 08:40 AM



I find that the method, AddCustomiPartMember , works fine if i pass the "Row" parameter as a number but i can't get it to work when i pass it as a string .  This is what the help file states:


Sub AddCustomiPartMember(FactoryFileName As String, Position As Matrix, FullFileName As String, ByRef Row As [optional] VARIANT, ByRef CustomInput As [optional] VARIANT, Result As [out, retval] ComponentOccurrence*)
Optional input Variant that specifies the row for the member within the factory. The row index is specified either by a Long (row index), a String (part identifier, i.e. ''[Height=1.000 in][Length=2.000 in][Radius=0.250 in]''), or an iPartTableRow object.


Here's the code that doesn't work :


Sub test3()
    Dim myAssembly As AssemblyDocument, my_part As ComponentOccurrence, my_pos As Matrix
    Dim ifactory_path As String, ipart_path As String, iselect As String
    Set myAssembly = ThisApplication.ActiveDocument
    Set my_pos = ThisApplication.TransientGeometry.CreateMatrix
    Dim custom_vars(1 To 2) As String
    iselect = "[my_var=18mm]"
    custom_vars(1) = "13mm"
    custom_vars(2) = "25mm"    
    ifactory_path = "D:\my_ifactory.ipt"
    ipart_path ="D:\selected_ipart.ipt"    
    Set my_part = myAssembly.ComponentDefinition.Occurrences.AddCustomiPartMember(ifactory_path, my_pos, ipart_path, iselect, custom_vars)
End Sub


but if i swap out iselect for a number such as "2" etc then it works fine !!


Can anyone help me out??

Many thanks in advance.


You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor