直纹
简单直纹【容易出错】
entity / obj,ln(2)
obj = rldsrf/ln(1),,ln(2)
点控制直纹【需要计算方向】
entity / obj,ln(2),pt(2)
number / p(1..3)
p(1..3)=cposf(l2(a(i)),.8)
pt=point/p(1..3)
obj = rldsrf/ln(1),pt(1),ln(2),pt(2)
直纹实列自动计算方向创建直纹
gripsw / declrv
entity / f(105),l1(100),l2(100),ln(100),pt(3)
number / pick_ga(60),resp,i,j,k,p(9),n(100),a(100),b
number / r1(7),r2(7)
string / uf(132)
l10:
mask/3,5,6,9,15
ident/'请选择二组高度不同的封闭曲线',ln,cnt,pick_ga(3),resp
jump/l10:,end:,,,resp
pick_ga(4)=modf(pick_ga(3),2)
ifthen/pick_ga(4)<>0
messg/'第一组曲线和第二组曲线数量必须相同'
jump/l10:
endif
$$--------------------------------------------------
$$一组曲线分层二组曲线
pick_ga(10)=0
pick_ga(11)=0
p(1..3)=&spoint(ln(1))
j=p(3)
do/l20:,i,1,pick_ga(3)
p(1..3)=&spoint(ln(i))
ifthen/j==p(3)
pick_ga(10)=pick_ga(10)+1
l1(pick_ga(10))=ln(i)
else
pick_ga(11)=pick_ga(11)+1
l2(pick_ga(11))=ln(i)
endif
l20:
ifthen/pick_ga(10)<>pick_ga(11)
messg/'第一组曲线和第二组曲线数量必须相同'
jump/l10:
endif
$$--------------------------------------------------
$$ 分析曲线最小距离,重新排列曲线位置
do/l30:,i,1,pick_ga(10)
a(i)=1
p(1..3)=cposf(l1(i),0.5)
do/l40:,j,1,pick_ga(10)
p(4..6)=cposf(l2(j),0.5)
n(j)=absf(sqrtf((p(1)-p(4))**2+(p(2)-p(5))**2+(p(3)-p(6))**2))
if/n(j)<n(a(i)),a(i)=j
l40:
l30:
$$--------------------------------------------------
$$创建指纹
do/l50:,i,1,pick_ga(10)
p(1..3)=&spoint(l1(i))
p(4..6)=&spoint(l2(a(i)))
p(7..9)=&epoint(l2(a(i)))
pt(1)=point/p(1..3)
pt(2)=point/p(4..6)
pt(3)=point/p(7..9)
r1(1..7)=reldst/pt(1),pt(2)
r2(1..7)=reldst/pt(1),pt(3)
ifthen/r1(7)<r2(7)
f(i)= rldsrf/l1(i),pt(1),l2(a(i)),pt(2)
else
f(i)= rldsrf/l1(i),pt(1),l2(a(i)),pt(3)
endif
delete/pt
l50:
end:
halt
_____________________________________________________________________________ _
中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/
|