Block Attributes With Number Format

Block Attributes With Number Format

ebsoares
Collaborator Collaborator
4,016 Views
10 Replies
Message 1 of 11

Block Attributes With Number Format

ebsoares
Collaborator
Collaborator

Hi, all.

Is there a way to type a number (over a thousand) in a block attribute, and have that number automatically show the thousand separator? Say, type "1234" in the attribute value field and have it automatically display "1,234"?

Here's an example of a block with that:"4849" to "4,849"?"4849" to "4,849"?

Thanks in advance for any help or tip

Edgar

0 Likes
4,017 Views
10 Replies
Replies (10)
Message 2 of 11

pendean
Community Legend
Community Legend
There is nothing OOTB/automatic in plain AutoCAD to do that... . Type to customize with LISP perhaps.



0 Likes
Message 3 of 11

JTBWorld
Advisor
Advisor

Maybe this can be a workaround? Auto formatting numbers in block attributes in AutoCAD


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

Message 4 of 11

ebsoares
Collaborator
Collaborator

Thanks for the reply @pendean. - it would be nice if AutoCAD had a straightforward solution.

 

@JTBWorld, it seems like that might get me where I need - I'll give it a try tomorrow Smiley Wink

 

Edgar

0 Likes
Message 5 of 11

Moshe-A
Mentor
Mentor

@ebsoares  hi,

 

attached addComma.zip contains addComma.VLX a lisp file that will do what you want

it's supports texts and attribute block.

it handles text value that contains only numbers.

if text value contains spaces, they all will be removed.

if a block contains multiple attribute numbers, they'll be take care.

 

enjoy

moshe

 

 

Message 6 of 11

Moshe-A
Mentor
Mentor

Mr Edgar Soares,

 

liked it? than mark this as your solution Smiley LOL

 

thank you

moshe

0 Likes
Message 7 of 11

ebsoares
Collaborator
Collaborator

Hi, @JTBWorld.

Only draw-back to that workaround is that the formula cannot be made to be inherent to the block itself (I've tried it), but instead need to be done after the block is inserted in the drawing, and all subsequent blocks have to be copied (AutoCAD command copy) from that first one.

It's not quite the solution I was looking for, but it sure is neat and is the closest to getting the the job done Smiley Happy

Thanks!

0 Likes
Message 8 of 11

ebsoares
Collaborator
Collaborator

Hi, @Moshe-A.

I though about creating a lisp routine that would look for all the blocks like the one in the picture and change their number format, but that would have to be done after the fact (after all the blocks have been placed) - which, for sure, is not actually a bad idea Smiley Very Happy

Thanks!

0 Likes
Message 9 of 11

Moshe-A
Mentor
Mentor

@ebsoares 

 


@ebsoares wrote:

Hi, @Moshe-A.

I though about creating a lisp routine that would look for all the blocks like the one in the picture and change

their number format,

 

what do you mean by that, an auto routine that scan all database and handle all numbers?

but have you though, your drawing may contains (some where some times) numbers that are (let's say) a code or bar code that does not necessary need commas? there you will need a function to cancel commas?

 

what's better than having a function where you can select (control) only the text number you want with commas?!

 

mark this as your solution.

 

thanks

Moshe

 

 

0 Likes
Message 10 of 11

ebsoares
Collaborator
Collaborator

Hi, @Moshe-A.

I apologize, as perhaps my post had not been as clear as I thought - my comment was actually agreeing with you (I had thought about creating a code like yours before I posted my original question). Your code would have been spot-on if someone were looking for a solution "after the fact", or a way to change all the numbers with the thousand separator "after" writing all the numbers on all the blocks. My original post is about an automatic way to accomplish this on-the-fly, as one writes the numbers in the blocks - which, I found out, can't be done yet.

I really appreciate what you did (seriously, you wrote an entire routine, thank you for that Smiley Very Happy), but I fear if that is marked as the solution it will lead others to think that is the solution to the original question...

Thanks

0 Likes
Message 11 of 11

JTBWorld
Advisor
Advisor

I might chime in that this format conversion could be done on the fly but would require a but more coding. If interested feel free to contact us. 


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

0 Likes