马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 marting 于 2021-1-14 12:35 编辑
- (defun PPC-Bulge ( pt1 pt2 cen / a )
- (setq a (/ (rem (+ pi pi (- (angle cen pt2) (angle cen pt1))) (+ pi pi)) 4.0))
- (if (LM:clockwise-p pt2 cen pt1) (setq a (- a (/ pi 2.0))))
- (/ (sin a) (cos a))
- )
-
- ;; Clockwise-p - Lee Mac
- ;; Returns T if p1,p2,p3 are clockwise oriented
-
- (defun LM:clockwise-p ( p1 p2 p3 )
- (< (* (- (car p2) (car p1)) (- (cadr p3) (cadr p1)))
- (* (- (cadr p2) (cadr p1)) (- (car p3) (car p1)))
- )
- )
测试:
- (defun c:test ( / cen ocs pt1 pt2 )
- (if (and (setq pt1 (getpoint "\nStart point: "))
- (setq pt2 (getpoint "\nEnd point: " pt1))
- (setq cen (getpoint "\nCenter: "))
- (setq ocs (trans '(0 0 1) 1 0 t))
- )
- (entmake
- (list
- '(000 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- '(090 . 2)
- '(070 . 0)
- (cons 038 (caddr (trans pt1 1 ocs)))
- (cons 010 (trans pt1 1 ocs))
- (cons 042 (PPC-Bulge pt1 pt2 cen))
- (cons 010 (trans pt2 1 ocs))
- (cons 210 ocs)
- )
- )
- )
- (princ)
- )
|