| 
本帖最后由 st788796 于 2014-11-1 08:03 编辑
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
    
 在 AutoCAD 中经常会用到 Plane 概念,先看看 ARX 中 Plane  构造方法
 
 1 用平面方程,这个不常用,有计算功夫都构造完了
 AcGePlane 建构器和析构器  | AcGePlane::AcGePlane Function  AcGePlane( double a, double b, double c, double d); 
 | a | 输入坐标 a |  | b | 输入坐标 b |  | c | 输入坐标 c |  | d | 输入坐标 d | 
 
 建构器。建构满足以下等式的平面: a*x + b*y + c*z + d = 0 这个平面的参数设置如下:原点是在平面上最接近点(0,0,0), uAxis= norm.perpVector()和vAxis=norm.crossProduct(uAxis),其中向量norm是vec.normal()。 注意:坐标为 (a, b, c)的向量vec是非零长度。 
 | 
 
 2 这个说明和翻译比较坑爹,你要这样用 vec 构造的就不是需要的 Plane ,应该是同一平面上的 三个点
 
 AcGePlane( const AcGePoint3d& or, const AcGeVector3d& uAxis, const AcGeVector3d& vAxis); 
 | or 
 | 输入原点 
 |  | uAxis 
 | 输入任意向量 
 |  | vAxis 
 | 输入任意向量 
 | 
 
 用原点or,U轴uAxis和V轴vAxis建构平面。 注意: 向量uAxis vAxis=pntV-or不在同一直线上。 
 3 这个是三点构造,必须在同一平面内的非共线三点
 
 
 AcGePlane( const AcGePoint3d& pntU, const AcGePoint3d& or, const AcGePoint3d& pntV); | pntU 
 | 输入U轴上的点U 
 |  | or 
 | 输入原点 
 |  | pntV 
 | 输入V轴上的点V 
 | 
 
 用原点=or, uAxis=v1和vAxis=v2建构平面。 注意: 向量v1=pntU-or和v2=pntV-or不在同一条直线上一个测试
 4 原点 +  Normal
 
 AcGePlane( const AcGePoint3d& origin, const AcGeVector3d& normal); | origin 
 | 输入平面原点 
 |  | normal 
 | 输入法向量 
 | 
 用origin=pnt, uAxis= normal.perpVector()和vAxis=normal.crossProduct(uAxis)建构平面。 注意: 法向量是非零长度。  
 
 
  (defun c:tt (/ p1 p2 p3 ln ln3d plane pnt vx vy vz)
  (if (and (setq p1 (getpoint "\nFirst Point on Plane: "))
           (setq p2 (getpoint "\nSecond Point on Plane: "))
           (setq p3 (getpoint "\nThird point on Plane: "))
           (setq pc (mapcar '(lambda (x y z) (/ (+ x y z) 3.)) p1 p2 p3))
           (setq ln (xdrx_entsel "\nPick Line: " '((0 . "line"))))
           (setq vx (xdrx_vector_normalize (mapcar '- p2 p1))
                 vy (xdrx_vector_perpvector vx)
                 vz (xdrx_vector_crossproduct vx vy)
           )
           (setq line3d        (xdge::constructor
                          "kLine3d"
                          (xdrx_curve_getstartpoint (car ln))
                          (xdrx_curve_getendpoint (car ln))
                        )
           )
           ;;构造平面按手册说明几种方法
           ;;1 方式2  (xdge::constructor "kPlane" pc vx vy) 平面不是 p1 p2 p3 平面
           ;;         (xdge::constructor "kPlane" pc (mapcar '+ pc vx) (mapcar '+ pc vy)) 正确
           ;;2 方式3  (xdge::constructor "kPlane" p1 p2 p3) 正确
           ;;3 方式4  (xdge::constructor "kPlane" pc vz)    正确
           ;;4        (xdge::constructor "kPlane" p1 vz)    任意点加Normal均可
           (setq plane (xdge::constructor
                         "kPlane"
                         (trans pc 1 0);_ WCS 坐标
                         vz
                       )
           )
           (progn
             (princ "\n")
             (princ (xdge::getpropertyvalue plane "getCoordSystem"))
             t
           )
           (setq pnt (xdge::getpropertyvalue line3d "intersectWith" plane))
      )
    (progn
      (princ "\n")
      (princ pnt)
      (xdrx_point_make pnt)
    )
  )
  (princ)
)
 
 
 |