LISP add a space to output

LISP add a space to output

ryan.rettig
Participant Participant
2,233 Views
5 Replies
Message 1 of 6

LISP add a space to output

ryan.rettig
Participant
Participant

I have a LISP file i use for line numbers in my single line drawings. I would like to add a space before the number out put example below. 

Currently I input the suffix like N -, i then get prompted for the starting number so example 101, its current out put would be N -101. I would like to change the file so it automatically adds a space between the suffix and the starting number.  

Thanks

0 Likes
Accepted solutions (1)
2,234 Views
5 Replies
Replies (5)
Message 2 of 6

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I would like to change the file

No file attached.

If that lisp code works only with some specific dwg-structure or objects then a sample dwg-file would be great too.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 6

ryan.rettig
Participant
Participant

sample.PNG

In the picture above i would type in the command for the LISP, it would prompt for a suffix in this case i put C- *enter* then it prompts for starting number 101 *enter* i then click the attributes or text i want to change. Currently it outputs like C -101 i would like to put a space between the suffix and prefix. 

0 Likes
Message 4 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

[That's the prefix, not the suffix, but in any case....]

 

Change this:

 

(setq curStr(strcat rnm:Pref(itoa rnm:Start)))

 

to this:

 

(setq curStr (strcat rnm:Pref " " (itoa rnm:Start)))

 

But bear in mind that it will add that space in any usage of the routine, so you might want to make a separate one for when you want the space added, if you would ever want the capability of not  adding the space.

Kent Cooper, AIA
Message 5 of 6

Moshe-A
Mentor
Mentor

Rayn,

 

if you add the space you want in respond to the prefix prompt then you would get exactly want you want - no?!

 

moshe

 

0 Likes
Message 6 of 6

ryan.rettig
Participant
Participant

with how this LISP works it does not if i did the prefix and added a space or even a space before entering the starting number. This is why i was looking for a way to add it in the file which i have now found.

Thanks

0 Likes