Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.
Ive got a similar problem...Im trying to use the show the
height x width x thickness in a description. i can get the
height and width but Im having problems getting it to show
"15 x 12 x .5". When I put the x in it shows an error. How
exactly are the quote marks suppose to be used in this
case?
Combining real numbers and strings gets complicated. You
do have to convert the real numbers to text first using
ITSO. Below is what I use for a plate. HOR, VERT and
LENGTH are dimension names of the plate. W1, H1 and L1
are temporary values for the code. I use IF statements to
get the correct number of characters based on whether the
value has a tens place or a hundreds place. INCH is a
string parameter I added and assigned the value "
IF HOR < 1
W1= "."+EXTRACT(ITOS(HOR*100),1,2)
ELSE
IF HOR< 10
W1=EXTRACT(ITOS(HOR*100),1,1)+"."+EXTRACT(ITOS(HOR*100),2
,2)
ELSE
W1=EXTRACT(ITOS(HOR*100),1,2)+"."+EXTRACT(ITOS(HOR*100),3
,2)
ENDIF
ENDIF
IF VERT < 1
H1= "."+EXTRACT(ITOS(VERT*100),1,2)
ELSE
IF VERT < 10
H1=EXTRACT(ITOS(VERT*100),1,1)+"."+EXTRACT(ITOS(VERT*100)
,2,2)
ELSE
H1=EXTRACT(ITOS(VERT*100),1,2)+"."+EXTRACT(ITOS(VERT*100)
,3,2)
ENDIF
ENDIF
IF LENGTH < 1
L1= "."+EXTRACT(ITOS(LENGTH*100),1,2)
ELSE
IF LENGTH < 10
L1=EXTRACT(ITOS(LENGTH*100),1,1)+"."+EXTRACT(ITOS(LENGTH*
100),2,2)
ELSE
IF LENGTH >= 100
L1=EXTRACT(ITOS(LENGTH*100),1,3)+"."+EXTRACT(ITOS(LENGTH*
100),4,2)
ELSE
L1=EXTRACT(ITOS(LENGTH*100),1,2)+"."+EXTRACT(ITOS(LENGTH*
100),3,2)
ENDIF
ENDIF
ENDIF
DESCRIPTION= "PLATE, " +W1+INCH+" X "+H1+INCH+" X
"+L1+INCH+"LG"
It does not include leading zeroes, which are not necessary
when specifying English dimensions. If you need a leading
zero you can change the second line of the Length if
statement to
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.