Importing text from CAD to REVIT

dynamo
#1

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 !

0 Likes

#2

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

0 Likes

#3

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.

0 Likes

#4

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:

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

0 Likes

#5

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 !

0 Likes

#6

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

Hope that helps,

Mark

3 Likes

Data attribution using information from a CAD file
Cad p&id to revit
#7

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

0 Likes

#8

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

0 Likes

#9

Could also try a data extraction.

0 Likes

#10

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

0 Likes

#11

Hi Did this bring the text from CAD to revit ?

0 Likes

#12

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…

0 Likes

#13

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.

0 Likes

#14

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.

4 Likes

#15

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

0 Likes

#16

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

3 Likes

#17

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

0 Likes

#18

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.

5 Likes