乐筑天下

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

[编程交流] Coding Help - Adding numbers t

[复制链接]

1

主题

5

帖子

4

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 15:50:50 | 显示全部楼层
Works great.  Could you show me how to make it work with all the text in the drawing and not just a selection set?  Thanks.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 15:52:48 | 显示全部楼层
Change "_:L" to "_X"  
 
Nice one Alan
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 15:56:28 | 显示全部楼层
 
 
There you go.  Know that if you change to all, locked layers will NOT be filtered out and it will error if it tries to edit text on a locked layer.
 
 
Thanks Lee.
回复

使用道具 举报

6

主题

249

帖子

247

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 16:00:40 | 显示全部楼层
 
 
Perfect, thx, S
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 16:02:38 | 显示全部楼层
Perfect that I realize and admit to being a retard?
 
You're welcome.
回复

使用道具 举报

2

主题

14

帖子

12

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 16:05:58 | 显示全部楼层
Alan,
I have been trying to modify this code to add a user input elevation to the selected elevation, but I haven't been able to make it work.  If it isn't too time-consuming, could you look at the code below (modified from your code), and suggest corrections as required?  My elevations will be in the form of "El. xxx'-xx" ", without the outer quotation marks.  The number of digits in the feet and in the inches may change.
Thank you.
 
 
  1. (defun c:AddElevations (/ ss ent s num addelev);addelev added by SLB(and   (setq AddElev (getdist "\n Enter Elevation to Add: "));;setq addelev added by SLB   (setq ss (ssget "_:L" '((0 . "TEXT") (1 . "EL.*"))))   ((lambda (i)      (while (setq e (ssname ss (setq i (1+ i))))        (setq ent (entget e)s   (cdr (assoc 1 ent))num (substr s (+ 3 (vl-string-search "." s)) (+ (vl-string-search "'" s) 3));substring parameters and search string changed by SLB)        (entmod (subst (cons 1 (vl-string-subst (rtos (+ AddElev (atof num))) num s));AddElev variable substituted for fixed number by SLB(assoc 1 ent)ent))      ))     -1   )) (princ))
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 16:10:14 | 显示全部楼层
That's a long time to have been a member and only posted for the first time today.
回复

使用道具 举报

2

主题

14

帖子

12

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 16:12:18 | 显示全部楼层
I think I had some trouble logging into the forum for a while.  (Misplaced my password or something after an OS reinstall.)  I refer to AutoDesk's Discussion Groups for a lot of my Lisp referencing needs, and have posted there quite a bit requesting and sometimes even providing some help.  I've been referencing this forum for the last couple of months quite heavily.  I sure appreciate your posts and LeeMac's, in particular, although there a lot of other great contributors here, as well.  I've been "dabbling" in Lisp for a number of years now, but I haven't grasped the "weightier" concepts.  I barely manage to eek out some short "macros" more than fully developed programs.  I love to see (and use, when possible) the great stuff on this and other forums that I tend to watch as much as possible.
 
Was my request something "do-able", or was the program which I was trying to adapt not the best way to solve the problem?  I think I may have a Lisp program that does something similar to what I requested, but I liked the Visual Lisp.  Unfortunately, I'm really poor with the Visual Lisp.
 
Thanks, Alan !!
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 16:14:46 | 显示全部楼层
Ehh, WTH...
 
  1. (defun c:Add (/ toNum toStr ss add) ;; Alan J. Thompson, 11.04.10 (defun toNum (str)   (+ (atof (substr str 4)) (/ (atof (substr str (+ 2 (vl-string-search "-" str)))) 12.)) ) (defun toStr (num)   (strcat "EL." (rtos num 2 0) "'-" (rtos (* 12. (rem num (fix num))) 2 0) """) ) (if (and (setq ss (ssget "_:L" '((0 . "TEXT") (1 . "EL.*'-*""))))          (setq add (getdist "\nSpecify number to add: "))     )   ((lambda (i / e d)      (while (setq e (ssname ss (setq i (1+ i))))        (entmod (subst (cons 1 (toStr (+ add (toNum (cdr (assoc 1 (setq d (entget e))))))))                       (assoc 1 d)                       d                )        )      )    )     -1   ) ) (princ))
回复

使用道具 举报

2

主题

14

帖子

12

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 16:17:28 | 显示全部楼层
Thank you, Alan !!  That was unbelievably quick ! "Forum Deity", you are !
 
I didn't get the results that I expected with the elevations that I tested on, but I will continue to look at your post and see if I can understand it enough to make changes.  It may be units settings or something that may be giving us different results, perhaps?  Anyway, this wasn't a program that I needed at this time, but rather, an example that I hoped to learn from.  I'll do some more study and see what I can come up with.
 
Thanks, again !!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-14 13:04 , Processed in 0.923781 second(s), 70 queries .

© 2020-2025 乐筑天下

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