马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 st788796 于 2014-11-1 08:07 编辑
AcGe 类库中,除了 AcGeLinearEnt AcGeCircArc AcGeEllipArc 有 intersectWith() 方法,其它曲线求交只能使用这个相交体
另外求 Pline 自相交点时可以将 CompositeCrv3d 构造自己和自己的相交体
参见 http://www.xdcad.net/forum/forum.php?mod=redirect&goto=findpost&ptid=675963&pid=3529921
构造方法
1 (setq gcc (xdge::constructro "kCurveCurveInt3d"))
默认构造,构造完成后可以使用 set 方法添加组成构造体的 GeCurve
2 (setq gcc (xdge::constructor "kCurveCurveInt3d" ge1 ge2 normal)
3 (setq gcc (xdge::constructor "kCurveCurveInt3d" ge1 ge2 interval1 interval2 normal)
构造曲线的一部分间相交体,interval 是 AcGeInterval 实体
一个测试
 - (defun c:tt (/ e1 e2 ge1 ge2 gcc n i ptl pl)
- (if
- (and (setq
- e1 (car (xdrx_entsel
- "\nPick Curve1: "
- '((0 . "*Polyline,Line,spline,circle,ellipse,arc"))
- )
- )
- )
- (setq
- e2 (car (xdrx_entsel
- "\nPick Curve1: "
- '((0 . "*Polyline,Line,spline,circle,ellipse,arc"))
- )
- )
- )
- (setq ge1 (xdge::constructor e1)) ;_构造曲线一的 GeCurve
- (setq ge2 (xdge::constructor e2)) ;_构造曲线一的 GeCurve
- (setq gcc (xdge::constructor "kCurveCurveInt3d")) ;_构造曲线相交体
- (xdge::setpropertyvalue
- gcc
- "set"
- ge1
- ge2
- (xdrx_getpropertyvalue e1 "Normal")
- )
- (> (setq n (xdge::getpropertyvalue gcc "numIntPoints")) 0) ;_判断交点数量
- )
- (progn
- (xdge::getpropertyvalue gcc "orderWrt2") ;_将交点按曲线一的参数排升序
- (setq i -1)
- (repeat n
- (setq ptl
- (cons
- (xdge::getpropertyvalue gcc "intPoint" (setq i (1+ i))) ;_索引处交点
- ptl
- )
- pl (cons (xdge::getpropertyvalue gcc "getIntParams" i) pl) ;_交点索引处参数(位于两个曲线上的)
- )
- )
- (princ "\n第一条曲线交点参数为: ")
- (princ (mapcar 'car pl)) ;_曲线一上的交点参数
- (princ "\n第二条曲线交点参数为: ")
- (princ (mapcar 'cadr pl)) ;_曲线一上的交点参数
- (setq i 0)
- (mapcar
- '(lambda (x)
- (xdrx_entity_setcolor (xdrx_point_make x) (setq i (1+ i)))
- )
- ptl
- )
- )
- )
- (xdge::free)
- (princ)
- )
|