DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.68k stars 622 forks source link

document.current always null #3166

Closed epeter- closed 9 years ago

epeter- commented 9 years ago

the document.current node always results in null. daily build 7.4.3192 used as input in "ID to Elements" and "id to Elements" worked in earlier releases

ikeough commented 9 years ago

@epeter- Not seeing it in the current daily build.

image

epeter- commented 9 years ago

doc

actually the doc is forwarded to the custom node's python code. so maybe the document's problem is the python?

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

Import DocumentManager

clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager

Import RevitAPI

clr.AddReference("RevitAPI") import Autodesk

Import ToDSType(bool) extension method

clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements)

The inputs to this node will be stored as a list in the IN variable.

dataEnteringNode = IN

doc = DocumentManager.Instance.CurrentDBDocument

doc = IN[1]

unwrap incoming information for use with API

ids = [] for i in IN[0]: ids.append(UnwrapElement(i))

use element ids to select elements

elements = [] for i in ids:

check if id is string

if isinstance(i, str) and len(i) <= 7:
    idInt = int(i)
    elemId = Autodesk.Revit.DB.ElementId(idInt)
    elements.append(doc.GetElement(elemId).ToDSType(True))
elif isinstance(i, int):
    elemId = Autodesk.Revit.DB.ElementId(i)
    elements.append(doc.GetElement(elemId).ToDSType(True))
elif isinstance(i, Autodesk.Revit.DB.ElementId):
    elements.append(doc.GetElement(i).ToDSType(True))
elif isinstance(i, str) and len(i) >= 8:
    elements.append(doc.GetElement(i).ToDSType(True))
else:
    OUT = "invalid input"

Assign your output to the OUT variable

OUT = elements

epeter- commented 9 years ago

Actually i used that workflow in 7.xxx in daily builds as from 20141115 i am missing "Document.InternalDocument" node Am 18.11.2014 13:28, schrieb Ian Keough:

@epeter- https://github.com/epeter- Not seeing it in the current daily build.

image https://cloud.githubusercontent.com/assets/1139788/5087249/2a2af0ee-6edb-11e4-9003-40e0280d5187.png

— Reply to this email directly or view it on GitHub https://github.com/DynamoDS/Dynamo/issues/3166#issuecomment-63463114.


Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv. http://www.avast.com