Changing a parts list formatting to fractional using logic

Changing a parts list formatting to fractional using logic

NikelARH4K2
Contributor Contributor
583 Views
5 Replies
Message 1 of 6

Changing a parts list formatting to fractional using logic

NikelARH4K2
Contributor
Contributor

Hello

I am trying to change the units of a column to fraction using ilogic

basically access this information through logic

NikelARH4K2_0-1724337605948.png

 

0 Likes
Accepted solutions (1)
584 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @NikelARH4K2.  We cannot access those column value formatting settings by code yet.  We would have to find that specific column by code, then navigate to each cell within that column, and change the String value to look the way we want them to look individually.  But then the cell values would likely become 'static', instead of linked / live.

PartsList 

PartsListColumn 

PartsListCell 

Edit:  But out of curiosity, is that column for a 'Custom' iProperty?  If so, then is that custom iProperty based on a parameter, that has been exposed/exported?  If so, then you may be able to go to the source model documents and change the formatting of those values there, that way they look the way you want them to look within the assembly BOM and PartsList later.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

NikelARH4K2
Contributor
Contributor

So what i am trying to do is our shop has been asking for a decimal to fraction conversion because they prefer fractional

 

We would use Item QTY to say how many you need and then i would use unit QTY to show the cut lengths. Unfortunately, frame parts use G_L custom I property and pipe uses PL Custom I property. So cant just pull that custom i property into out BOMs because i wouldnt display both pipe and frame members properly. 

NikelARH4K2_1-1724412793040.png

 

^^Unit QTY puts the "in" on only the cut lengths of both pipe and steel frame but leave the other ones "1" without the unit string


 

NikelARH4K2_0-1724412547664.png



So unit QTY is good because it pulls both the frame parts and pipe parts while leaving purchases parts as "1" without any units. So i can use logic to override anything with "1" to be N/A.

But, once i tell it to change it to fractional and give it a unit string it changes the "1" to "1 in" which technically its not even a length. I could do the same to change "1 in" to a N/A but then if we get a 1 in cut length part then it will override it.

NikelARH4K2_2-1724413112033.png

 

 

My plan was to have logic look down the unit qty column and change all of them to not static, then any cell that has a 1 in it to change it to N/A then it will be constantly checking to make sure its not leaving N/A over something that shouldn't

We often mix pipe and frame members so i cant find a way to make it work

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Hi @NikelARH4K2.  This type of situation can be complicated to fully understand and deal with.  I pretty much never use 'frame' or 'pipe' stuff, so I am not 100% sure if those files will be treated as ReadOnly from Inventor's perspective or not.

 

If they are not treated as ReadOnly, then we may be able to create a secondary parameter with a common name (same name in frames & pipes) in each of those files, who's value is set to the name of that other parameter (G_L or PL), so that we could use that common parameter to drive the 'Base Quantity' for all those types of parts, then set that parameter to exported, then set the formatting of the custom iProperty that exporting the parameter creates.  Then include that custom iProperty as a column in your PartsLists.

 

Understanding what all those quantity related terms mean can also be confusing.  The following is just a quickie explanation of those terms, and how they are controlled on the document side.

BOMQuantity (an Inventor API object used to access those types of settings, in multiple places)

  • Base Quantity:  (in Document Settings, per model document)
    • This will either be set to 'Each' (by default), or set to reference a specific Parameter.
    • If set to reference a Parameter, then the numerical value of that Parameter is used as part of the quantity calculations.
    • The 'Units' of this Parameter must be a type of linear distance, mass, or volume.
  • Base Units:  (in Document Settings per model document)
    • Will be 'Each' by default, but if Base Quantity is set to a Parameter, then this will usually get set to the same units as that Parameter.
    • However, when Base Quantity is set to a Parameter, this can be set to different Units than that Parameter, as long as it conforms to the distance, mass, or volume type units.
  • Unit Quantity:  (in Document Settings per model document)
    • This is the calculated result of Base Quantity and the Base Units.
    • This will usually have the same value as Base Quantity, if the Base Units is set to the same units as the Base Quantity parameter's units.
    • However, if the Base Units is set to different units then the Base Quantity parameter's units, then this value can be different than the Base Quantity.
  • Item Quantity:  (assembly BOM & PartsList only)
    • This is always an Integer, representing the 'net' quantity of occurrences of this item are present in the assembly.
    • By 'net', I mean it will not include occurrences who's BOMStructure is set to phantom or reference.
  • Total Quantity:  (assembly BOM only)
    • This is the product (calculated result) of multiplying model document settings based Unit Quantity and the assembly level Item Quantity together.

In a drawing, the PartsList is referencing a DrawingBOM, then that DrawingBOM is referencing an assembly's BOM.  But the assembly's BOM can not be navigated like a table, like we can with a drawing's PartsList, and we can easily override cell values in a PartsList, and can easily tell if values in a PartsListCell are 'static' or not.  So, what you want to do may be possible, but the code may require product/designer specific knowledge built into it to recognize what each row of the PartsList represents, and how they should be handled for the automation code to work properly.  We can dig down from the PartsListRow to the DrawingBOMRow, then on to the BOMRow, but it is a little more complicated than it seems like it should be.

 

As far as keeping the PartsList data updated, since some data may need to be static, there is not really any good event listed in the iLogic 'Event Triggers' for that purpose.  The updates may need to be driven from the assembly document side, using one or more custom event handler blocks of code that may be more specific to when BOM related details change.  

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

NikelARH4K2
Contributor
Contributor
Accepted solution

Ok i found a really dumb way to do it

If i pull the G_L value which if the frame member custom iproperty it shows this

NikelARH4K2_0-1724421964755.png


then i do a value substation and have it pull PL which is the pipe property into columns that exist

NikelARH4K2_1-1724422025758.png

which will show like this

NikelARH4K2_2-1724422056780.png


then apply fractional formatting to the column and the substitutions

NikelARH4K2_3-1724422141425.png


Now i cant use the logic to put N/A in the blank rows but thats not big deal because it says "Incompatible Units Error" and i cant have N/A stay in there

 

Message 6 of 6

WCrihfield
Mentor
Mentor

Value substitution is not a 'dumb' idea, it is actually pretty smart, and it great for situations similar to this one.  I have suggested similar solutions before, but very rarely (if ever) needed to use it myself.  Special / extra columns can be used for special cross column calculations/results also, but unfortunately I don't think we can 'hide' those special columns, like we can with rows.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes