乐筑天下

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

[编程交流] 文字作为层包围cl

[复制链接]

18

主题

44

帖子

26

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 13:14:00 | 显示全部楼层 |阅读模式
亲爱的助手们:,
 
我需要一个lisp,它应该从选定多边形内的文本创建层,并将这些层应用于自包围多边形。
 
请看一下随附的图片和图纸,以便更好地理解。
 
当做
T、 婆罗门南丹
141404wteoroqvto6qakwp.jpg
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 13:36:21 | 显示全部楼层
这很接近,我想人们会有一个尝试,而不仅仅是让别人完成答案,它需要删除几行,并用层替换“textstring”,接近尾端的写行更改为(vla put layer obj anstext)尝试一下,如果它不起作用,我们在这里提供帮助。
 
  1. (defun getcoords (ent)
  2.   (vlax-safearray->list
  3.     (vlax-variant-value
  4.       (vlax-get-property
  5.     (vlax-ename->vla-object ent)
  6.     "Coordinates"
  7.       )
  8.     )
  9.   )
  10. )
  11.  
  12. (defun co-ords2xy ()
  13. ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
  14. (setq numb (/ (length co-ords) 2))
  15. (setq I 0)
  16. (repeat numb
  17. (setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) ))
  18. (setq coordsxy (cons xy coordsxy))
  19. (setq I (+ I 2))
  20. ) ; end repeat
  21. ) ; end defun
  22. ; program starts here
  23. ; choose output file change acdatemp to what you want
  24. (setq fname (strcat "c:/acadtemp/" (getstring "\nEnter file name ")))
  25. (setq fout (open fname "w"))
  26. (setq plobjs (ssget (list (cons 0 "lwpolyline"))))
  27. (setq numb1 (sslength plobjs))
  28. (setq x numb1)
  29. (repeat numb1
  30. (setq obj (ssname plobjs (setq x (- x 1))))
  31. (setq co-ords (getcoords obj))
  32. (co-ords2xy)
  33. ; write pline co-ords here
  34. (setq numb3 (length co-ords))
  35. (setq z numb3)
  36. (setq ansco-ords "")
  37. (repeat numb3 
  38. (setq ansco-ords (strcat ansco-ords (rtos (nth (setq z (- z 1)) co-ords) 2 3 ) " " ))
  39. )
  40. (setq ans (strcat "Pline " ansco-ords))
  41. (write-line ans fout)
  42. (setq ansco-ords "")
  43. (setq ss (ssget "WP" coordsxy (list (cons 0 "Text,Mtext")))) ; selection set of text within polygon
  44. (if (= ss nil) 
  45. (princ "\nnothing inside")
  46. (progn 
  47. (setq coordsxy nil) ; reset for next time
  48. (setq numb2 (sslength ss))
  49. (setq y numb2)
  50. (repeat numb2
  51. (setq anstext (vlax-get-property (vlax-ename->vla-object (ssname ss (setq y (- y 1)))) "Textstring"))
  52. (princ anstext) ; change to write text to file
  53. (write-line (strcat "text " anstext) fout)
  54. (princ "\n")
  55. ) ; end repeat2
  56. (setq ss nil) ; reset for next poly
  57. )
  58. )
  59. ) ; end repeat1
  60. (close fout)
  61. (princ)

 
回复

使用道具 举报

18

主题

44

帖子

26

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 13:57:33 | 显示全部楼层
谢谢你,先生
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2022-7-5 14:04:54 | 显示全部楼层
那么,哪个答案更有效?这根线还是这里。
回复

使用道具 举报

18

主题

44

帖子

26

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 14:27:34 | 显示全部楼层
我用过红色的,先生。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-15 00:47 , Processed in 2.989610 second(s), 65 queries .

© 2020-2025 乐筑天下

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