i tried to implement following code (stripped).
it shall run in python shell (outside dynamo)
funny now is, that when i run the code with Dynamo in background everything runs fine.
alone - an exception is thrown.
libraries loaded are according to the long time existing migration guide.any suggestions?
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
clr.AddReference('RevitNodes')
import Revit
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, IntersectionResultArray, \
SetComparisonResult, Options, ViewDetailLevel
clr.ImportExtensions(Revit.GeometryConversion)
doc = __revit__.ActiveUIDocument.Document
def collectWalls():
curview = doc.ActiveView
cl = FilteredElementCollector(doc, curview.Id)
stdwalls = cl.OfCategory( BuiltInCategory.OST_Walls ).WhereElementIsNotElementType().ToElements()
return(stdwalls)
walls = collectWalls()
options = Options()
options.DetailLevel= ViewDetailLevel.Fine
for wall in walls:
wallSolid = list(wall.get_Geometry(options))[0]
print wallSolid # for debug shall show Solids
dynamoSolid = wallSolid.ToProtoType()`
the code results in an exception:
IronPython Traceback:
Traceback (most recent call last):
File “C:\ProgramData\pyRevit\pyRevit-v45\pyRevit\extensions\kopEX2.extension\kopEX2.tab\Kennwerte.panel\Berechnungen.splitbutton\Kennwerte berechnen.pushbutton\Kennwerte V3_script.py”, line 31, in
NotImplementedError: Die Methode “Approximate” im Typ “Autodesk.LibG.CurveHost” der Assembly “LibG.ProtoInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null” hat keine Implementierung.
Script Executor Traceback:
System.NotImplementedException: Die Methode “Approximate” im Typ “Autodesk.LibG.CurveHost” der Assembly “LibG.ProtoInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null” hat keine Implementierung.
bei Autodesk.DesignScript.Geometry.HostFactory.get_Factory()
bei Autodesk.DesignScript.Geometry.Point.ByCoordinates(Double x, Double y, Double z)
bei Revit.GeometryConversion.RevitToProtoCurve.Convert(Line crv)
bei Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(Curve revitCurve, Boolean performHostUnitConversion, Reference referenceOverride)
bei Revit.GeometryConversion.RevitToProtoFace.EdgeLoopsAsPolyCurves(Face face, IEnumerable1 edgeLoops) bei Revit.GeometryConversion.RevitToProtoFace.ToProtoType(Face revitFace, Boolean performHostUnitConversion, Reference referenceOverride) bei Revit.GeometryConversion.RevitToProtoSolid.ToProtoType(Solid solid, Boolean performHostUnitConversion) bei Microsoft.Scripting.Interpreter.FuncCallInstruction
3.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
bei System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
bei Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
bei Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
bei IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
bei Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
bei PyRevitBaseClasses.ScriptExecutor.ExecuteScript(PyRevitCommandRuntime& pyrvtCmd)