Page 1 of 1

Simple lisp routine bombs.

Posted: Tue Feb 09, 2021 9:25 pm
by rhgrafix
I found a snippet that I need to keep adding letters to, it's so I can make my own font, that's the long story short:

Code: Select all

(defun c:tb ()
(setq obj (vlax-ename->vla-object (car (entsel "Pick text")))) (setq str (vlax-get obj 'textstring)) (setq x 0) (repeat (strlen str) (setq char (substr str (setq x (+ x 1)) 1 )) (cond ((= char "a" )(setq bname "Blocka" wid 1.12)) ((= char "b" )(setq bname "Blockb" wid 1.0)) ((= char "c" )(setq bname "Blockc" wid 0.85)) ((alert (strcat "Character not supported " char))) ) (princ (strcat "\n" bname " " char)) )
)
At runtime I get this after picking the text string:
error: application is locked and cannot be unloaded.

I've never seen that error before!
I make 3 blocks named Blocka, Blockb & Blockc of polyline letters a,b, & c for testing, I have a text string: "abc", when I run it, its supposed to insert the 3 blocks and look like new text.
Any ides why the error?
Thanks!

Re: Simple lisp routine bombs.

Posted: Tue Feb 09, 2021 10:48 pm
by QuanNguyen
Hi Hamn,

Please add the line :

Code: Select all

(vl-load-com)
to your lisp.

BTW, you can put your code in tag code,
Refer to below image.
codeTag.png
codeTag.png (16.11 KiB) Viewed 7214 times

Re: Simple lisp routine bombs.

Posted: Tue Feb 09, 2021 11:18 pm
by rhgrafix
Thanks Quan,
I didn't know about the </> tags for the forum.
It no longer errors but also does not insert the blocks.
There has to be another line missing or something.
Hmmmm.
Thanks

Re: Simple lisp routine bombs.

Posted: Wed Feb 10, 2021 9:30 am
by QuanNguyen
Hi Hamn,

Please check your lisp,
I did not find any function that inserting a block in your attached lisp.

Rds.

Re: Simple lisp routine bombs.

Posted: Wed Feb 10, 2021 6:22 pm
by rhgrafix
Someone else on another forum wrote it for me, I think he assumed that I know how to finish the code but I do not.
Ramon

Re: Simple lisp routine bombs.

Posted: Wed Feb 24, 2021 5:35 am
by sln8458
What are you trying to achieve?
Steve