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.

Relations filling in BOM

chuyck

New member
I am trying to create a relation where my BOM will automatically fill in the material spec for my family table of screws. I want it to read 1/4X .375 LG. or whatever length is used. I tried writing the relation as follows:


length = d6


com_diameter = d7


/*Material is equal to common diameter by length
MATERIAL=com_diameterX length LG.


errorExtra symbols found - ignored.
smiley7.gif



Can anyone tell me what I'm doing wrong?
 
One thing you must be aware of when writing relations is to use same data type in a relation. In your case it is possible, that parameter MATERIAL is of type String, but LENGTH and COM_DIAMETER are of type Real Numbers.

Another thing. When trying to use symbols to show in BOM, relation and therefor resulting parameter MUST be of type String. In your case you are using X to show between length and diameter. "X" is symbol or character which can only exist in String data type.

Try to write relation as follows:

MATERIAL = itos(LENGTH)+"X"+itos(COM_DIAMETER)

ITOS function will convert Integer data type to String. If you are using Real Numbers for LENGTH and COM_DIAMETER, numbers after the decimal point will be omitted.

To include numbers after the decimal point in the parameter MATERIAL, try to write the relation as follows:

MATERIAL=itos(floor(LENGTH))+","+itos(10*(LENGTH-floor(LENGT H)))

To have higher precision of decimal numbers, use coefficient 100 or 1000 instead of 10.
 
I tried to write the relation as follows but I received an error as well.


MATERIAL = itos(COM_DIAMETER)+"X"+itos(LENGTH)
errorInvalid data type combination at right side of expression


I don't understand what this means.
 
Make sure that your 'Material' parameter is set to type 'String'


Also the itos only works with integers. It sounds like your other parameters are realnumbers. You would need to convert the realnumber into an integer.Then you need to convert the Real Number to an Integer either, by dividing or multiplying. After that, you use the EXTRACT and ITOS commands to concatenate
the numbers into a full text string.





PLEN = ITOS(10000 * LENGTH)

PCOM1= "." + EXTRACT(PLEN,1,1) + EXTRACT(PLEN,2,1) + EXTRACT(PLEN,3,1)
(this will concatenate the 4th digit ONLY IF it's not a Zero)
IF EXTRACT(PLEN,4,1)<>"0"
PCOM1= PCOM1 + EXTRACT(PLEN,4,1)
ENDIF

YOU WOULD DO THE SAME WITH YOUR COM_DIAMETER


PDIA = ITOS(10000 * COM_DIAMETER)

PCOM2= "." + EXTRACT(PDIA,1,1) + EXTRACT(PDIA,2,1) + EXTRACT(PDIA,3,1)
(this will concatenate the 4th digit ONLY IF it's not a Zero)
IF EXTRACT(PDIA,4,1)<>"0"
PCOM2= PCOM2 + EXTRACT(PLEN,4,1)
ENDIF



MATERIAL=PCOM1 + "X" + PCOM2
 

Sponsor

Articles From 3DCAD World

Back
Top