Get MText from CAD with Dynamo

Hello,

I am trying to read and get the MText of CAD files import Instances in Revit through Dynamo.

I used the Bimorph package v.3.03 which is the latest version I can use in Dynamo of Revit 2021, and the node used CADTextData.From Layers and it returns Empty List, but the layer name indicated contains all of the text items on that file, then I am looking alternatives to get the text in Dynamo.

The DWG file is on BIM360, perhaps that node cannot read the file because the file path is cloud type?

I am not sure about that assumption because the node finds that other layer (the layer “0”) of same file contains text.

image

I’ve not tested on BIM 360 before so it’s a possibility. Can you try the following:

Update to v4.0.13 then try again.
Download your CAD file and link it - does it work?

1 Like

It was not the case of the cloud/local file path, same result, I cannot upgrade to version 4 of the package because I get a warning telling me the packaga is for a newer version of Dynamo, and I do not want to upgrade Dynamo otherwise many other people around will have to do so and maybe other packages will not work anymore or scripts will stop to work.

what susprises me, that the layer 0 gets all the texts, I am thinking to move all file texts to that layer too, and filter by colour or text size :sweat_smile:

I share the file here for testing:
weirdtextdynamobimorph.dwg (189.1 KB)

This looks like a bug which also affects the latest version, I’m investigating the cause but it seems like the layer filter is failing. It might be unsupported characters, for example periods in layer names are not supported and I notice your layers have dollar signs which could also be an unsupported character type.

If you provide no layerNames the node will return the text. The good news is it will be fixed this week, the bad news is it will only be fixed in the latest released. However, you can safely upgrade to v4.0.14 (when its released) just ignore that warning about requiring a new version of Dynamo to run it.

The problem is caused by unsupported characters - curved brackets are converted to underscores which causes the layer filtering to fail:

The node exports to DXF to parse the text. Unfortunately the DXF export has limitations on layer name characters so its not directly caused by BimorphNodes, just the export process.

then should I replace the symbols on layers: ( and ) , by something else valid?
I moved everything to layer 0 and filtering afterwards by colours, I changed the colours manually in CAD to do that, which is not ideal

also I noticed the extraction of text is split by number, symbol of a MText multitext of AutoCAD, but I was expecting to get all MText combined in a single string, or have a string by line of the MText to be able to use it

Yes simply remove the unsupported characters. Only the following characters are supported by DXF currency symbols, e.g. $ or £ and a-z A-Z 0-9 _-

Multi-line text is always split into single line MTEXT when exported.

1 Like

ok, thanks solution has been renaming everything better in DWG/DXF file

I got for example this MText Multiline and I get the number twice, M, 2 and the words

  1. 53.23
  2. 53.23
  3. M
  4. 2
  5. Group room

that means no idea if that part of the text belogs to the others when I got thousands of results in a single list

I was expecting to get instead:

  1. 53.23 M2
  2. Group Room
    image

Any thoughts about that behaviour? should I create another script in the CAD files before link into Revit or can a trick be done in Dynamo?

This is caused by the Revit DXF export - it separates the text into individual MTEXT entities so there is nothing we can do about it unfortunately. The order of the items will however be sequential in your list, so the index of 53.23 will follow M, 2 and Group room respectively so you might be able to use this coupled with some sort of bounding box filter to try and regroup from there but its never going to be that reliable.

Also if you explode your labels you will also notice how the text is separated - this is basically what happens when exporting to DXF.

The DXF file from the Revit export (the node uses this to extract text as its not possible via the Revit API). You can see that the area symbol is not selected when the area value text is selected. The same thing happens if you explode your labels in Autocad:

1 Like