Search code examples
vb.netdxf

I want to write DXF attributes to a DXF file from VB


So I wrote a massive plugin for Rhino5. I now need it to somehow talk to sigmanest. The best way I can do that is string tags.

Meaning, I DXF a part with the correct part information in text boxes next to the part. But my job does not want that (I have no idea why)

The next thing I can do is embed attributes into the DXF. My plan is to export the part, then write to the DXF file new attributes.

Has anyone done such a thing? I've done some pretty heavy googling, but couldn't find any topics on just writing new attributes to a DXF.

A quick and dirty sample code would be great if you have done this, or link to the information.

Thanks for reading!


Solution

  • I am only answering for googles sake...

    netDXF is a C# library that reads and writes dxf files and is freely available.

    To insert a custom attribute, do the following

    Dim aTT= New AttributeDefinition(AttributeNameString)
    aTT.Flags = AttributeFlags.Hidden
    block.AttributeDefinitions.Add(aTT)
    block.AttributeDefinitions(AttributeNameString).Value = VaribleorString