乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 35|回复: 4

[编程交流] 更改标注文字移动

[复制链接]

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 02:30:21 | 显示全部楼层 |阅读模式
在放置连续标注以使用标注文字移动尺寸线后,我试图更改文字移动。我假设需要将维度的变量dimtmove设置为0,但我不确定这是否是正确的方法。我想我记得看到过类似的东西,但唉,我可以再次找到链接。任何帮助都将不胜感激。
 
  1. (defun c:cdim ( / pt1 pt2)
  2. ;This function allows the user to dimension continuously and then after they are done insert the overall distance
  3. (command "dimlinear" pause pause pause);start the first dimension
  4. (setq pt1 (cdr (assoc 13(entget (entlast)))));get the start point
  5. (command "dimcontinue");dimension everything in between start and end
  6. (while (/= (getvar "CMDACTIVE") 0);keep the dimcontinue going until user exits
  7. (command pause)
  8. (setq obj (vlax-ename->vla-object (car (entsel (entlast)))));start here to try and change dimtmove
  9. (vlax-put obj 'Dimtmove 0)
  10. )
  11. (setq pt2 (cdr (assoc 14(entget (entlast)))));get end point from last dimcontinue inserted
  12. (command "dimlinear" pt1 pt2 pause);place the overall dimension
  13. )
回复

使用道具 举报

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 02:56:52 | 显示全部楼层
谢谢
 
它非常接近,但由于某些原因,在选择下一个点后,将删除除最后一个维度外的所有连续维度。我想我可以在while循环中获得实体名称,然后在退出while循环后启动另一个循环来更改它们,但肯定有更直接的方法。
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 03:15:02 | 显示全部楼层
欢迎来到cadTutor
 
试试这个,希望你喜欢。。。
 
  1. (defun c:cdim (/ pt1 pt2 e p pt obj)
  2. (command "_.dimlinear" pause pause pause)
  3. (if (eq (cdr (assoc 0 (setq e (entget (entlast))))) "DIMENSION")
  4.    (setq pt1 (cdr (assoc 13 e))
  5.          pt  (cdr (assoc 14 e))
  6.    )
  7. )
  8. (while (setq p (getpoint pt "\n Specify next point :"))
  9.    (command "_.dimlinear"
  10.             "_none"
  11.             pt
  12.             "_none"
  13.             p
  14.             (cdr (assoc 10 e))
  15.    )
  16.    (vlax-put (vlax-ename->vla-object (setq obj (entlast)))
  17.              'textmovement
  18.              0
  19.    )
  20.    (setq pt (cdr (assoc 14 (entget obj))))
  21. )
  22. (setq pt2 (cdr (assoc 14 (entget obj))))
  23. (command "_.dimlinear" "_none" pt1 "_none" pt2 pause)
  24. )
回复

使用道具 举报

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 03:17:05 | 显示全部楼层
实际上,我也想过这样做,只使用dimlinear命令,然后使用第一个文字偏移点偏移尺寸,但不能继续使用第一个文字点,因为尺寸将以最短的距离延伸到该点,因此可以得到如下所示的结果。我不知道我会经常遇到这种情况,但为了它的多功能性,我想防止这种情况。
033027vhpmpzaoxlaojnuw.png
回复

使用道具 举报

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 03:33:14 | 显示全部楼层
好吧,我基本上都明白了。最后只需要一个摄政王。我希望在放置每个continue维度后重新生成,但我现在会接受它,直到我有几天以上的自动/视觉lisp经验为止
 
  1. (defun c:cdim (/ pt1 pt2 doc )
  2. ;This function allows the user to dimension continuously and then after they are done insert the overall distance
  3. (vl-load-com);load visual lisp
  4. (setq doc (vla-get-ActiveDocument(vlax-get-acad-object)))
  5.    (vla-put-ActiveUCS doc(vla-add (vla-get-usercoordinatesystems doc) (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point '(1. 0. 0.))
  6.          (vlax-3D-point '(0. 1. 0.)) "TempWorld_UCS"))
  7. (command "_UCS" "NA" "r" "TempWorld_UCS")
  8. ;change the UCS to world so the final dimension will insert correctly
  9. (command "dimlinear" pause pause pause);start the first dimension
  10. (setq pt1 (cdr (assoc 13(entget (entlast)))));get the start point
  11. (command "dimcontinue");dimension everything in between start and end
  12. (while (/= (getvar "CMDACTIVE") 0);keep the dimcontinue going until user exits
  13. (command pause)
  14. (vlax-put (vlax-ename->vla-object (setq obj (entlast))) 'textmovement 0)
  15. )
  16.         (command "regen")
  17.         (setq pt2 (cdr (assoc 14(entget (entlast)))));get end point from last dimcontinue inserted
  18.         (command "dimlinear" pt1 pt2 pause);place the overall dimension       
  19.    
  20. )
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 22:36 , Processed in 0.350034 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表