生成bom表
ENTITY/obj(1000),ln1,ln2,ln3,pla(6),$
ln4,ln5,ln6,ln7,ln8,ln9,ln10,ln(1000)
NUMBER/x(1000),y(1000),z(1000),p(6),h,w(50),I,J,N,lo,$
xmin,xmax,ymin,ymax,zmin,zmax,w1,distan(7),$
x1,y1,z1,v,ans,m(100),u1,mindis(6),$
m1(1000),num(1000),num1(1000),l,p1,q1,r1
STRING/a(1000),b(1000),c(1000),d(1000),getname(1000,1000),$
name(1000,1000),t(10),stock(1000,1000),fix(1000),$
half(4,1000),part_name(132)
DATA/half,"羅鳴提示:選擇的實體是哪側鑲件",$
"定模鑲件",$
"動模鑲件",$
"滑塊鑲件"
l10:
mask/70
ident/"羅鳴提示:選擇鑲件實體,數目小於100",obj,CNT,N,rsp
jump/l10:,hal:,,,rsp
p1=0
l20:
DO /l30:,J,1, N
l21: getname(J)=&NAME(obj(J))
ifthen/lenf(getname(J))==0
r1=&COLOR(obj(J))
&COLOR(obj(J))=&RED
messg/"羅鳴提示:紅色實體沒有命名"
a7:
TEXT/"羅鳴提示:輸入紅色實體名稱",part_name,RSP1
JUMP/a7:,hal:,,RSP1
&name(obj(J))=part_name
&COLOR(obj(J))=r1
jump/l21:
ELSE
endif
l30:
J=1
m(J)=1
num(J)=0
l40:
DO /L50:,I,1,N
ans=CMPSTR(getname(J),getname(I))
IFTHEN/ans==1
m(J)=m(J)+ans
num(J)=num(J)
ELSEIF/ans==0
m(J)=m(J)
num(J)=num(J)+1
ENDIF
L50:
IFTHEN/J>N
JUMP/l60:
J=J+1
JUMP/l40:
l60:
CHOOSE/half(1..4),DEFLT,1,RSP
JUMP/l60:,hal:,,,l70:,l80:,l90:,RSP
l70:
fix="_fix_"
l=100
JUMP/l100:
l80:
fix="_move_"
l=300
l90:
fix="_slide_"
l=500
l100:
VIEW/1
GPOS/"羅鳴提示:選擇備料單表格放置點",$
x1,y1,z1,rsp
JUMP/l100:,hal:,,,,rsp
w(1)=10
w(2)=30
w(3)=60
w(4)=10
h=6
ln1=LINE/x1,y1,x1+w(1)+w(2)+w(3)+w(4),y1
u1=0
l110:
DO /l120:,I,1,N
IFTHEN/num(I)==1
u1=u1+num(I)
u1=u1+1/num(I)
l120:
K=1
l130:
DO /l160:, K, 1, N
DO /l150: , I, 1, N
IFTHEN/m(I)==K
m1(J)=I
name(J)=ISTR(l+J)+fix+&NAME(obj(I))
num1(J)=num(I)
I=N
lo=1
lo=0
l150:
IFTHEN/lo==0
J=J
l160:
N=u1
NOTE/x1+w(1)/2,y1-(h/2),"NO."
NOTE/x1+w(1)+w(2)/2,y1-(h/2),"NAME"
NOTE/x1+w(1)+w(2)+w(3)/2,y1-(h/2),"STOCK"
NOTE/x1+w(1)+w(2)+w(3)+w(4)/2,y1-(h/2),"QTY"
DO /l170:, I, 1, N
ln(I)=LINE/PARLEL,ln1,YSMALL,I*h
p=solbox/obj(m1(I))
xmin=minf(p(1),p(4))
xmax=maxf(p(1),p(4))
ymin=minf(p(2),p(5))
ymax=maxf(p(2),p(5))
zmin=minf(p(3),p(6))
zmax=maxf(p(3),p(6))
$print/xmin,xmax,ymin,ymax,zmin,zmax
draw/off
pla(1)=PLANE/YZPLAN,(xmin-10)
pla(2)=PLANE/YZPLAN,(xmax+10)
pla(3)=PLANE/XZPLAN,(ymin-10)
pla(4)=PLANE/XZPLAN,(ymax+10)
pla(5)=PLANE/XYPLAN,(zmin-10)
pla(6)=PLANE/XYPLAN,(zmax+10)
distan=reldst/pla(1),obj(m1(I)) $測量兩個物體的距離
mindis(1)=absf(distan(7)) $mindis(7)為距離
distan=reldst/pla(2),obj(m1(I))
mindis(2)=absf(distan(7))
distan=reldst/pla(3),obj(m1(I))
mindis(3)=absf(distan(7))
distan=reldst/pla(4),obj(m1(I))
mindis(4)=absf(distan(7))
distan=reldst/pla(5),obj(m1(I))
mindis(5)=absf(distan(7))
distan=reldst/pla(6),obj(m1(I))
mindis(6)=absf(distan(7))
DELETE/pla
draw/on
xmin=(xmin-10)+mindis(1)
xmax=(xmax+10)-mindis(2)
ymin=(ymin-10)+mindis(3)
ymax=(ymax+10)-mindis(4)
zmin=(zmin-10)+mindis(5)
zmax=(zmax+10)-mindis(6)
x(I)=absf(xmax-xmin)
y(I)=absf(ymax-ymin)
z(I)=absf(zmax-zmin)
&DECPL = 3
a=FSTRL(x(I))
b=FSTRL(y(I))
c=FSTRL(z(I))
stock(I)=a+"*"+b+"*"+c
t=ISTR(I)
NOTE/x1+w(1)/2,y1-(h/2)-I*h,t
NOTE/(x1+w(1)+w(2)/2),y1-(h/2)-I*h,name(I)
NOTE/x1+w(1)+w(2)+w(3)/2,y1-(h/2)-I*h,stock(I)
NOTE/x1+w(1)+w(2)+w(3)+w(4)/2,y1-(h/2)-I*h,ISTR(num1(I))
l170:
ln2=LINE/x1,y1,x1,y1-(N+1)*h
生成bom表
ENTITY/obj(1000),ln1,ln2,ln3,pla(6),$
ln4,ln5,ln6,ln7,ln8,ln9,ln10,ln(1000)
NUMBER/x(1000),y(1000),z(1000),p(6),h,w(50),I,J,N,lo,$
xmin,xmax,ymin,ymax,zmin,zmax,w1,distan(7),$
x1,y1,z1,v,ans,m(100),u1,mindis(6),$
m1(1000),num(1000),num1(1000),l,p1,q1,r1
STRING/a(1000),b(1000),c(1000),d(1000),getname(1000,1000),$
name(1000,1000),t(10),stock(1000,1000),fix(1000),$
half(4,1000),part_name(132)
DATA/half,"羅鳴提示:選擇的實體是哪側鑲件",$
"定模鑲件",$
"動模鑲件",$
"滑塊鑲件"
l10:
mask/70
ident/"羅鳴提示:選擇鑲件實體,數目小於100",obj,CNT,N,rsp
jump/l10:,hal:,,,rsp
p1=0
l20:
DO /l30:,J,1, N
l21: getname(J)=&NAME(obj(J))
ifthen/lenf(getname(J))==0
r1=&COLOR(obj(J))
&COLOR(obj(J))=&RED
messg/"羅鳴提示:紅色實體沒有命名"
a7:
TEXT/"羅鳴提示:輸入紅色實體名稱",part_name,RSP1
JUMP/a7:,hal:,,RSP1
&name(obj(J))=part_name
&COLOR(obj(J))=r1
jump/l21:
ELSE
endif
l30:
J=1
m(J)=1
num(J)=0
l40:
DO /L50:,I,1,N
ans=CMPSTR(getname(J),getname(I))
IFTHEN/ans==1
m(J)=m(J)+ans
num(J)=num(J)
ELSEIF/ans==0
m(J)=m(J)
num(J)=num(J)+1
ELSE
m(J)=m(J)
num(J)=num(J)
ENDIF
L50:
IFTHEN/J>N
JUMP/l60:
ELSE
J=J+1
m(J)=1
num(J)=0
JUMP/l40:
ENDIF
l60:
CHOOSE/half(1..4),DEFLT,1,RSP
JUMP/l60:,hal:,,,l70:,l80:,l90:,RSP
l70:
fix="_fix_"
l=100
JUMP/l100:
l80:
fix="_move_"
l=300
JUMP/l100:
l90:
fix="_slide_"
l=500
l100:
VIEW/1
GPOS/"羅鳴提示:選擇備料單表格放置點",$
x1,y1,z1,rsp
JUMP/l100:,hal:,,,,rsp
w(1)=10
w(2)=30
w(3)=60
w(4)=10
h=6
ln1=LINE/x1,y1,x1+w(1)+w(2)+w(3)+w(4),y1
u1=0
l110:
DO /l120:,I,1,N
IFTHEN/num(I)==1
u1=u1+num(I)
ELSE
u1=u1+1/num(I)
ENDIF
l120:
K=1
J=1
l130:
DO /l160:, K, 1, N
DO /l150: , I, 1, N
IFTHEN/m(I)==K
m1(J)=I
name(J)=ISTR(l+J)+fix+&NAME(obj(I))
num1(J)=num(I)
I=N
lo=1
ELSE
lo=0
ENDIF
l150:
IFTHEN/lo==0
J=J
ELSE
J=J+1
ENDIF
l160:
N=u1
NOTE/x1+w(1)/2,y1-(h/2),"NO."
NOTE/x1+w(1)+w(2)/2,y1-(h/2),"NAME"
NOTE/x1+w(1)+w(2)+w(3)/2,y1-(h/2),"STOCK"
NOTE/x1+w(1)+w(2)+w(3)+w(4)/2,y1-(h/2),"QTY"
DO /l170:, I, 1, N
ln(I)=LINE/PARLEL,ln1,YSMALL,I*h
p=solbox/obj(m1(I))
xmin=minf(p(1),p(4))
xmax=maxf(p(1),p(4))
ymin=minf(p(2),p(5))
ymax=maxf(p(2),p(5))
zmin=minf(p(3),p(6))
zmax=maxf(p(3),p(6))
$print/xmin,xmax,ymin,ymax,zmin,zmax
draw/off
pla(1)=PLANE/YZPLAN,(xmin-10)
pla(2)=PLANE/YZPLAN,(xmax+10)
pla(3)=PLANE/XZPLAN,(ymin-10)
pla(4)=PLANE/XZPLAN,(ymax+10)
pla(5)=PLANE/XYPLAN,(zmin-10)
pla(6)=PLANE/XYPLAN,(zmax+10)
distan=reldst/pla(1),obj(m1(I)) $測量兩個物體的距離
mindis(1)=absf(distan(7)) $mindis(7)為距離
distan=reldst/pla(2),obj(m1(I))
mindis(2)=absf(distan(7))
distan=reldst/pla(3),obj(m1(I))
mindis(3)=absf(distan(7))
distan=reldst/pla(4),obj(m1(I))
mindis(4)=absf(distan(7))
distan=reldst/pla(5),obj(m1(I))
mindis(5)=absf(distan(7))
distan=reldst/pla(6),obj(m1(I))
mindis(6)=absf(distan(7))
DELETE/pla
draw/on
xmin=(xmin-10)+mindis(1)
xmax=(xmax+10)-mindis(2)
ymin=(ymin-10)+mindis(3)
ymax=(ymax+10)-mindis(4)
zmin=(zmin-10)+mindis(5)
zmax=(zmax+10)-mindis(6)
x(I)=absf(xmax-xmin)
y(I)=absf(ymax-ymin)
z(I)=absf(zmax-zmin)
&DECPL = 3
a=FSTRL(x(I))
b=FSTRL(y(I))
c=FSTRL(z(I))
stock(I)=a+"*"+b+"*"+c
t=ISTR(I)
NOTE/x1+w(1)/2,y1-(h/2)-I*h,t
NOTE/(x1+w(1)+w(2)/2),y1-(h/2)-I*h,name(I)
NOTE/x1+w(1)+w(2)+w(3)/2,y1-(h/2)-I*h,stock(I)
NOTE/x1+w(1)+w(2)+w(3)+w(4)/2,y1-(h/2)-I*h,ISTR(num1(I))
l170:
ln2=LINE/x1,y1,x1,y1-(N+1)*h