Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Formatting BOM values

mason82

New member
The parts in my model have an evaluate feature returning their length. The length is then displayed in the BOM repeat region as &asm.mbr.size or whatever.


The number for the length it returns is a decimal (set to 2 places).How can Iconvert the decimal to a fractional equivalent? E.g. If the lengthin the table shows4.375, how can I have it show 4 3/8?


Thanks
 
<DIV =indent10>


I found this in PTC site.


Description
-----------------
As of Release 2000i, there is no automatic way to convert number parameters to fractional format. The following method explains how repeat region relations can be created to convert number parameters to strings which display in fraction.

Alternate Technique
-----------------
See Resolution below.

Resolution
-----------------
Assuming that the base denominator will be 8 and that the number parameter 'length' exits in all parts, the following repeat region relation may be created:

denom_base=8
rep_param=asm_mbr_length
whole=floor(rep_param)
fraction=(rep_param-whole)*denom_base

if (fraction==0)
text=(itos(floor(whole)))
</PRE>else
if (((fraction/4)-floor(fraction/4))==0)
if whole > 0
text=(itos(floor(whole))) + " -" + (itos(floor(fraction/4))) + "/2"
else
text=(itos(floor(whole))) + (itos(floor(fraction/4))) + "/2"
endif
</PRE>else
if (((fraction/2)-floor(fraction/2))==0)
if whole > 0
text= (itos(floor(whole))) + " -" + (itos(floor(fraction/2))) + "/4"
else
text= (itos(floor(whole))) + (itos(floor(fraction/2))) + "/4"
endif
</PRE>else
if whole > 0
text=(itos(floor(whole))) + "-" + (itos(floor(fraction))) + "/8"
</PRE>else
text=(itos(floor(whole))) + (itos(floor(fraction))) + "/8"
</PRE>endif
endif
endif
endif

After creating the relation, replace the parameter asm.mbr.length with rpt.rel.text. The relation may be modified such that the base is 16 if desired. Note: Rounding will occur on the number parameters. Check each fraction to ensure that it is the desired value.


</DIV>
 

Sponsor

Articles From 3DCAD World

Back
Top