Placing Door and Window by CAD Block after Linking CAD In Revit

Hi Everyone ,

I am working on developing a script to place doors and windows at CAD block locations after linking CAD in Revit, but I am not able to place all door family types; some are placed, while others show an error.

I have referred to a YouTube video. Please find the attached Dynamo script.

Door & Window Placement_3.dyn (36.0 KB)

racbasicsampleproject - Floor Plan - Level 2.dwg (94.4 KB)

Please help me to resolve this issue

Regards

Ravi

Hi have you build walls from that cad so your inserts have a host ??

Yes, I created a wall as required. When I run the Dynamo script, not all doors get placed at their required location; some of them give a " wall not able to cut error.

I am looking to resolve this issue for both windows and doors.

allright then i guess we need the rvt , just a small sample

Hi please find a sample Revit file which I am using , please help me to resolve this issue

H @ravishankar.unipune here is a quick test with the principle, have only tried for doors should be the same for windows…

Hi @sovitek

Thank you very much. I am successfully able to place doors and windows

awesome :wink:

I have concerns as the window does not cut through the wall.

allright what is the name of the cadlayer and this family you will insert, then i can try…

Hi, I checked it again, and it is working, and the window cuts through the wall. I also checked in Revit 2025, and CAD Block nodes from the GeniusLoci package can extract data, but return a null value. I switched to Revit 2024. Please help me make this script Revit version-independent so it can run on Revit 2024 and later.

allright can you show us where it give null…i have only tried in 26…so not really sure

Hi, I just ran Revit 2025. I have the latest version of the GeniusLoci Package, and I am getting a null value in the CAD Block node.

is that the latest from genius loci, and do you have the right ironpython package installed as well ??? you could try here for cpyhon 3…and see if it could be better…

  
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import Options,GeometryInstance, XYZ
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
import math
uiapp = DocumentManager.Instance.CurrentUIApplication
version=int(uiapp.Application.VersionNumber)

points,rotations,blocks,layersAll=[],[],[],[]

elem = UnwrapElement(IN[0])
geoElem = elem.get_Geometry(Options())		
for geoObj in geoElem:
	transform=geoObj.Transform
	instance=geoObj.SymbolGeometry
	for inst in instance:
		layers=[]
		if isinstance(inst,GeometryInstance):
			points.append(transform.OfPoint(inst.Transform.Origin).ToPoint())
			rotation=abs(math.degrees(inst.Transform.BasisX.AngleOnPlaneTo(XYZ.BasisX, XYZ.BasisZ))-360)
			if round(rotation,3)==360:
				rotation = 0
			rotations.append(round(rotation,3))
			if version > 2022:
				blocks.append(elem.Document.GetElement(inst.GetSymbolGeometryId().SymbolId).ToDSType(True).Name.split(".dwg.")[-1])
			else:
				blocks.append(inst.Symbol.ToDSType(True).Name.split(".dwg.")[-1])
			geom=inst.SymbolGeometry
			for geo in geom:
				try:
					layers.append(elem.Document.GetElement(geo.GraphicsStyleId).GraphicsStyleCategory.Name)
				except:
					layers.append(None)
			if layers != [] : layersAll.append(layers[0])
			else : layersAll.append(layers)
			
OUT = blocks,points,rotations,layersAll

Hi @sovitek Thank you very much , I am able to run it for Revit 2025

nice it could work :wink: