Unitless Bom List Export in VB.Net

Unitless Bom List Export in VB.Net

tomas_wiklund
Contributor Contributor
368 Views
2 Replies
Message 1 of 3

Unitless Bom List Export in VB.Net

tomas_wiklund
Contributor
Contributor

I have some code that exports "bom list" to an excel file. (VB.Net)
The problem is that I get the unit out on some rows in the Thickness column and some not.
Is there a good way to export without the device (mm)?

tomas_wiklund_0-1704365092987.png

0 Likes
Accepted solutions (1)
369 Views
2 Replies
Replies (2)
Message 2 of 3

A.Acheson
Mentor
Mentor

Hi @tomas_wiklund 

You will need to carryout a string removal operation on the excel column after exporting. One way to do this is using a character removal function see help page here.

Dim MyString As String = "Hello World!"
Dim MyChar() As Char = {"r", "o", "W", "l", "d", "!", " "}
Dim NewString As String = MyString.TrimEnd(MyChar)
Logger.info(NewString)
        

 

Another method is to identify only numeric numbers and remove the rest. The string removal will likely be sufficient. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @tomas_wiklund.  Does that column represent a custom iProperty that is driven by a Parameter?  If so, then you could change the 'CustomPropertyFormat' settings for those exposed parameters, either within the parameters dialog box while each of those models are open, or by running some custom iLogic rule on each of them to change those settings for you.

 

When doing it manually, when you have the Parameters dialog box open, and you have checked the check box in the 'Export Parameter' column, that automatically creates a custom iProperty with the same name and value as that parameter.  Then, right-click on the row for that parameter, and choose the 'Custom Property Format...' option from the right-click menu.

WCrihfield_0-1704388291344.png

  That will open a small dialog which will allow you to change how the custom iProperty's value will be formatted.

WCrihfield_1-1704388371726.png

And if doing it by code, once you find that Parameter type API object, it will have a property named ExposedAsProperty which is the same as that check box in the dialog, allowing you to set True as its value to check that box.  Then the parameter has another property named CustomPropertyFormat, which will return a CustomPropertyFormat type object, which you can change the properties of, to achieve most of the same settings as you see in the dialog...except for the last check box for 'Apply to existing comparable parameters'.  In those settings, if you set the Property Type to Number, the units string will not be available, because it will be a purely numerical value.  If you set the Property Type to Text, it will allow you to uncheck the Units String, to not include them in the value.  Then the information in the BOM will be uniform, and not include those pesky units strings.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)