马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;|
- 起点、圆心、终点圆弧拖动实现函数
- 参数:
- info ---- 提示字符串
- pj ---- 圆心
- p2 ---- 起始点
- keyWord --- 关键字字符串
- Cursor --- 光标样式
- 0 - kCrosshair
- 1 - kCrosshair
- 2 - kRubberBand
- 3 - kNoSpecialCursor
- 4 - kEntitySelect
- 5 - kParallelogram
- 6 - kInvisible
- 其他值- kPkfirstOrGrips
- |;
- (defun XD::Drag:Arc2 (info cen startPnt keyWord cursor / arcinfo dis dynpt e midp p3 pts r ret v)
- (defun EdgeCallBack (dynPt / pts)
- (setq v (mapcar
- '-
- dynPt
- cen
- )
- v (xdrx_vector_normalize v)
- r (distance cen startPnt)
- p3 (mapcar
- '+
- cen
- (xdrx_vector_product v r)
- )
- v (mapcar
- '-
- p3
- startPnt
- )
- dis (distance startPnt p3)
- v (xdrx_vector_normalize v)
- midp (mapcar
- '+
- startPnt
- (xdrx_vector_product v (/ dis 2.0))
- )
- v (mapcar
- '-
- midp
- cen
- )
- v (xdrx_vector_normalize v)
- midp (mapcar
- '+
- cen
- (xdrx_vector_product v r)
- )
- arcinfo (xdrx_geom_3P2arc startPnt midp p3)
- )
- (if (not e)
- (setq e (apply
- 'xdrx_arc_make
- (cdr arcinfo)
- )
- )
- (progn
- (if (car arcinfo)
- (xdrx_modent 10 cen 40 r 51 (nth 4 arcinfo) 50 (nth 3 arcinfo))
- (xdrx_modent 10 cen 40 r 50 (nth 4 arcinfo) 51 (nth 3 arcinfo))
- )
- )
- )
- e
- )
- (setq cen (trans cen 1 0))
- (setvar "lastPoint" cen)
- (initget 1)
- (setq ret (xdrx_drag_jig "EdgeCallBack" info keyWord (+ 1 2 4 8 16 128 512 65536) Cursor cen))
- (cond
- ((= ret -4)
- (entdel (entlast))
- )
- (t
- (if (= (type ret) 'STR)
- (progn
-
- (entdel (entlast))
- )
- )
- )
- )
- (gc)
- ret
- )
- (defun c:test-drag-arc2()
- (if (and (setq p1 (getpoint "\n圆心:"))
- (setq p2 (getpoint "\n起始点:"))
- )
- (progn
- (XD::Drag:Arc2 "\n终点[退出-Q]:" p1 p2 "Q" 0)
- )
- )
- (princ)
- )
|