简体   繁体   English

托管对象无效-Dynamo崩溃

[英]The managed object is not valid - Dynamo Crashes

The following error in Dynamo is bugging me since many hours. 由于许多小时,Dynamo中的以下错误困扰着我。

Warning : 警告

IronPythonEvaluator.EvaluateIronPythonScript operation failed. IronPythonEvaluator.EvaluateIronPythonScript操作失败。

Traceback (most recent call last): 追溯(最近一次通话):

File " < string > ", line 33, in < module> 文件<<字符串>,第33行,在<模块>

Exception: The managed object is not valid. 例外:被管理对象无效。

在此处输入图片说明

I'm not sure why the error has occur would appreciate if someone share its solution with me. 如果有人与我分享解决方案,我不确定为什么会发生错误。 Thank you 谢谢

import clr

clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit

clr.ImportExtensions(Revit.Elements)

# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
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

# Import RevitAPI
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

import sys

pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

The above are my standard imports while working with Dynamo/Revit API. 以上是我在使用Dynamo / Revit API时的标准导入。 It has been working for me for a while. 它为我工作了一段时间。

In all honesty I wish I had an "actual" answer why your script is not working. 老实说,我希望我有一个“实际”答案,为什么您的脚本不起作用。 The only thing that is different than mine, is order in which you reference certain things. 与我的唯一不同的是引用某些事物的顺序。 That should have no effect on their validity. 那不会影响其有效性。 It's Dynamo though, and it's very capricious. 不过是Dynamo,而且反复无常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM