- UID
- 675606
- 积分
- 3400
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-5-6
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
成功原位纠正圆的210组码,形状位置不变。其它的还没有搞定
- (defun C:ww (/ E EN)
- ;;不考虑块和文字,块可以先爆破
- (setq e (car (entsel)))
- (setq en (entget e))
- ;;改变210,视觉位置可能移动
- (entmod (subst '(210 1 1 1) (assoc 210 en) en))
- ;;画一方框,用于观察纠正后位置有没移动
- (setq obj (vlax-ename->vla-object e))
- (vla-GetBoundingBox obj 'll 'uu)
- (setq ll (safearray-value ll))
- (setq uu (safearray-value uu))
- (command "_.rectang" ll uu)
-
- ;;纠正210,使形状和位置不变
- (_RemainShape e)
- (princ)
- )
- ;;下面实体支持非等比例:
- ;;(wcmatch str "AcDbLeader,AcDbMLine,AcDbMText,AcDbOle2Frame,AcDbPloyFaceMesh,AcDbPolygonMesh,AcDbRay,AcDbXline,AcDbFcf,AcDbSolid,AcDbEllipse,AcDbSpline,AcDbImage")
- (defun _RemainShape (e / ANG CMDECHO EN L LL NAME OBJ OSMODE P0 P1 P210 UU X Y)
- (setq en (entget e))
- (setq p210 (cdr (assoc 210 en)))
- (if (not (equal '(0.0 0.0 1.0) p210))
- (progn
- ;;L*直径后,投影后的短轴长度
- (setq L (sqrt (- 1 (* (car p210)(car p210)) (* (cadr p210)(cadr p210)))))
- ;;投影后长轴与X夹角
- (setq ang (atan (/ (car p210) (cadr p210))))
-
- (setq osmode (getvar "osmode"))
- (setq cmdecho (getvar "cmdecho"))
- (Setvar "cmdecho" 0)
- (Setvar "osmode" 0)
- ;;求块插入 中心点
- (setq obj (vlax-ename->vla-object e))
- (vla-GetBoundingBox obj 'll 'uu)
- (setq ll (safearray-value ll))
- (setq uu (safearray-value uu))
- (setq p0 (mapcar '(lambda (x y) (* (+ x y) 0.5)) ll uu))
- (setq p0 (mapcar '+ '(0 0) p0)) ;3D=>2D
- ;;制作块;采用entmake,command、vla-insertblock失败
- (entmod (subst '(210 0 0 1) (assoc 210 en) en));纠正
- (vla-GetBoundingBox obj 'll 'uu)
- (setq ll (safearray-value ll))
- (setq uu (safearray-value uu))
- (setq p1 (mapcar '(lambda (x y) (* (+ x y) 0.5)) ll uu))
- (setq p1 (mapcar '+ '(0 0) p1))
- (entmake
- (list '(0 . "BLOCK")
- '(2 . "*U")
- '(70 . 1)
- (cons 10 p1)
- )
- )
- (entmake (entget e))
- ;;(command "_.BLOCK" "*U" "non" p0 e "")不能用于无名块
- (setq name (entmake '((0 . "ENDBLK"))))
-
- (entmake (list '(0 . "INSERT")
- (cons 2 name)
- (cons 10 p0)
- (cons 41 L)
- (cons 42 1)
- (cons 43 1)
- (cons 50 ang)
- '(210 0 0 1)
- )
- )
- (vl-cmdf "._explode" "L")
- (vla-delete obj) ;删除
-
- (or *ACAD* (setq *ACAD* (vlax-get-acad-object)))
- (or *DOC* (setq *DOC* (vla-get-ActiveDocument *ACAD*)))
- ;;(vla-delete (vla-item (vla-get-blocks *DOC*) name));清除块
- (Setvar "cmdecho" cmdecho)
- (Setvar "osmode" osmode)
- )
- )
- )
|
|