BlackBox 发表于 2022-7-6 06:59:55

 
No... I meant my performance (fat-finger typing).

denverado 发表于 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.

(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 发表于 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.

(setq nstr (cond((or (

Tharwat 发表于 2022-7-6 07:09:18

 
One more issue , the space between the equal operator and the number 39

pBe 发表于 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

denverado 发表于 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 发表于 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?

denverado 发表于 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.

(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 发表于 2022-7-6 07:24:42

Again here:

(setq f nil n 51)
 
I noticed you skipped 29 to 38? why is that? and if it should be included what is the new string then?
 
EDIT:

(defun c:ghj(/ enx idx sel str f n _Str)(if (setq sel (ssget "_X"'((0 . "TEXT,MTEXT")                            (1 . "*VERTICAL BEND,*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 niln 51)          (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 (

denverado 发表于 2022-7-6 07:25:51

Thanks pBe,
I ended up doing the following to make it work right.

(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 (
页: 1 [2]
查看完整版本: 更改文本LISP例程