External BoM Scripting

External BoM Scripting

Julio_Soto
Advisor Advisor
2,700 Views
14 Replies
Message 1 of 15

External BoM Scripting

Julio_Soto
Advisor
Advisor

I found this AKN page regarding scripting in an external bom.  It seems to be lacking alot of information. Or I guess it's possible you can only do what is shown on this page.

 

Does anyone have a more thorough document about scripting for an external bom?

 

link to the page

https://knowledge.autodesk.com/support/advance-steel/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU...

0 Likes
Accepted solutions (1)
2,701 Views
14 Replies
Replies (14)
Message 2 of 15

Sebastian_Eiche
Mentor
Mentor

There's no other documentation to this as I know. 

Here in the forum are a few threads but not much. 

Some c# classes could be used and some not I never find a doc which are working.


Sebastian Eiche
Application Engineer @Mensch und Maschine acadGraph

EESignature

If this information was helpful, please use the Accept as Solution function, this make it easier for other users

Message 3 of 15

bigcarl5000kg
Advisor
Advisor

Hi @Julio_Soto,

 

you may first have to study several available materials for scripts, then it can be applied to certain tasks ...

 

I know that there are not as many of them as one would like, but do not expect surprises.

 

Here is a tasting ... 

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
Message 4 of 15

Julio_Soto
Advisor
Advisor

Thanks for this, It's not what I was looking for but it is still useful for other stuff.

 

I was specifically asking for scripting inside the external BOM.  I never would've guessed at the operators.

 

For example, "=" is "==", and the "if" is noted by "?". I never would've figured this out.  Is it possible to use an and/or statement? I have no idea what symbol/syntax I would use. 

0 Likes
Message 5 of 15

Sebastian_Eiche
Mentor
Mentor
Accepted solution

This is a reference used by c#.

condition ? consequent : alternative

The script language could be changed in the bom editor, but I never tried it. If you select the template there's an option for Script language between c# and vb

 


Sebastian Eiche
Application Engineer @Mensch und Maschine acadGraph

EESignature

If this information was helpful, please use the Accept as Solution function, this make it easier for other users

0 Likes
Message 6 of 15

Julio_Soto
Advisor
Advisor

ah, I see. That's very helpful. I don't know C# but I can learn ;).  Thanks!

0 Likes
Message 7 of 15

bigcarl5000kg
Advisor
Advisor

Hi @Julio_Soto ,

 

have you made any progress? Can you give us some results? Thank you in advance and have a nice weekend.

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes
Message 8 of 15

Julio_Soto
Advisor
Advisor

I have made some progress. I googled C# scripting examples and then just started experimenting.  Here are a few I did that work.

 

=(ILength==null)?(""):(((IName.Contains("ISO")|(IName.Contains("DIN"))?(ILength + " mm"):(ILength))))

 

 

The "Contains" is what I use instead of wildcard asterik.  For example, you can't say IName="*ISO*".  You have to use the Contains method. This was incredibly useful for us. Our company always uses metric and imperial. However the External BoM formats units for the entire bom.  This makes it tricky for us. Our ISO/DIN Bolts length always show up in inches.  So I wrote the above script to check for DIN or ISO and then add mm to the length. THE "|" is C# version of "OR"

 

Something else I learned, if you use some measurement token (e.g. IWidth or ILength) , in a script, it will always return the value in mm. It doesn't matter how the Unit Properties of your BoM are setup.  To get around this I had to use Template Mapping to create a custom External BoM Tokens that format the value as I need. See SS below. 

Julio_Soto_0-1637443121331.png

This mostly worked.  I ran into a problm if the Custom Token was nested in an IF statement. If the custom token is used in an IF statement that is nested in another IF statement the BoM returns null or a "True", "False" value. It's weird and I cant explain it.  If it's in the top level IF statement the custom token works.  AS is weird. Below is that script 

 

=IName.Contains("Bent") | IClass.Contains("Nut") | IClass.Contains("Washer")?(IName.Contains("Bent")?"TBD":""):XXXLengthUS

 

 

The easiest script I wrote I used to to get around AS's bug regarding mapping for folded beams. It was confirmed by AutoDesk that mapping for folded beams does not work as intended.  AS will correctly map the folded beam. The problem is, for reasons unknown, IExternal1 does NOT replace IName as it does for all other mapping items. So below I did a check if IExternal1 is blank, then use IName, otherwise External1. Works perfectly

 

=IExternal1 = ""?IName:IExternal1

 

 

Message 9 of 15

bigcarl5000kg
Advisor
Advisor

Thank you for the feedback

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes
Message 10 of 15

niels.h
Explorer
Explorer

I would like my fittings list to only have the part marks and not the main marks.

Maybe you can help me out with this?

 

=(IPNum != MNum) ? (IPNum)

0 Likes
Message 11 of 15

AleckGiles
Mentor
Mentor

Hi @niels.h 

 

Just change the token used in the field to Single Part Mark instead of Part Mark. Part Mark calls up the assembly number for main parts and single part number for attached parts. Single Part Mark always uses the single part number.

Aleck Giles, Structures Consultant, Graitec
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

LinkedIn

Autodesk Certified Instructor - Gold

Message 12 of 15

Flies-Eyes
Advisor
Advisor

Oh dear..... looks like I have another steep learning curve in front of me to achieve some basic filtering.  I suppose if I never get started, I will never get finished.

 

Thanks for sharing your findings.

 

 

Message 13 of 15

Julio_Soto
Advisor
Advisor

it's actually not that steep, but only because it is pretty limited in what it can do. 

Message 14 of 15

JAANWLODARCZYK
Community Visitor
Community Visitor

But where do you input those scripts? Do you define it in "formula" cell?

0 Likes
Message 15 of 15

Julio_Soto
Advisor
Advisor

In the DataField cell

Julio_Soto_0-1720445127573.png

 

0 Likes