6

これが IronPython の問題なのか、Revit API アセンブリの問題なのか、それとも何か他の問題なのか、私にはわかりません。これを引き起こしている可能性のある情報/アイデアは大歓迎です。

これは同じ名前空間を再度インポートすることで解決できることは理解していますが、その理由を理解したいと思っています。

以下は、何が起こっているかの短い例です。イメージは RevitPythonShell コンソールの出力を示しています。

File1.py

import clr
clr.AddReference('RevitAPI')      # Contains Imports Autodesk.Revit.DB
from Autodesk.Revit import DB     # OK
DB.Element.Name                   # OK
DB.Element.Name.GetValue()        # OK: Method exists. As Expected

File2.py

from File1 import DB
DB.Element.Name                   # OK, Property Exists
DB.Element.Name.GetValue()        # *** Method DOES NOT Exist, Attribute Error is raised
from Autodesk.Revit import DB     # Re-import the same namespace again
DB.Element.Name.GetValue()        # OK:  Method Exists 

ここに画像の説明を入力

ここに画像の説明を入力

4

0 に答える 0