I tried this designscript in python.
Its giving me the following error.
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 81, in
AttributeError: ‘Autodesk’ object has no attribute ‘Geometry’
following is the code.
Enable Python support and load DesignScript library
import clr
import sys
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference(‘DSCoreNodes’)
from DSCore.List import Flatten
from Autodesk.Revit.DB.Electrical import*
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
import System
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
import collections
def ToInternalUnits(number, unittype = None):
if unittype == None:
unittype = UnitType.UT_Length
currentType = doc.GetUnits().GetFormatOptions(unittype).DisplayUnits
return UnitUtils.ConvertToInternalUnits(float(number), currentType)
UIunit = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits
The inputs to this node will be stored as a list in the IN variables.
Door = UnwrapElement(IN[0])
Height_Offset = IN[1]
Offset_From_Wall = IN[2]
Place your code below this line
Location_Point = Door.Location.Point
Door_TypeId = Door.GetTypeId()
Door_Type = doc.GetElement(Door_TypeId)
Para_Width = Door_Type.LookupParameter(“Width”)
Para_WidthValue = Para_Width.AsDouble()
Para_WidthValueInmm = Para_WidthValue*304.8
Width_Half = Para_WidthValueInmm/2
HostWall = Door.Host
Location_Curve = HostWall.Location.Curve
Vector_ = Location_Curve.Direction.ToVector()
NewPoint = XYZ(Location_Point.X,Location_Point.Y,Location_Point.Z+ (Height_Offset/304.8))
pt_Dyn = Autodesk.DesignScript.Geometry.Point.ByCoordinates(UnitUtils.ConvertFromInternalUnits(NewPoint.X,UIunit),UnitUtils.ConvertFromInternalUnits(NewPoint.Y,UIunit),UnitUtils.ConvertFromInternalUnits(NewPoint.Z,UIunit))
Total_Offset = Width_Half + Offset_From_Wall
Translated_geometry = Autodesk.Geometry.Translate(NewPoint, Vector_, Total_Offset)
Assign your output to the OUT variable.
OUT = Translated_geometry