Place face based family on reference plane through dynamo

Hi,

I’m trying to insert face based families through dynamo. I got it to work using the “FamilyInstance.ByFace” node, but i can only use surfaces from elements or system-families (like walls). What i want to achieve is to use reference planes to do the same (in other words: I would like to use a reference plane as a host for my face-based families). It seems that reference planes don’t have “surfaces” to use as the host.

Help would be much appreciated.

Mark Bruining

Hi

As far as i know it is not possible to place a face base family on a reference plane and that the reference plane is the host
it is possible to place a fb family with dynamo in revit with the Node FamilyInstance.ByPoint

Nico

Thanks for your reply,

It is actually possible to place a face based family on a reference plane. So thats why i’m looking for the dynamo-way to do it.

I know it is possible in revit.
But as far as i know it is not possible with dynamo to place it on af referenceplane and host is to that reference plane.

see also this topic:

And i also searched through the revit API for a solution and couldn’t find one. I did not searched through the revit API 2019 but in the in changes and additions mentioned in this topic

i did not find anything usefull for placing objects and hosting on a reference plane

Maybe people like @JacobSmall , @awilliams, @Nick_Boyts know more then me

nico

It’s doable.

I think this will take some api efforts though.

Maybe off topic but:

is it also doable to place structural framing (beams) and host on a reference plane?

Have you had any luck with this, Jacob? I’ve tried this method in more recent versions and I always get the error “expected XYZ, got Reference” for the reference plane reference. Any ideas?

Nick if you post what you’ve tried I’ll try and find time to review it tonight.

Poke me in 10 hours incase I forget though. No time to play today unfortunately.

2 Likes

Real straight forward test. Just a face-based family on a vertical reference plane.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DSCoreNodes')
from DSCore import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
refPlane = UnwrapElement(IN[0])
point = UnwrapElement(IN[1])
refDir = UnwrapElement(IN[2])
symbol = UnwrapElement(IN[3])

TransactionManager.Instance.EnsureInTransaction(doc)
newFam = doc.Create.NewFamilyInstance(refPlane.GetReference(),point,refDir,symbol)
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = newFam

No rush on this either. If you have time to look at it, great, but it was just something I was trying out.

I believe because you weren’t constructing your point and vector as XYZs, that particular Create.NewFamilyInstance method was just not being recognized and was throwing a confusing error. The following works:

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
refPlane = UnwrapElement(IN[0])
point = UnwrapElement(IN[1])
refDir = UnwrapElement(IN[2])
symbol = UnwrapElement(IN[3])


TransactionManager.Instance.EnsureInTransaction(doc)

newFam = doc.Create.NewFamilyInstance(refPlane.GetReference(), XYZ(point.X, point.Y, point.Z), XYZ(refDir.X,refDir.Y,refDir.Z), symbol)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = newFam
4 Likes

Ugh. I always forget that UnwrapElement doesn’t convert points to XYZs. :roll_eyes:
I need to use ToRevitType().
Thanks, Amy!

2 Likes

@awilliams well done as always!

2 Likes

@JacobSmall @Nick_Boyts @awilliams wel done as Always! I am going to test this tommorrow
Maybe of topic But is it also possible with structural framing?

Yes, just adjust the script to utilize this method: http://www.revitapidocs.com/2018/4545a04f-b5e8-1921-5a4c-d734bc4874ca.htm

EDIT: apologies @Nico_Stegeman that method doesn’t appear to work for the CurveDrivenStructural FamilyPlacementType… there might be another way, maybe reassigning the host after it is drawn :thinking:

EDIT 2: Scratch that idea, the host property is also read-only… I’ll let you know if I think of anything else

1 Like

Thanks I am going to try this

reassigning the host after it is drawn i never have been able to do that

Thanks everyone for the answers and thanks Nico for getting the right people for the topic! I’ll try to get it work!

1 Like

Sorry to revisit this old post.

I am using a very similar code, in fact, the only difference in my code is the variable names and some formatting.

But I am getting the error message:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 32, in
Exception: Error code: 5

I have changed my code to match your entirely. Bu added an iteration over a list to create multiple instances as I am populating a surface.

What is even weirder is the fact that this code was working fine.
I have rebooted my computer and have no Idea of what could possibly be happening.
I cannot find anywhere what error code 5 means and importing the traceback module fails. So I can’t read specifics on the exception.

that is my code:

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
refPlane = UnwrapElement(IN[1])
points = UnwrapElement(IN[2])
refDir = UnwrapElement(IN[3])
symbol = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)
for point in points:
newFam = doc.Create.NewFamilyInstance(refPlane.GetReference(), XYZ(point.X, point.Y, point.Z), XYZ(refDir.X,refDir.Y,refDir.Z), symbol)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = newFam

Hello,

Sorry for reviving an old thread. I am also getting the error:

Exception: Error code: 5

Did you happen to find the solution to the issue? I am using Dynamo 2.0.1 in Revit 2017.

Are you trying to use Dynamo Nodes or Python?
Can you upload a screen capture of your graph. I have been working something very similar and may be able to help