What's the best way to hide block text attributes in modelspace ? #648
-
I'm writing a script where I initialize blocks and text attributes inside them but I don't want the text attribs to appear in modelspace. I've found that the invisible attribute seems to do what I'm going after, but I can't make it work. I'm opening the file in Acad afterwards and the text is still visible. Here's a simple script that creates a blockdef, instance a blockref and populate its attribute. I expected the text not to appear in modelspace. I've looked around a bit but couldn't find a workaround.
Thanks for the awesome library btw ! It saves me countless hours of tedious work :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
By using But I assume this is what you want: block_instance.add_auto_attrib({"test_attr", "test"}) This adds new ATTRIB entities based on template ATTDEF entities at the same relative location as the ATTDEF and the same settings. See docs for more information. |
Beta Was this translation helpful? Give feedback.
-
The ...
block_instance = dxf_file.modelspace().add_blockref("Test", (0, 0, 0))
attrib = block_instance.add_attrib("test_attr", "test")
attrib.is_invisible = True
dxf_file.saveas(r"C:\Users\manfred\Desktop\Outbox\attribs.dxf") |
Beta Was this translation helpful? Give feedback.
-
Awesome, that did the trick ! Thanks :) For reference this is where I'm using this : https://github.com/Gorgious56/dotbim_io_dxf Cheers ! |
Beta Was this translation helpful? Give feedback.
The
invisible
flag is the usual flag to set DXF entities invisible and seems not to work for ATTRIB entities.The ATTRIB entity has a special visibility flag which is stored in the DXF
flag
attribute but can be set by the propertyis_invisible
: