马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 spp_wall 于 2014-1-4 21:52 编辑
- (VL-LOAD-COM)
- (or copy_reactor (setq copy_reactor (vlr-command-reactor "copy_reactor" '((:vlr-commandEnded . copy_1)))))
- (setvar "copymode" 1)
- (defun C:dtbz2 (/ p1 p2 pt1 pt2 pts mSpace Mtextobj )
- (setq mSpace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))))
- (setq p1 (getpoint "\n选择要标注的点:"))
- (setq p2 (getpoint p1 "\n选择标注文字位置:"))
- (setq pt2 (vlax-3D-point p2))
- (setq Mtextobj (vla-addMtext mSpace pt2 0.0 (strcat "X="(rtos (car p1) 2 4) "\nY="(rtos (cadr p1) 2 4))))
- (setq MtextH (*(getvar "DIMSCALE") (getvar "DIMTXT")));文字高度为当前标柱样式文字高度*全局比例
- (vlax-put-property Mtextobj 'Height MtextH)
- (vlax-put-property Mtextobj 'LineSpacingDistance (+ MtextH 1))
- (if (> (car p1) (car p2))
- (vlax-put-property Mtextobj 'AttachmentPoint 9)
- (vlax-put-property Mtextobj 'AttachmentPoint 7)
- )
- (vlax-put-property Mtextobj 'InsertionPoint pt2)
- (setq pts (vlax-make-safearray vlax-vbDouble '(0 . 5)))
- (vlax-safearray-fill pts (list (car p1)(cadr p1)(caddr p1)(car p2)(cadr p2)(caddr p2)))
- (setq leaderobj (vla-Addleader mSpace pts Mtextobj acLineWithArrow))
- (setq vlr-objgx (vlr-object-reactor (list leaderobj) "" '((:vlr-modified . gx))))
- (setq vlr-objcopy (vlr-object-reactor (list leaderobj) "" '((:vlr-copied . copy_2))))
- (princ))
- (defun copy_2 (obj vlrobj data)
- (if (/= (car data) 0)
- (setq newename (car data))))
- (defun copy_1 (vlrobj data)
- (if (wcmatch (strcase (car data)) "*COPY*")
- (progn (setq newobj (vlax-ename->vla-object newename))
- (setq vlr-objgx (vlr-object-reactor (list newobj) "" '((:vlr-modified . gx))))
- (setq vlr-objcopy (vlr-object-reactor (list newobj) "" '((:vlr-copied . copy_2))))
- (princ))))
- (defun gx (obj vlrobj data / p1 pt1 Aobj)
- (if (and (not(vlax-erased-p obj)) (setq Aobj (vlax-get-property obj 'Annotation)));判断对象是否被删除
- (progn (setq pt1 (vlax-get-property obj 'Coordinate 0))
- (setq p1 (vlax-safearray->list (vlax-variant-value pt1)))
- (vlax-put-property Aobj 'TextString (strcat "X=" (rtos (car p1) 2 4) "\nY="(rtos (cadr p1) 2 4))))));小数保持4位
现在是 x y 轴的坐标都在引线上面 怎么改成引线在两个坐标中间呢!是不是能批量标在多段线端点处?
|