Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Thousands separator
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Thousands separator (Read 210 times)
0 Members and 1 Guest are viewing this topic.
RamiMann
Mosquito
Posts: 9
Thousands separator
«
on:
May 27, 2023, 04:30:42 AM »
Hello
I'm looking for a lisp that adds a thousands separator for a selection set of text (not a single text)
Thanks
Logged
Beavis
Retired
Needs a day job
Posts: 7904
AKA Daniel
Re: Thousands separator
«
Reply #1 on:
May 27, 2023, 06:42:33 AM »
do you have a sample drawing, is the number embedded with other text?
Logged
Retired
RamiMann
Mosquito
Posts: 9
Re: Thousands separator
«
Reply #2 on:
May 27, 2023, 07:15:22 AM »
Here's a sample
«
Last Edit: May 27, 2023, 08:22:40 AM by RamiMann
»
Logged
kasmo
Mosquito
Posts: 16
Re: Thousands separator
«
Reply #3 on:
May 27, 2023, 05:45:59 PM »
This should work:
Code - Auto/Visual Lisp:
[Select]
(
defun
c:foo
(
/
old new ss i j ob sep
)
(
setq
sep
(
car
(
vl
-
string
->
list
","
)
)
)
;; tausend separator
(
if
(
setq
ss
(
ssget
'
(
(
0
.
"text"
)
)
)
)
(
repeat
(
setq
j
(
sslength
ss
)
)
(
setq
i
1
new
nil
ob
(
vlax
-
ename
->
vla-object
(
ssname
ss
(
setq
j
(
1-
j
)
)
)
)
old
(
reverse
(
vl
-
string
->
list
(
vla-get-textstring
ob
)
)
)
)
(
repeat
(
length
old
)
(
if
(
and
(
eq
(
mod i
3
)
0
)
(
nth
i old
)
)
(
setq
new
(
cons
sep
(
cons
(
nth
(
1-
i
)
old
)
new
)
)
)
(
setq
new
(
cons
(
nth
(
1-
i
)
old
)
new
)
)
)
(
setq
i
(
1+
i
)
)
)
(
vla-put-textstring
ob
(
vl
-
list
->
string new
)
)
)
)
)
«
Last Edit: May 27, 2023, 05:50:03 PM by kasmo
»
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Thousands separator