BUMP
This occurs in consequence of non properly “referenceDirection” usage.
I made several tests and I’m discovered that this direction should be orthogonal to the normal of the plane of the host.
The method NewFamilyInstance have a lot of overloads and I used this as follow below
Here is my code.
#Copyright(c) 2016, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
# edited by onBIM
# www.onbim.com.br
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
import Autodesk
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
toggle = IN[0]
familyType = UnwrapElement(IN[1])
referencePlane = UnwrapElement(IN[2])
refDirection = IN[3].ToXyz(True)
locationPoints = IN[4]
result = []
if toggle:
strt = Autodesk.Revit.DB.Structure.StructuralType.NonStructural
TransactionManager.Instance.EnsureInTransaction(doc)
if not familyType.IsActive : familyType.Activate()
for dynPoint in locationPoints:
revitPoint = dynPoint.ToXyz(True)
# nFamily = doc.Create.NewFamilyInstance(revitPoint, familyType, refDirection, referencePlane, strt)
nFamily = doc.Create.NewFamilyInstance(referencePlane.GetReference(), revitPoint, refDirection, familyType)
result.append(nFamily)
# Original code for Dimitar Venkov
# for i in xrange(len(locationPoints)):
# p = locationPoints[i].ToXyz(True)
# if not familyType[j].IsActive : familyType[j].Activate()
# level = doc.GetElement(referencePlane[k].LevelId)
# nf = doc.Create.NewFamilyInstance(p,familyType[j],referencePlane[k],level,strt)
# result.append(nf.ToDSType(False))
TransactionManager.Instance.TransactionTaskDone()
OUT = result
Hi Ricardo,
Would you be so kind to share the dyn-file you used, so I can see how this script works (input/output).
Thanks in advance.
Best regards, Fred