乐筑天下

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

[编程交流] [Lisp] Request for help with l

[复制链接]

46

主题

161

帖子

104

银币

后起之秀

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

铜币
242
发表于 2022-7-5 17:48:47 | 显示全部楼层 |阅读模式
Some time ago I wrote a lisp routine for circles numbering.
 
Now it's time to make some upgrades, but i need some help.
  1. (vl-load-com);circle numbering;author ziele_o2k;2016-03-13(defun c:numbering ( / points ptlist num wt rad)  (setq      points (ssget '((0 . "CIRCLE")))      i 0  )  (repeat (sslength points)     (setq         c (trans (cdr (assoc 10 (entget (ssname points i)))) 0 1)        i (1+ i)     )     (cond        ((= ptlist nil) (setq ptlist (list c)))        ((/= ptlist nil) (setq ptlist (cons c ptlist)))     )  )  (setq ptlist      (vl-sort ptlist         '(lambda (x y)           (cond              ((= (cadr x)(cadr y))(< (car x)(car y)))              ((> (cadr x)(cadr y)))           )        )     )  )  (setq num (getint "\nStart number: "))  (setq wt (getreal "\ntext height: "))  (if (> wt 0)     (mapcar         '(lambda (%)           (cd:ENT_MakeText "Model" (rtos num) % wt 0)           (setq num (1+ num))        )        ptlist     )     (princ "\nWrong text height.")  )  (princ));------------------;Part from CAD Pack;http://forum.cad.pl/cadpl-pack-v1-lsp-t78161.html(defun cd:ENT_MakeText (Layout Str Pb Height Rot / zdir xang) (setq zdir (trans '(0 0 1) 1 0 T)       xang (angle '(0 0 0) (trans (getvar "UCSXDIR") 0 zdir)) ) (entmakex   (list     (cons 0 "TEXT")     (cons 1 Str)     (cons 10 (trans Pb 1 zdir))     (cons 40 Height)     (cons 50 (+ Rot xang))     (cons 210 zdir)     (cons 410 Layout)   ) ))
What I would like to achive:
 
1) Add the ability to determine the tolerance of coordinates with which circles are numbered (something simmilar to tolerance in overkill function), eg in the attached dwg last two columns are a bit "higher" and with my current sorting function for list with coordinates, number 1 is at the penultimate column.
I would like to detrmine the tolerance of y coordinate  (ultimately also in the x direction) so that the number 1 would be the most to the left.
In the attached example it is exaggerated, but sometimes it happens that one of the numbered circles is shifted by 0.0001 and then the whole numbering is falling apart and I have to make changes in drawing (with hundreds of circles is a bit of a annoying).
 
2) Another problem to be solved is the case when two or more circles are drawn in the same position (see in the example file). In this case, I would like to achive that routine will add only one number and give a list with numbers and coordinates of duplicated circles.
It would be good if I could determine accuracy of checking the coordinates like in problem 1).
 
thank you in advance for any help
Example.dwg
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 23:57 , Processed in 0.584874 second(s), 54 queries .

© 2020-2025 乐筑天下

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