How to create libraries file .idcl to .ipt files by batch method?

How to create libraries file .idcl to .ipt files by batch method?

Anonymous
Not applicable
1,887 Views
6 Replies
Message 1 of 7

How to create libraries file .idcl to .ipt files by batch method?

Anonymous
Not applicable

How to create libraries file .idcl to .ipt files by batch  method?

Now our team want to make  libraries file .idcl to .ipt files , but the number is too big, about 10000 .ipt  files,so we want to make it by batch  method , could anybody help?   Thanks !

0 Likes
Accepted solutions (1)
1,888 Views
6 Replies
Replies (6)
Message 2 of 7

Xun.Zhang
Alumni
Alumni
Accepted solution

Hello, 

Yes, VBA for place component from Content center can do so. 

You have to create a new assembly, load the library, place from Content Center one by one and the file will be saved in the folder automatically without saving the top assembly.

Generally speaking, you have to create VBA to create a new assembly and run below case, note, please only check the idcl library only in project setting.

Sample VBA for your reference -

Public Sub GetFromContentCenter()
   
    Dim headHeadNode As ContentTreeViewNode
    Set headHeadNode = ThisApplication.ContentCenter.TreeViewTopNode
    
    Call FoundAllNodes(headHeadNode)
    
End Sub

Function FoundAllNodes(hexHeadNode As ContentTreeViewNode)
        Dim oNode As ContentTreeViewNode
        If hexHeadNode.Families.Count > 0 Then
                    Dim i As LongLong
                    i = 1
                    
                    Dim family As ContentFamily
                    Dim checkFamily As ContentFamily
                    For Each checkFamily In hexHeadNode.Families
'
'                            If checkFamily.LibraryName = "AI2019_Inventor Routed Systems" Then
'                                Set family = checkFamily
'                            End If
                        
                        If Not family Is Nothing Then
                                ' Create the member (part file) from the table.
                                Dim failureReason As MemberManagerErrorsEnum
                                Dim failureMessage As String
                                Dim memberFilename As String
                                
                                Dim kRow As LongLong
                                For kRow = 1 To family.TableRows.Count
                                    memberFilename = family.CreateMember(family.TableRows.Item(kRow), failureReason, failureMessage, kRefreshOutOfDateParts)
                                Next
                    End If
                    Next
        End If
        If hexHeadNode.ChildNodes.Count > 0 Then
            For Each oNode In hexHeadNode.ChildNodes
                FoundAllNodes oNode
            Next
        End If
End Function

 


Xun
Message 3 of 7

Anonymous
Not applicable
     再请教下,请问这行代码里面,我要如何修改,才能够将保存的ipt文件的文件名给我我需要的iproperties属性?例如文件名自动保存为:库存编码stock number+零件代号part number+修订号vesion,谢谢!
memberFilename = family.CreateMember(family.TableRows.Item(kRow), failureReason, failureMessage, kRefreshOutOfDateParts) 
0 Likes
Message 4 of 7

Xun.Zhang
Alumni
Alumni

Try to add your definition and check the row of stock number, version, etc.

Family.Tablerows.Item(kRow,xRow,...)

family.CreateMember(family.TableRows.Item(kRow),...

Xun
Message 5 of 7

Anonymous
Not applicable

it can't work use your methd in my VBA, the for loop is about the row, but did't see the column, it is Row or Column?

0 Likes
Message 6 of 7

Anonymous
Not applicable
it can't work use your methd in my VBA,
i don't know where is the problem,
i want to know :the for loop is about the row, but did't see the column, it is Row or Column?
Thanks!!
0 Likes
Message 7 of 7

Xun.Zhang
Alumni
Alumni

Hello,

Try below code and modify it on demand.

ContentFamily.CreateMember( Row As Variant, FailureReason As MemberManagerErrorsEnum, FailureMessage As String, [Refresh] As ContentMemberRefreshEnum, [Custom] As Boolean, [FileName] As String, [CustomInput] As Variant, [Options] As Variant ) As String 

You can refer to the API help from below -

FileName

String

Optional Input String that defines the filename of the resulting member. This argument is only used in the case of a custom family (ContentFamily.IsCustom is true) and is ignored for a standard family. In the case of a custom factory the filename must be specified and is not optional.

This is an optional argument whose default value is """".

 Hope it helps!


Xun