乐筑天下

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

[编程交流] Lisp查找矩形的L和B

[复制链接]

3

主题

6

帖子

3

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 20:25:41 | 显示全部楼层 |阅读模式
嗨,今天的问候。
(任何人都可以)
我需要lisp来读取矩形的边,以便使我的对象平行于选定矩形的长边。
 
谢谢和问候,
@bhi。
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-5 20:47:35 | 显示全部楼层
你看过ALIGN命令了吗?
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 21:25:24 | 显示全部楼层
另一个是UCS OB,如果说插入旋转为零,则文本的旋转为零,然后UCS W
 
如果你真的需要得到顶点,你需要看距离1-2和2-3来计算更长的距离,但即使这样,你也可能得到顶部而不是底部。
 
  1. (defun plcords (/ ent obj plobs )
  2. (vla-load-com)
  3. (defun getcoords (ent)
  4. (vlax-safearray->list
  5.    (vlax-variant-value
  6.      (vlax-get-property
  7.    (vlax-ename->vla-object ent)
  8.    "Coordinates"
  9.      )
  10.    )
  11. )
  12. )
  13. (defun co-ords2xy ( / I)
  14. ; 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
  15. (setq numb (/ (length co-ords) 2))
  16. (setq I 0)
  17. (repeat numb
  18. (setq xy (list (nth (+ I 1) co-ords)(nth I co-ords) ))
  19. (setq coordsxy (cons xy coordsxy))
  20. (setq I (+ I 2))
  21. ) ; end repeat
  22. )
  23. (setq plobjs (ssget (list (cons 0 "lwpolyline"))))
  24. (setq numb1 (sslength plobjs))
  25. (setq x numb1)
  26. (repeat numb1
  27. (setq obj (ssname plobjs (setq x (- x 1))))
  28. (setq co-ords (getcoords obj))
  29. )
  30. (co-ords2xy)
  31. (setq inc (length coordsxy))
  32. (repeat (/ inc  2)
  33. (setq x (rtos (nth (setq inc (- inc 1)) co-ords) 2 3 ))
  34. (setq y (rtos (nth (setq inc (- inc 1)) co-ords) 2 3 ))  
  35. (setq xy (strcat x "," y ))
  36. (princ xy)
  37. (princ "\n ")
  38. )
  39. )
  40. (plcords)
回复

使用道具 举报

3

主题

6

帖子

3

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 21:28:29 | 显示全部楼层
谢谢你,先生,
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 09:08 , Processed in 0.457011 second(s), 60 queries .

© 2020-2025 乐筑天下

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