Place family workplane problem

I have a problem with placing family with Dynamo in Revit.
When I place a family with Dynamo the Work plane parameter is locked of the revit element.
And when I use the node element.setparameterbyName, I get the message workplane is read only.
The problem occurs with workplane based family’s.
how can I solve this?!

You’ll either have to set the active work plane before running the script or specify the work plane in the creation of the family. The latter would likely use this method: http://www.revitapidocs.com/2018/be4b822c-829a-7e7b-8c03-a3a324bfb75b.htm

import clr
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
symbol = UnwrapElement(IN[0])
refPlane = UnwrapElement(IN[1])
location = UnwrapElement(IN[2])
referenceDirection = UnwrapElement(IN[3])
out = []

symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)

new = doc.Create.NewFamilyInstance(reference,location.ToXyz(),referenceDirection.ToXyz(),symbol)

TransactionManager.Instance.TransactionTaskDone()

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

Thanks it works

Morning gents,

Thanks for your posts, it’s been really useful as I had the same issue with the grey workplane display…
I am now trying to modify the script in order to place family instances in several locations (points). This being said, the idea is to change every input to be a list, unfortunately my newbie experience on python doesn’t make it work. Any idea of where is my problem?
Many thanks!

import clr
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
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#The inputs to this node will be stored as a list in the IN variables.

symbol =
for i in IN[0]:
symbol.append(UnwrapElement(i))

refPlane =
for i in IN[1]:
refPlane.append(UnwrapElement(i))

points =
for i in IN[2]:
points.append(UnwrapElement(i).ToXyz())

referenceDirection =
for i in IN[3]:
referenceDirection.append(UnwrapElement(i).ToXyz())

out =

symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)

for s,v,p,d in zip(symbol,reference,points,referenceDirection):
new = doc.Create.NewFamilyInstance(s.Id,v.Id,p.ToXyz(),d.ToXyz())
out.append(new)

TransactionManager.Instance.TransactionTaskDone()

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

Hi Anthony.
I would like to feed the python node with a list of more points as well.
Did you ever manage to find a solution?

Place family at locations.dyn (10.8 KB)

Hi Dan,

Give it a go.

Thanks for sharing Anthony.

I just gave it a go, but the node doesn’t load :frowning:

I think i know what’s the issue :
Try do edit the node “Place families” and then find out which packages are missing.
Send me your dynamo file, I can have a look

Hi,

You also have to share separately the custom node “Place Families” (extension .dyf) because the custom nodes are never embedded in the dyn files.

Sure Anthony, here have a look:

Void_Implementation.dyn (79.6 KB)

And thanks again.

Can you dowload these packages and try again?
Then you just have to connect 1 family, 1 level(or ref plane), a list of points where you want the family to be placed and 1 vector.

Hope it helps

Hi,

Thanks for the reply’s on this post. But is it me or doesn’t the script work for multiple instances with multiple points and ref planes?

Does anybody know how to get it working?

Greets

I changed the script so it works with multiple families. If you want multiple instances of one family the family has to be repeated in list. You have to take X-Axis as Vector. I don´t really get the reason for that, because I would have picked the Z-Axis, but it works. With Z-Axis the script throws an error.

import clr
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
families = IN[0]
refPlane = UnwrapElement(IN[1])
location = IN[2]
referenceDirection = UnwrapElement(IN[3])

#symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)
OUT = []
for fam,loc in zip(families,location):
	uwFam = UnwrapElement(fam)
	uwFam.Activate()
	uwLoc = UnwrapElement(loc)	
	new = doc.Create.NewFamilyInstance(reference,uwLoc.ToXyz(),referenceDirection.ToXyz(),uwFam)
	OUT.append(new)
TransactionManager.Instance.TransactionTaskDone()

Sorry for asking this 2 years later, but even if I set the the work plane in revit before running the script I don`t get any luck. cheers.

Please show youre python script

1 Like

Hey, I was using the original script you posted, so no python.
As per @Nick_Boyts suggestion "You’ll either have to set the active work plane before running the script ", which I reckon happens in Revit I am still getting greyed out work plane.
Cheers.

import clr
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
symbol = UnwrapElement(IN[0])
refPlane = UnwrapElement(IN[1])
location = UnwrapElement(IN[2])
referenceDirection = UnwrapElement(IN[3])
out = []

symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)

new = doc.Create.NewFamilyInstance(reference,location.ToXyz(),referenceDirection.ToXyz(),symbol)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = new
1 Like

With the line:

symbol.Activate()

the family type get activated and then the family can be created and placed on the workplane with the next lines:

TransactionManager.Instance.EnsureInTransaction(doc)

new = doc.Create.NewFamilyInstance(reference,location.ToXyz(),referenceDirection.ToXyz(),symbol)

TransactionManager.Instance.TransactionTaskDone()

If you want to place multiple familyinstances you have to create a for loop in the python script