I gave it a quick run and have one question:
-The rectangle is only used as boundary for the posnr, not for the text. Is that possible? (so, the output should be one text (objectname) and one posnr block (posnr text + rectangle)
With this adjustment it would be perfect!
OK, that should not be a problem. I hadn’t done the block part yet. Just a question - you really want the posnr + rectangle to be a block (not a group)? Is there a purpose being served here by making them blocks or do you just want to be able select them together? (in which case a group is probably simpler)
In either case - I suppose the block name/group name should be the posnr?
Hi Mitch, the purpose is to perform a block count in autocad. All parts will be shown in a construction drawing and also a parts layout. So we have a script that runs a parts check in the 3d model/construction drawing/parts layout. The block name should be the same as the posnr indeed.
OK, try the attached out…
AddTextBoxNotationView2.py (2.8 KB)
Mitch! It works perfect!!
Exactly what we were looking for!
Last two questions…
-Can we set a default font type?
-Last but not least we have a little script that also add the layername, we place this under the posnr (like you add the objectname above the posnr)
The layer name looks something like this: C-construction::Plate::-5- (layer, sublayer, subsublayer)
We use a “replace text” script, to adjust it to: -5- (because it’s just the plate thickness were looking for).
I tried to adjust your script and add the object layer info, but I am terrible at scripting…
Is it possible to derive a sublayer name?
Mitch! I already found the font type input:
AddText(text, point_or_plane, height=1.0, font=‘Arial’, font_style=0, justification=None) |
AddTextBoxNotationView3.py (3.2 KB)
OK, you can try this one…
Note that adding the layer text below the rectangle I used a text justification of top, center. It means the insertion point is above the text. I don’t know how this justification translates to AutoCAD, please try it out… If this doesn’t work, I’ll need to try laying out the text somewhat differently.
AddTextBoxNotationView3.py (3.3 KB)
Thanks for all the effort Mitch!
Any chance you still have this script laying around? The download is not working anymore
Hmm, I checked and it is not in my library, nor did I find it with a whole-computer search. It may have been saved somewhere else other than my library at the time and I have since changed computers multiple times… Sorry.