Set iPart table options with iLogic?

Set iPart table options with iLogic?

jake_egley
Advocate Advocate
149 Views
3 Replies
Message 1 of 4

Set iPart table options with iLogic?

jake_egley
Advocate
Advocate

I'd like to use iLogic to change the iPart options to index 3 digits and "Set to Member Part Number" since all my companies part numbers have three digits at the end. Is there a way to do this? Thanks

 

jake_egley_0-1746041182229.png

 

Jake Egley
Inventor 2022
0 Likes
Accepted solutions (2)
150 Views
3 Replies
Replies (3)
Message 2 of 4

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @jake_egley . You can change this using the FactoryOptions object. Example iLogic code:

Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, PartDocument)
If oPDoc Is Nothing Then Exit Sub
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
If Not oPDef.IsiPartFactory Then Exit Sub
With oPDef.iPartFactory.FactoryOptions
	.PartNumberIndexDigits = 3
	.MemberNameType = kPartNumberMemberNameType
	.ApplyToAllMembers()	
End With

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 3 of 4

jake_egley
Advocate
Advocate

Thanks @Andrii_Humeniuk . Follow up, how do I use this to show the table at the end of the rule? Also is there a way to add the description column to the table with iLogic? 

jake_egley_0-1746121614563.png

 

Jake Egley
Inventor 2022
0 Likes
Message 4 of 4

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Honestly I don't know what to do with this, but I think the following code does everything you need. Opening the table executes the last line of code.

AddReference "Microsoft.Office.Interop.Excel"
Imports Microsoft.Office.Interop.Excel
Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, PartDocument)
If oPDoc Is Nothing Then Exit Sub
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oiPart As iPartFactory
If oPDef.IsiPartFactory Then : oiPart = oPDef.iPartFactory
Else : oiPart = oPDef.CreateFactory
End If
With oiPart.ExcelWorkSheet
	.Cells(1, .UsedRange.Columns.Count + 1).Value = "Description [Project]"
	With .Parent  : .Save() : .Close(False) : End With
End With
With oiPart.FactoryOptions
	.PartNumberIndexDigits = 3
	.MemberNameType = kPartNumberMemberNameType
	.ApplyToAllMembers()	
End With
ThisApplication.CommandManager.ControlDefinitions("AppCreateiPartCmd").Execute()

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature