Find CAD import in families

Hello -

I am looking for info on how to list CAD imports in families, is it even possible? I can list import instances directly in Revit but can’t figure out how to identify CAD imports in families. Any information you could provide would greatly help.

Thanks,
Jason

Do you mean from within the family editor you get a list of imported dwgs in the .rfa file you have open?

or do you mean if you are in the project .rvt file then you get a list of families
and then a list of all the imported dwgs in the family …

1 Like

Hi @Jason_Trahan

Its possible. Are you looking to get in family environment or in Revit?

Hi Jason,

I’ve used this to locate “rogue” dwg imports in the .rvt invironment:

import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Import ToDSType(bool) extensions method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#Start scripting here:

bool = IN[0]

if bool == True:
	col = FilteredElementCollector(doc).OfClass(ImportInstance).ToElements()
	impinst = []
	impname = []

	for i in col:
		if i.IsLinked != True:
			impinst.append(i)
		
	for j in impinst:
		impname.append(j.Category.Name)
			
   	OUT = impinst, impname

else:
	OUT = "Set bool to True"
5 Likes

Maybe this is helpful: http://therevitcomplex.blogspot.nl/2016/12/find-families-in-your-revit-project.html

1 Like

@T_Pover @Jason_Trahan interesting problem. I’m about to release a new node which does precisely this. The only problem is its designed to work with the open document:

However, I’ve just amended it to take an optional path input so that any external file - be it a Family or other Revit document - can be audited silently (i.e. without needing to open the input files):

5 Likes

Nice one, @Thomas_Mahon :slight_smile:

1 Like

Marcello - From the .rvt project I would like to get a list of import instances from loaded/ placed families. From time to time users will insert .dwg or .sat into families (mostly generic models) and then load the family into the .rvt file. I want to find those families and the imports within.

Edit: I now see the link that @T_Pover provided from your blog, (thanks) I will give this a try!

Edit 2: @Martin_Spence1 - Thanks! Works great for finding imports, just looking to go deeper into families. @Thomas_Mahon looks promising, the open document will work, being silent is even better.

@Kulkul - Revit environment. Thanks.

Hi @Jason_Trahan

In that case use the solution by @Thomas_Mahon “reportCADLinks” node should get you started.

Thanks again - Wondering if I can find the families with CAD by finding the current views Imported Categories and check/ uncheck “Imports in Families” visibility. I’ll report back after snooping around.

@Jason_Trahan ReportCADLinks is now available in BimorphNodes v2.0

2 Likes

@Jason_Trahan - Did you get anywhere with this? I’m looking at the CAD.ReportInstances node, and i don’t see how i can feed the list of loaded families into that node… at least not without first saving out a family library first…

1 Like

Im trying to use the CADTextData.FromLayers node, but im getting this error message

image

Is the problem the () in the layer name? Why is it so limited in characters?

Because its not possible to extract text from CAD files using the Revit API. Instead, the CAD files are exported to DXF so the TEXT and MTEXT entities can be parsed, then converted back into CADTextData which Revit can consume.

DXF only supports what the error message on the node states - its a limitation in the DXF format and there is nothing I can do about it (it screws up the layerNames internal indexing if I didn’t enforce the same limitations with the node).

I see

Did a test here, by removing the () in the layer name, i was able to extract the cadtext values

Thank you for your quick response!

1 Like

If i’m not mistaken, it might be the old 8-bit limitation in ascii.
Which means dinosaur code. :slight_smile:

So
Characters (Capital or not)
Digits
-, _ , &
All other are excluded.