Jump to content
mickeforsberg

Quickly numbering (Numinc) with text frames in different colors

Recommended Posts

mickeforsberg
Posted (edited)

Hello!

 

>> Can't change profile settings at the moment, but I'm using AutoCAD 2018

 

I'm looking for some tips and suggestions on how to go about this...

As per new fire alarm drawing regulations it's required for the drawings to look something like this:

 

iy1nxj.png

 

And the devices are usually incrementally numbered from 1.001-1.100; 2.001-2.100 etc. (not shown in the example image).

The addresses should have a text frame with a darker shade of the hatch color, as shown.

 

I have tried this:

For the addresses I used a layer with object color Red, to make the frame Red for example. Then I manually selected the text and in the Text editor I changed the text to Black. This kinda works, but is tedious to do this manually with hundreds of addresses, and when using Numinc the text color changes to Red automatically.

I could perhaps use another layer for just the frame and background mask, but as far as I know it can't automatically change size depending on the text content, which would be great. Otherwise I'd have to resize every frame to make it look proper.

 

Does anyone have any suggestion on how to make these two work together? Or perhaps a different approach all together?

 

Thanks, and have a nice weekend! :beer:

Edited by mickeforsberg

Share this post


Link to post
Share on other sites
dlanorh
Hello!

 

I'm looking for some tips and suggestions on how to go about this...

As per new fire alarm drawing regulations it's required for the drawings to look something like this:

 

iy1nxj.png

 

And the devices are usually incrementally numbered from 1.001-1.100; 2.001-2.100 etc. (not shown in the example image).

The addresses should have a text frame with a darker shade of the hatch color, as shown.

 

I have tried this:

For the addresses I used a layer with object color Red, to make the frame Red for example. Then I manually selected the text and in the Text editor I changed the text to Black. This kinda works, but is tedious to do this manually with hundreds of addresses, and when using Numinc the text color changes to Red automatically.

I could perhaps use another layer for just the frame and background mask, but as far as I know it can't automatically change size depending on the text content, which would be great. Otherwise I'd have to resize every frame to make it look proper.

 

Does anyone have any suggestion on how to make these two work together? Or perhaps a different approach all together?

 

Thanks, and have a nice weekend! :beer:

 

Attached is test.dwg. It contains a block "dev_id".

 

The block consists of an attribute "DEV_ID", a polyline and behind both a wipeout.

 

The Attribute is colour 7 which should mean it will show as white on dark background and vice versa.

 

The polyline is byblock which should take on the colour of the layer into which it is inserted. However the polyline colour can be changed by changing the blocks colour using the property toolbar This won't affect the text colour. All instances of the block in the drawing are on the same layer.

 

This should get you part of the way. If you weren't using LT, automating the incrementing of the number would be possible using my lisp. Not sure if you can do it using a script. Perhaps someone else could step in.

Test.dwg

Share this post


Link to post
Share on other sites
BIGAL

You may be able to take advantage of the Autocad variable Userri1 and save the number, pretty sure you can retrieve variables so add 1, save it then insert block.

 

Steven-g your the wiz on LT did you have a look at post.

Share this post


Link to post
Share on other sites
mickeforsberg
If you weren't using LT, automating the incrementing of the number would be possible using my lisp.
Steven-g your the wiz on LT did you have a look at post.

Ooh, sorry! I've been upgraded to AutoCAD 2018. I forgot that it said LT in my signature.

dlanorh, this is in the right direction yes. The areas in which the addresses go will often be tight so I was hoping there would be a way for the frame to resize with the text also. 1.111 takes less space than 3.333 for example, and then the text would go outside of the frame.

Share this post


Link to post
Share on other sites
dlanorh
Ooh, sorry! I've been upgraded to AutoCAD 2018. I forgot that it said LT in my signature.

dlanorh, this is in the right direction yes. The areas in which the addresses go will often be tight so I was hoping there would be a way for the frame to resize with the text also. 1.111 takes less space than 3.333 for example, and then the text would go outside of the frame.

 

I will look at sizing polyline and wipeout. Currently it is set up for text font "romans" with a width of 0.8 and should be big enough to contain the largest number (999.999). The block text is at a height 1 so the block will need scaling to the required text size before copying around.

 

Attached is renumbering lisp. Please read header information and relevant code input notes.

Share this post


Link to post
Share on other sites
dlanorh

Attached is new block drawing. Block now contains a linear stretch pair for the polyline.

 

Left click on the block and a little triangle will appear over the top right corner. Left click and hold mouse button down and drag frame and wipeout to the required size. I haven't figured out how to automate this however.

Share this post


Link to post
Share on other sites
mickeforsberg
Left click and hold mouse button down and drag frame and wipeout to the required size. I haven't figured out how to automate this however.

Ah this looks promising! Thanks! I was also looking into something like this but I didn't figure out quite how to do it.

If this could be automated it would be perfect!

Share this post


Link to post
Share on other sites
dlanorh
Posted (edited)

Solved, thanks to Lee Mac's set dynamic property routine. :notworthy:

 

Please use new attached lisp and block drawing. The block is set so that the ?.??? default text is preset and the boundary is set for the smallest possible text width (1.111). Once the device number is updated the polyline width within the block is updated via its dynamic textwidth property name. This should work across all scalings of the block, but i haven't tested it extensively. The ability to tweak the width via the block in autocad remains.

DevNos.lsp

Edited by dlanorh

Share this post


Link to post
Share on other sites
mickeforsberg
Once the device number is updated the polyline width within the block is updated via its dynamic textwidth property name. This should work across all scalings of the block, but i haven't tested it extensively. The ability to tweak the width via the block in autocad remains.

 

Hm, I can't get it to work! I've tried with the lisp and just changing the text manually, but the width of the polyline does not change. What am I doing wrong? :unsure:

Also, is the lisp needed for the frame somehow or is it just to change the text incrementally? I have been using Lee Mac's Numinc before and it seems to work as well with the dev_ID block, although perhaps it breaks something?

Share this post


Link to post
Share on other sites
dlanorh
Hm, I can't get it to work! I've tried with the lisp and just changing the text manually, but the width of the polyline does not change. What am I doing wrong? :unsure:

Also, is the lisp needed for the frame somehow or is it just to change the text incrementally? I have been using Lee Mac's Numinc before and it seems to work as well with the dev_ID block, although perhaps it breaks something?

 

The lisp is needed for the frame. Are you using the new block or trying to use it on an already renumbered block? It won't work with the old one as there is no dynamic stretch property.

 

The lisp relies on the text being larger than the frame when the number is incremented, and then adjusts the frame to fit around the text. It wont work if the frame is already larger than the text. That is why, in the new block, the frame is set for minimum text width i.e. text = 1.111.

Share this post


Link to post
Share on other sites
mickeforsberg
The lisp is needed for the frame. Are you using the new block or trying to use it on an already renumbered block? It won't work with the old one as there is no dynamic stretch property.

 

The lisp relies on the text being larger than the frame when the number is incremented, and then adjusts the frame to fit around the text. It wont work if the frame is already larger than the text. That is why, in the new block, the frame is set for minimum text width i.e. text = 1.111.

 

I'm using the new .dwg you attached, and I loaded DevNos.lsp > INCA > 1 > 1 and continued on from there 1.001, 1.002, 1.003 etc. but the frame is the same. Am I doing something in the wrong order?

Share this post


Link to post
Share on other sites
dlanorh
I'm using the new .dwg you attached, and I loaded DevNos.lsp > INCA > 1 > 1 and continued on from there 1.001, 1.002, 1.003 etc. but the frame is the same. Am I doing something in the wrong order?

 

I'm not sure, it's working for me in 2012. Have you inserted the new block into a drawing containing the old block? If so it may be that it is ignoring the new block as it is already defined.

 

Attached is a tweaked block in its own drawing. Open this drawing and scale the instance of this block to the required text height i.e. Text ht = 60 block scale should be 60. Copy it around within the drawing a few times and run the lisp to renumber. Does it work then?

 

I've also re-attached the new lisp (file size 5.5kb), that works on the frame. Make sure you are using this one.

dev_id.dwg

Share this post


Link to post
Share on other sites
mickeforsberg
Posted (edited)
Make sure you are using this one.

 

Aaah, I mixed them up and was using the old one... christ! :facepalm:

Sorry about that! It works!! This will speed up my upcoming work immensely, thank you! :notworthy:

Is it possible to adjust the margin of the frame to the left and right? So there's a little bit more space between the numbers and the frame.

 

Edit: I played around and switched to Arial (which I'm supposed to use) and the problem kinda solved itself!

I think this is the best possible solution you've come up with! :) However if you find a way to let the frame shrink as well as expand (so that it's possible to change the same address multiple times without the frame only expanding), let me know ;)

Edited by mickeforsberg

Share this post


Link to post
Share on other sites
dlanorh
Aaah, I mixed them up and was using the old one... christ! :facepalm:

Sorry about that! It works!! This will speed up my upcoming work immensely, thank you! :notworthy:

Is it possible to adjust the margin of the frame to the left and right? So there's a little bit more space between the numbers and the frame.

 

Edit: I played around and switched to Arial (which I'm supposed to use) and the problem kinda solved itself!

I think this is the best possible solution you've come up with! :) However if you find a way to let the frame shrink as well as expand (so that it's possible to change the same address multiple times without the frame only expanding), let me know ;)

 

Shouldn't be a problem I should be able to reset the frame to the smallest size just before the text is changed. It will then expand to the new text size. Check here tomorrow.

Share this post


Link to post
Share on other sites
dlanorh

Attached is updated Lisp. You cannot edit an attribute value in the same lisp session, as it will disrupt the incremental numbering. You will have to re-run the lisp to do this. It now resets the frame width to minimal just before updating the text and then adjusts the width for the new attribute text. Enjoy.:thumbsup:

Share this post


Link to post
Share on other sites
mickeforsberg
Posted (edited)
Enjoy.:thumbsup:

Brilliant! Thank you! :notworthy:

This community is awesome!

 

Also thanks for renaming the lisp as to minimize user error :lol:

 

Edit: I forgot one thing... on occasion we have systems with a bit different addresses. They go like 1/1; 1/2; 1/3; 2/1; 2/2; 2/3 etc...

Can I edit somewhere so it doesn't automatically enter a "0" before the given address? Or will this screw up the resizing of the frame?

 

Excuse my absolute rookie questions :)

Edited by mickeforsberg

Share this post


Link to post
Share on other sites
dlanorh

Edit: I forgot one thing... on occasion we have systems with a bit different addresses. They go like 1/1; 1/2; 1/3; 2/1; 2/2; 2/3 etc...

Can I edit somewhere so it doesn't automatically enter a "0" before the given address? Or will this screw up the resizing of the frame?

Excuse my absolute rookie questions :)

 

Attached are

 

an improved version of the original lisp (NewDevNos.lsp)

 

a version for text with slashes (NewDevNosSlash.lsp)

 

a new block for slashes (dev_id_slash.dwg)

 

Each lisp will only work with its corresponding block i.e. NewDevNosSlash won't alter block dev_id only dev_id_slash. The dev_id_slash block needed altering to account for the shorter string. It works OK when the text font is arial. If it isn't then there will be text overlapping the frame. This is caused by the drop down of the slash in some fonts.

 

I've also taken the liberty to automate the frame colour, so autocad's basic color picker will pop up after you've input the start numbers. Select the colour you want and it will colour the frame for you.

 

I want to try and expand the color to truecolor and use a dialog box as the start/end point, but i'm pretty busy for the next couple of days. Check back here from time to time or drop me a PM here.

dev_id_slash.dwg

NewDevNosSlash.lsp

NewDevNos.lsp

Share this post


Link to post
Share on other sites
mickeforsberg

Each lisp will only work with its corresponding block i.e. NewDevNosSlash won't alter block dev_id only dev_id_slash. The dev_id_slash block needed altering to account for the shorter string. It works OK when the text font is arial. If it isn't then there will be text overlapping the frame. This is caused by the drop down of the slash in some fonts.

 

I've also taken the liberty to automate the frame colour, so autocad's basic color picker will pop up after you've input the start numbers. Select the colour you want and it will colour the frame for you.

 

I want to try and expand the color to truecolor and use a dialog box as the start/end point, but i'm pretty busy for the next couple of days. Check back here from time to time or drop me a PM here.

 

That is absolutely fine, I will be using Arial only.

Ah, that's interesting. Actually I won't be using anything but the colors in the basic color picker so that works for me without improving it further! I will only use 6 or perhaps 8 colors on the hatches and 6 or 8 contrast colors on the text frame, all of which can be selected in the basic color picker.

Although I'm not sure what is the best or fastest way to go. As of now I have copied the dev_id block and changed the frame color (object color) to those 8 I will be using, and I have them ready to be copied in my template, like this:

2s83881.png

 

And I was thinking I'll just copy and paste those of correct frame color into the drawing. But I'm not sure this is the most effective way...

Do you know if there is any faster way to insert the dev_id blocks into the drawing? I only know of using Multiple, followed by Insert. But this way I have to change the scale of the block each time, it doesn't save it as far as I know. So I have just copied and pasted the block for now...

Share this post


Link to post
Share on other sites
dlanorh

If you can give me the colour numbers i can include them in the selection. My thinking was to combine the two lisps into one, using one block. The most efficient way i can think to do this, is using a dcl dialog as the front end.

Share this post


Link to post
Share on other sites
mickeforsberg
If you can give me the colour numbers i can include them in the selection. My thinking was to combine the two lisps into one, using one block. The most efficient way i can think to do this, is using a dcl dialog as the front end.

 

Of course! From top left to right etc:

 

133 teal

73 green

53 yellow

43 orange

13 red

183 purple

113 turquoise

223 pink

 

Ah I see, yes that sounds more efficient for sure. A DCL dialogue is more of a graphical interface rather than just the regular command line, if I understand correctly?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×