乐筑天下

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

[编程交流] 更改文本LISP例程

[复制链接]

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 06:59:55 | 显示全部楼层
 
No... I meant my performance (fat-finger typing).
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:01:37 | 显示全部楼层
Thanks for the help. It worked perfectly until I added a few more parameters.
Now I get an error when I try to load it.

[code](defun c:ghj  (/ enx idx sel str f n _Str)     (if (setq sel (ssget "_X"                          '((0 . "TEXT,MTEXT")                            (1 . "*VERTICAL BEND"))))           (repeat (setq idx (sslength sel))                 (setq enx  (entget (ssname sel (setq idx (1- idx))))                       str  (assoc 1 enx)                       _str (Cdr str))                 (setq f nil                       n 16)                 (while (and (not f) (> n -1))                       (setq f    (vl-some                                        '(lambda (k)                                               (if   (wcmatch                                                           _str                                                           (strcat                                                                 k                                                                 "*VERTICAL BEND"))                                                          (atoi k)))                                        (list (itoa n)                                              (if (zerop n)                                                    "-0"                                                    (itoa (- n))))))                       (setq n (1- n))                       )                 (if (setq nstr                                (cond                                      ((or (
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 07:04:11 | 显示全部楼层
Denverado.
 
I have to say, you only replied when you hit a snag otherwise we would've never known how helpful we are here.
 
Anyhoo. initial observation is too many closing parenthesis on the cond line.

[code](setq nstr (cond  ((or (
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 07:09:18 | 显示全部楼层
 
One more issue , the space between the equal operator and the number 39
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 07:12:43 | 显示全部楼层
 
guess you are right tharwat.. still not sure if it will work. Am too lazy to debug and try the code.
 
Cheers Tharwat
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:15:58 | 显示全部楼层
Thanks everyone for your help.
I was on holidays.... that's why I never responded until I did.
You have all been very helpful.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 07:18:11 | 显示全部楼层
 
Wow, that explains it, Good for you.  Now did you made it work with the changes on the code?
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:22:23 | 显示全部楼层
Sorry pBe..... Stuck on site for the last week.
I couldn't get it to work.
the "22.5 vertical bend" and "45vvertical bend" did not work.

[code](defun c:ghj  (/ enx idx sel str f n _Str)     (if (setq sel (ssget "_X"                          '((0 . "TEXT,MTEXT")                            (1 . "*VERTICAL BEND"))))           (repeat (setq idx (sslength sel))                 (setq enx  (entget (ssname sel (setq idx (1- idx))))                       str  (assoc 1 enx)                       _str (Cdr str))                 (setq f nil                       n 16)                 (while (and (not f) (> n -1))                       (setq f    (vl-some                                        '(lambda (k)                                               (if   (wcmatch                                                           _str                                                           (strcat                                                                 k                                                                 "*VERTICAL BEND"))                                                          (atoi k)))                                        (list (itoa n)                                              (if (zerop n)                                                    "-0"                                                    (itoa (- n))))))                       (setq n (1- n))                       )                 (if (setq nstr (cond  ((or (
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 07:24:42 | 显示全部楼层
Again here:
  1. (setq f nil n [b]51[/b])
 
I noticed you skipped 29 to 38? why is that? and if it should be included what is the new string then?
 
EDIT:

[code](defun c:ghj  (/ enx idx sel str f n _Str)(if (setq sel (ssget "_X"  '((0 . "TEXT,MTEXT")                            (1 . "*VERTICAL BEND[color="blue"],*HORIZONTAL BEND"))))           (repeat (setq idx (sslength sel))                 (setq enx  (entget (ssname sel (setq idx (1- idx))))                       str  (assoc 1 enx)                         _str (Cdr str))                 (setq f nil  n[color="blue"] 51)          [color="blue"] (if (wcmatch _str "*HORIZONTAL BEND")               (entmod (append enx (list (cons 8 "Defpoints"))))               (progn                  (while (and (not f) (> n -1))                       (setq f (vl-some                                        '(lambda (k)                                               (if   (wcmatch                                                           _str                                                           (strcat                                                                 k                                                                 "*VERTICAL BEND"))                                                          (atoi k)))                                        (list (itoa n)                                              (if (zerop n)                                                    "-0"                                                    (itoa (- n))))))                       (setq n (1- n))                       )                 (if  (and f                      (setq nstr (cond  ((or (
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:25:51 | 显示全部楼层
Thanks pBe,
I ended up doing the following to make it work right.

[code](defun c:ghj  (/ enx idx sel str f n _Str)     (if (setq sel (ssget "_X"                          '((0 . "TEXT,MTEXT")                            (1 . "*VERTICAL BEND"))))           (repeat (setq idx (sslength sel))                 (setq enx  (entget (ssname sel (setq idx (1- idx))))                       str  (assoc 1 enx)                       _str (Cdr str))                 (setq f nil                       n 92)                 (while (and (not f) (> n -1))                       (setq f    (vl-some                                        '(lambda (k)                                               (if   (wcmatch                                                           _str                                                           (strcat                                                                 k                                                                 "*VERTICAL BEND"))                                                          (atoi k)))                                        (list (itoa n)                                              (if (zerop n)                                                    "-0"                                                    (itoa (- n))))))                       (setq n (1- n))                       )                 (if (setq nstr (cond  ((or (
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:26 , Processed in 1.308456 second(s), 70 queries .

© 2020-2025 乐筑天下

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