import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
dataEnteringNode = IN
point = IN[0]
familytype = IN[1]
try:
x = DSCore.FamilyInstance.ByPoint(familytype,point);
except Exception as e:
s = str(e)
OUT = s
You don’t have to import DSCore but rather RevitNodes.
import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
point = IN[0]
familytype = IN[1]
try:
x = Revit.Elements.FamilyInstance.ByPoint(familytype,point)
except Exception as e:
s = str(e)
OUT = x
This is because the script calls the Dynamo node in python and doesn’t use the Revit API.
There is no need to unwrap the FamilyType, convert the dynamo point and use transactions.
The Revit API method is doc.Create.NewFamilyInstance(XYZ,FamilySymbol,StructuralType)
@callbowen: it’s probaly because your IN[0] becomes a list of points instead of just one point :).
To correct this, you need to loop through your points with a for loop:
“for p in points”:
x = Revit.Elements.FamilyInstance.ByPoint(familytype,p)
Edit:
You might find this thread useful regarding passing a list or not a list to your python script.