Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get/SetPartNumberMergeSettings

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Lesoux
2016 Views, 7 Replies

Get/SetPartNumberMergeSettings

Hi everyone,

 

I would like pay your attention to methods of BOM object. It has two methods: GetPartNumberMergeSettings and SetPartNumberMergeSettings.

With setter everything is clear, however, not with getter. If you take a look on this method you will see that it has two arguments MergeEnabled and MergeExcludeList(). This is actually unclear. Why does getter have these arguments???

 

Thanks.

 

 

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
7 REPLIES 7
Message 2 of 8
YuhanZhang
in reply to: Lesoux

The two arguments in the SetPartNumberMergeSettings are output arguments for you to get the value of the MergeEnabled and MergeExcludeList, so you need to declare two variables to receive them, below VBA code demonstrate how to use them:

 

Sub Test()    
Dim oDoc As AssemblyDocument Set oDoc = ThisApplication.ActiveDocument Dim oBOM As BOM Set oBOM = oDoc.ComponentDefinition.BOM Dim sKeys(1) As String sKeys(0) = "Part1" sKeys(1) = "Part2" Call oBOM.SetPartNumberMergeSettings(True, sKeys) Dim sList() As String Dim bMerge As Boolean Call oBOM.GetPartNumberMergeSettings(bMerge, sList) Debug.Print "The BOM rom merge is enabled: " & bMerge Dim i As Long For i = LBound(sList) To UBound(sList) Debug.Print "The merge exclude list item " & i&; ": " & sList(i) Next
End Sub

 

Hope this explains.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Tags (1)
Message 3 of 8
Lesoux
in reply to: YuhanZhang

Hi yuhanzhang,

 

Thank you for responce. It's clear for VBA. What about Intent?

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Message 4 of 8
AlexKorzun
in reply to: Lesoux

Hi Lesoux,

 

Intent can not call .Net members with ByRef or Out parameters in their signature. The only workaround is to call such methods from managed code.

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 5 of 8
Lesoux
in reply to: AlexKorzun

It just means that I can't use some API methods in Intent.

 

Clear.

 

Thank you everyone.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Message 6 of 8
JBerns
in reply to: YuhanZhang

@YuhanZhang (Rocky),

 

I know this is an old post, but I thought it relevant rather than starting a new post.

 

So do you have to know the names of parts in the active assembly in order to populate the string array (sList)?

 

Could you just use "<BLANK>"?

 

I look forward to your reply.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 7 of 8
YuhanZhang
in reply to: JBerns

Hi Jerry,

 

It is up to what you want to exclude.  The string array can be any part number strings, they need not to be in the assembly currently(they may be placed in the future). If you want to exclude some part numbers in current assembly you can iterate the referenced documents(AssemblyDocument.AllReferencedDocuments) to find the ones.

 

As for the "<BLANK>", it is the default item in the exclude list no matter you set it or not, so if you want to clear the list you can use a string array with only one "" value, or with one "<BLANK>" value.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 8 of 8
JBerns
in reply to: Lesoux

@YuhanZhang,

 

Thanks for the clarification, Rocky.

I have the code working now so that I can warn users if Row Merging has been detected.

Much appreciated.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report