⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 line-anglf.grs

📁 UG二次开发很好的东西 需要的朋友可以下载来看看 很好用啊
💻 GRS
字号:
$$
$$    子程序line-anglf,用于计算两条拥有共同端点的直线之间的夹角。调用的子程序
$$    2-points-dis。
$$    输入参数:ln1、ln2。
$$    输出参数:ang。
$$    输入文件:无。
$$    输出文件:无。
$$

$$实体变量与数组变量申明。
proc/ln1,ln2,ang
entity/ln1,ln2,pt1,pt2,pt3
number/a(3),b(3),c(3)

$$求两直线ln1和ln2的交点pt1。
l10:
pt1=point/intof,ln1,ln2
a(1..3)=&point(pt1)

$$寻找直线ln1的另一个端点pt2。
l20:
b(1..3)=&spoint(ln1)
c(1..3)=&epoint(ln1)
ifthen/a(1)==c(1) and a(2)==c(2) and a(3)==c(3)
pt2=point/b(1..3)
elseif/a(1)==b(1) and a(2)==b(2) and a(3)==b(3)
pt2=point/c(1..3)
else
jump/trm:
endif

$$寻找直线ln2的另一个端点pt3。
l30:
b(1..3)=&spoint(ln2)
c(1..3)=&epoint(ln2)
ifthen/a(1)==c(1) and a(2)==c(2) and a(3)==c(3)
pt3=point/b(1..3)
elseif/a(1)==b(1) and a(2)==b(2) and a(3)==b(3)
pt3=point/c(1..3)
else
jump/trm:
endif

$$调用子程序2-points-dis求点pt1、pt2、pt3之间的距离。
l40:
call/'2-points-dis',pt1,pt2,dis1
call/'2-points-dis',pt1,pt3,dis2
call/'2-points-dis',pt3,pt2,dis3

$$计算直线ln1和ln2之间的夹角ang。
l50:
arg=(dis1*dis1+dis2*dis2-dis3*dis3)/(2*dis1*dis2)
ang=acosf(arg)
delete/pt1,pt2,pt3

$$程序返回。
trm:
return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -