Importing text from CAD to REVIT

Hello I’m a beginner when it comes to dynamo and scripts as a whole so apologise if this is a simple ask !

I’m using a script that was developed in order to import CAD lines into a REVIT format but I’m wondering if there is a way to bring text associated with it across aswell ive done some digging and apparently the code to select text from CAD is (ssget “_X” '((0.“TEXT”))) and then in order to make it layer dependant I need to add (ssget “_X” '((0.“TEXT”) (8.“Mylayer”))) But everytime I create this block it gives me a closeparren Expected error.

image

Any help would be appreciated !

Hi,

Unfortunately I’m not sure this is possible without exploding your CAD in Revit…

Here’s a link to help you with design script (the language of code blocks) https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf

Hope that’s of interest,

Mark

Actually, I am pretty sure you could use the AutoCAD api to pull the data that way. No publicly available package I know of exposes it, but you could look at the LinkDWG package for other element types and decipher where to go from there.

Hey, good shout… This is in LinkDWG… It backgrounds opens the CAD file… any suggestions on casting a System._ComObject to a Text Element or reading it’s information?! :smiley:
image

Edit: It looks like the Python contains the code that the OP was trying to use…

Hi thanks for all the information provided ! ill have a bit more of a play around today with this new stuff and see what happens ! Anything else that may help would be much appreciated aswell !

A bit more digging around in the Link Dwg package got this…

Hope that helps,

Mark

7 Likes

Hi Mark, The Manage.RemoveNulls Node what package is that from ? cant seem to find it on LinkDWG

Hi Harry,

I’m not sure which packages you have (I’d recommend getting the top 10/15… https://dynamopackages.com/ also Orchid https://github.com/erfajo/OrchidForDynamo)

There are many nodes for getting rid of nulls, that one happens to be from Lunchbox :slight_smile:

Cheers,

Mark

Could also try a data extraction.

Yes it is possible, I was looking at your node…
I manage to get all the text from Cad to Text note … thank you

image

Hi Did this bring the text from CAD to revit ?

It would recreate the text in Revit? Taking it’s text and location and making a new note for each… If that’s what you’re asking? :slight_smile:

To bring it in (as I’m sure you know) you could import and explode the CAD, but that also brings lots of problems…

Is it possible to delete layers of an imported cad and then explode through api? If it is, then it would technically be possible to delete all layers except the ones you need, explode, find all text notes with their text and position, then undo the explode and delete.

also…

image

(BimorphNodes v3.0 ETA March/April). It avoids explode too, since there is a risk of hitting the 10000 element limit, so it uses an alternative route to only target the MTEXT and TEXT objects in the file.

9 Likes

Oooh awesome. Will it work for Revit 2017/18? And will layer filtering be available as it was for curves?

Yes to both. The above is beta, there will be an input for layers.

3 Likes

Any chance you could briefly give the process or outline on how you do it? :grin:

Yeah sure, I’m using netDXF library, so the process involves exporting the import instance to DXF, parsing with the netDXF library then converting the text objects to strings and origins to Dynamo points.

6 Likes

Any updates on this node? I am in the middle of a large transfer or room names/numbers where I’d like to try this out.

Hey Steve,

You can use the graph I showed in post 5…

Hope that’s useful,

Mark

1 Like