乐筑天下

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

[编程交流] 从Pline到替换tex的区域

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 06:29:57 | 显示全部楼层 |阅读模式
我需要一些帮助来解决lisp例程的问题。cad2009早期版本中的常规工作在2013年将不起作用。
在拾取多段线后,我试图用平方英尺的面积替换文字值。我只能用平方英寸替换文字。
 
  1. [font=Times New Roman][size=3][/size][/font]
  2. [font=Calibri];;;CADDMAN: Area7.LSP    Area Output (c) 2007 Kirby Turner [/font]
  3. [font=Times New Roman][size=3][/size][/font]
  4. [font=Calibri](defun c:area7 (/ a1)[/font]
  5. [font=Times New Roman][size=3][/size][/font]
  6. [font=Calibri](SETQ A1 (ENTSEL "Area of tract<pickobject>: "))[/font]
  7. [font=Times New Roman][size=3][/size][/font]
  8. [font=Calibri](command "area" "e" a1)[/font]
  9. [font=Times New Roman][size=3][/size][/font]
  10. [font=Calibri](setq el (getvar "area"))[/font]
  11. [font=Times New Roman][size=3][/size][/font]
  12. [font=Calibri](setq d1 144)[/font]
  13. [font=Times New Roman][size=3][/size][/font]
  14. [font=Calibri]                        (setqfl (rtos (el 2 2))[/font]
  15. [font=Times New Roman][size=3][/size][/font]
  16. [font=Calibri]                        (setqe1 ( / f1 d1)[/font]
  17. [font=Times New Roman][size=3][/size][/font]
  18. [font=Calibri]                        ;;;(rtos(/ e1 144.0) 2 3)[/font]
  19. [font=Times New Roman][size=3][/size][/font]
  20. [font=Calibri];;;(rtos (/ e1 144.0) 2 3)[/font]
  21. [font=Times New Roman][size=3][/size][/font]
  22. [font=Calibri]  (SETQED(ENTGET (CAR (NENTSEL "\nPick TEXT to change:"))))[/font]
  23. [font=Times New Roman][size=3][/size][/font]
  24. [font=Calibri]     (setvar"CMDECHO" 0)[/font]
  25. [font=Times New Roman][size=3][/size][/font]
  26. [font=Calibri]     (COMMAND"TEXTEVAL" 1)[/font]
  27. [font=Times New Roman][size=3][/size][/font]
  28. [font=Calibri]  (SETQ ED(SUBST (cons 1 e1)[/font]
  29. [font=Times New Roman][size=3][/size][/font]
  30. [font=Calibri]                (ASSOC 1 ED)[/font]
  31. [font=Times New Roman][size=3][/size][/font]
  32. [font=Calibri]               ED[/font]
  33. [font=Times New Roman][size=3][/size][/font]
  34. [font=Calibri]   )[/font]
  35. [font=Times New Roman][size=3][/size][/font]
  36. [font=Calibri])[/font]
  37. [font=Times New Roman][size=3][/size][/font]
  38. [font=Calibri](ENTMOD ED)[/font]
  39. [font=Times New Roman][size=3][/size][/font]
  40. [font=Calibri])[/font]
  41. [font=Times New Roman][size=3][/size][/font]
  42. [font=Calibri](alert[/font]
  43. [font=Times New Roman][size=3][/size][/font]
  44. [font=Calibri]  (strcat"area7.LSP"[/font]
  45. [font=Times New Roman][size=3][/size][/font]
  46. [font=Calibri]         "\n\n Type area7 to start"))[/font]
  47. [font=Times New Roman][size=3][/size][/font]
  48. [font=Calibri](princ)[/font]
  49. [font=Times New Roman][size=3]
  50. [/size][/font]
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 06:44:18 | 显示全部楼层
我有这个
;获取区域。lsp-选定多段线图元的总面积。
 
  1. (defun C:GetArea()
  2. ;turn off the system echo
  3. (setvar "cmdecho" 0)
  4. ;set up a variable to hold the accumulated areas
  5. (setq myArea 0)
  6. ;while the user keeps making a selection
  7. (while(setq ent(entsel))
  8.    ;if an entity was selected and not a point in space     
  9.    (if(car ent)
  10.       (progn
  11.          ;let AutoCAD get the area of the object...cheap yet effective way out...
  12.          ;Note: AutoCAD stores the area in the system variable "Area"
  13.          (command "area" "Object" (car ent))
  14.          ;print the area to the command line
  15.          (princ (strcat "\n Ε = " (rtos (getvar "Area") 2 2)" sq.m"))
  16.          ;accumulate the area if it exist
  17.          (if (getvar "Area")(setq myArea(+ myArea (getvar "Area"))))
  18.       )
  19.    )
  20. )
  21. ;ask for a text insertion point
  22. (setq pt1(getpoint "\n pick a point: "))
  23. ;print the area in the drawing
  24. (command "text" pt1 "" "" (strcat "E = "(rtos myArea 2 2)" sq.m"))
  25. ;suppress the last echo
  26. (princ)
  27. )
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 06:55:55 | 显示全部楼层
我有acad2012
回复

使用道具 举报

11

主题

968

帖子

919

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
99
发表于 2022-7-6 07:17:33 | 显示全部楼层
你试过看这幅画的单位吗?也可以使用cvunits功能,而不仅仅是手动乘法/除法。
 
否则,你可以尝试其他各种例程,从许多在这些论坛(和其他论坛)上提供了他们的代码-只要做一个搜索,我相信你应该能够得到一些东西。E、 g.我的DimArea命令实际上在文本对象内放置了一个自动更新字段,该字段可以通过添加和/或减去多条多段线/图案填充等组成。
回复

使用道具 举报

0

主题

61

帖子

62

银币

限制会员

铜币
-1
发表于 2022-7-6 07:19:05 | 显示全部楼层
你需要在LISP中这样做吗?到2012年,我认为fields是一种更好的方法。
 
dJE
回复

使用道具 举报

5

主题

1074

帖子

1088

银币

初来乍到

Rank: 1

铜币
9
发表于 2022-7-6 07:33:48 | 显示全部楼层
欢迎来到CADTutor。我倾向于同意,这可以很容易地在一个战场上完成,并且-dwgunits司令部可能会对报告该地区的部队有所了解。如果你真的想lisp,李Mac有至少3个不同的处理面积函数,其中这个链接将带你到一个。。。http://www.lee-mac.com/arealabel.html  . 谢谢李!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 15:34 , Processed in 0.347583 second(s), 64 queries .

© 2020-2025 乐筑天下

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