| 
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
     (defun c:tt1 (/ e ge gelst gelst1 ge1 ge2 ptl pts)
  (if (and (setq
             e1        (xdrx_entsel "\nPick Curve: " '((0 . "LWPOLYLINE")))
           )
           (setq ge (xdge::constructor (car e1)))
      )
    (progn
      (setq gelst (xdge::getpropertyvalue ge "getCurveList"));_pline 每段 Ge 列表
      (while gelst
        (setq ge1    (car gelst)
              gelst  (cdr gelst)
              gelst1 gelst
        )
        (while gelst1
          (setq ge2 (car gelst1))
          (setq        gcc (xdge::getpropertyvalue
                      ge1
                      "getClosestPointTo"
                      ge2
                    );_两 Ge 间最近点 PointOnCurve 
                pts (mapcar '(lambda (x) (xdge::getpropertyvalue x "Point"))
                            gcc
                    );_取出 PointOnCurve 的 Point
          )
          (if (and
                (not (equal (car pts) (cadr pts) 1e-3));_不能是 Pline 的顶点
                (= (xdrx_point_getRelationAtClosedCurve
                     (apply 'xdrx_line_midp pts)
                     (car e1)
                   )
                   2
                );_中点在 Pline  内部
                (setq lineSeg3d        (xdge::constructor
                                  "kLineSeg3d"
                                  (car pts)
                                  (cadr pts)
                                )
                );_构造一个 AcGeLineSeg3d
                (setq gcc
                       (xdge::constructor "kCurveCurveInt3d" ge lineSeg3d)
                );_构造一个 相交对象
                (= (xdge::getpropertyvalue gcc "numIntPoints") 2);_该相交对象只有两个交点即 LineSeg3d 的两个端点
              )
            (setq ptl (cons pts ptl))
          )
          (setq gelst1 (cdr gelst1))
        )
      )
      (xdrx_entity_setcolor
        (apply
          'xdrx_line_make
          (car
            (vl-sort ptl
                     '(lambda (x1 x2)
                        (< (apply 'distance x1) (apply 'distance x2))
                      )
            );_取出最短距离点对
          )
        )
        1
      )
    )
  )
  (xdge::free)
  (princ)
)
 |