EDA365电子工程师网
标题:
原点设置到两条线交点上面
[打印本页]
作者:
1392431396
时间:
2016-11-5 11:20
标题:
原点设置到两条线交点上面
defun( set_origin ()
popup = axlUIPopupDefine(nil (list
(list "Done" `axlFinishEnterFun)
(list "Cancel" `axlcancelEnterFun)))
axlUIPopupSet(popup)
axlClearSelSet()
axlSetFindFilter( ?enabled list("noall" "CLINESEGS") ?onButtons list("noall" "CLINESEGS"))
axlSingleSelectPoint()
cline1 = car(axlGetSelSet())
axlClearSelSet()
axlHighlightObject(cline1)
when(cline1
axlSetFindFilter( ?enabled list("noall" "CLINESEGS") ?onButtons list("noall" "CLINESEGS"))
axlSingleSelectPoint()
cline2 = car(axlGetSelSet())
axlClearSelSet()
axlDehighlightObject(cline1)
)
when(cline1 && cline2 && cline1->layer == cline2->layer
point = axl_ol_ol2(cline1->startEnd cline2->startEnd)
axlDBChangeDesignOrigin(list(minus(xCoord(car(point))) minus(yCoord(car(point)))))
)
)
axlCmdRegister("Origin" 'set_origin)
有个问题需要解决:当两天线交点在延长线上面时,原点不会设置到延长线交点上
@deargds
作者:
deargds
时间:
2016-11-7 13:31
axl_ol_ol2这个只能求出实交点,使用下面这个函数试一下,使用方法如下:
line_intersect(cline1->startEnd cline2->startEnd)
defun( line_intersect (line1 line2)
prog((x0 y0 x1 y1 x2 y2 x3 y3 x y)
x0 = xCoord(nth(0 line1))
y0 = yCoord(nth(0 line1))
x1 = xCoord(nth(1 line1))
y1 = yCoord(nth(1 line1))
x2 = xCoord(nth(0 line2))
y2 = yCoord(nth(0 line2))
x3 = xCoord(nth(1 line2))
y3 = yCoord(nth(1 line2))
y = car(errset(((y0-y1)*(y3-y2)*x0 + (y3-y2)*(x1-x0)*y0 + (y1-y0)*(y3-y2)*x2 + (x2-x3)*(y1-y0)*y2 ) / ((x1-x0)*(y3-y2) + (y0-y1)*(x3-x2))))
if(y then
x = x2 + (x3-x2)*(y-y2) / (y3-y2)
return(list(x y))
else
return(nil)
)
)
)
;deargds
;www.eda365.com
复制代码
作者:
hy20060614
时间:
2016-11-8 11:35
谢谢分享
作者:
mentorkk
时间:
2016-11-14 14:29
谢谢分享
欢迎光临 EDA365电子工程师网 (https://bbs.elecnest.cn/)
Powered by Discuz! X3.2