I'm using the attached BOM Sorting macro to sort the BOMs in my drawing. The macro works perfectly for smaller sized BOMs but give inconsistent results when using with a BOM of large assembly (100 + rows). Anyone has faced similar issues? If yes where you able to find any solution or workaround?
Unfortunately I can not share the files.
Thank you in advance for any help.
BOM Sorting Issue
BOM Sorting Issue
What a coincidence, I ran into the exact same problem last week. I have also written a macro to sort the parts list, and also with me the sorting results were partly not correct.
However, for me it was not dependent on the number of lines in the BOM, but on the type of BOM used.
With the type "only parts" it worked correctly. With the type "top level only" the sorting was not usable.
My VAR gave me great support in solving the problem.
He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
Go to full postHowever, for me it was not dependent on the number of lines in the BOM, but on the type of BOM used.
With the type "only parts" it worked correctly. With the type "top level only" the sorting was not usable.
My VAR gave me great support in solving the problem.
He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: BOM Sorting Issue
Have you tried doing a manual sort through the UI using he exact same parameters?
How is it inconsistent? Does the same BOM sort the same every time, just not as you expect? Or does the same BOM sort differently if you run it twice?
You've specified literal sort order. This will cause 10, 11, 12, etc to come before 2. Is that what you're expecting?
How is it inconsistent? Does the same BOM sort the same every time, just not as you expect? Or does the same BOM sort differently if you run it twice?
You've specified literal sort order. This will cause 10, 11, 12, etc to come before 2. Is that what you're expecting?
Re: BOM Sorting Issue
What a coincidence, I ran into the exact same problem last week. I have also written a macro to sort the parts list, and also with me the sorting results were partly not correct.
However, for me it was not dependent on the number of lines in the BOM, but on the type of BOM used.
With the type "only parts" it worked correctly. With the type "top level only" the sorting was not usable.
My VAR gave me great support in solving the problem.
He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
However, for me it was not dependent on the number of lines in the BOM, but on the type of BOM used.
With the type "only parts" it worked correctly. With the type "top level only" the sorting was not usable.
My VAR gave me great support in solving the problem.
He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
All the "good" news about SWX makes me feel like I'm driving a truck with two trailers straight into a dead end.
- AlexLachance
- Posts: 2002
- Joined: Thu Mar 11, 2021 8:14 am
- Location: Quebec
- x 2160
- x 1850
Re: BOM Sorting Issue
Hansjoerg wrote: ↑Mon Sep 19, 2022 3:31 am What a coincidence, I ran into the exact same problem last week. I have also written a macro to sort the parts list, and also with me the sorting results were partly not correct.
However, for me it was not dependent on the number of lines in the BOM, but on the type of BOM used.
With the type "only parts" it worked correctly. With the type "top level only" the sorting was not usable.
My VAR gave me great support in solving the problem.
He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
Now, this is the kind of support we should be having and expecting.
Re: BOM Sorting Issue
Thank you for your reply Josh.josh wrote: ↑Sun Sep 18, 2022 6:35 pm Have you tried doing a manual sort through the UI using he exact same parameters?
How is it inconsistent? Does the same BOM sort the same every time, just not as you expect? Or does the same BOM sort differently if you run it twice?
You've specified literal sort order. This will cause 10, 11, 12, etc to come before 2. Is that what you're expecting?
Manually sorting is working prefect every time with same settings. And this macro works perfect on small top level BOMs but give incorrect results when used on a large assembly BOM.
I've tried changing literal to numeric but macro still doesn't work.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: BOM Sorting Issue
Thank you for your inputs Hansjoerg, let me check with this setting and confirm.Hansjoerg wrote: ↑Mon Sep 19, 2022 3:31 am My VAR gave me great support in solving the problem. He found out that a missing setting in my templates triggered the problem.
I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: BOM Sorting Issue
Hansjoerg, this setting did the trick. The macro is working perfect now. Thank you for your help.Hansjoerg wrote: ↑Mon Sep 19, 2022 3:31 am I used the following command in the macro to set the missing setting in the template:
IModelDocExtension::SetUserPreferenceToggle(swUserPreferenceToggle_e.swOneConfigOnlyTopLevelBom, swUserPreferenceOption_e.swDetailingNoOptionSpecified, <OnFlag>)
After that, the BOM of the top level were also sorted correctly
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: BOM Sorting Issue
The thanks do not belong to me but to this user -> @RonE
He is the one who found the solution.
He is the one who found the solution.
All the "good" news about SWX makes me feel like I'm driving a truck with two trailers straight into a dead end.