DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
339 stars 188 forks source link

Type node returned Revit.Elements.FamilyType instead of Autodesk.Revit.DB.FamilySymbol #1507

Closed paoloemilioserra closed 7 years ago

paoloemilioserra commented 7 years ago

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

Dynamo version

1.2.1.0383

Revit version

2017

Operating system

W7

What did you do?

in a Python node:

Copyright 2017 Autodesk, Inc. All rights reserved.

import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager from System.Collections.Generic import clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

collector = FilteredElementCollector(doc)

symbols = collector.OfClass(FamilySymbol)

targets = symbols.OfCategory(BuiltInCategory.OST_GenericModel)

final = targets.FirstElement()

OUT = final

Connected the output to a Type node

What did you expect to see?

Autodesk.Revit.DB.FamilySymbol

What did you see instead?

Revit.Elements.FamilyType

ksobon commented 7 years ago

That's because Python components automatically "wrap" outputs into Dynamo equivalents. That is to ensure that no exposed Revit element is floating on dynamo canvas. What did you plug it into? What were you trying to do?

Ps. This is not a bug, but rather Dynamo Python functionality and at this point standard behavior. I don't like it either, but asking people to "wrap" outputs on their own was too much to ask.

mjkkirschner commented 7 years ago

@paoloemilioserra what type node did you use?

paoloemilioserra commented 7 years ago

image

paoloemilioserra commented 7 years ago

I'm doing a Dynamo course and I'm trying to explain the difference between Revit API namespaces and Dynamo for Revit ones, in particular the conversion ToDSType(), I've figured it out in a different way, but I wasn't expecting this behavior.

"If you try to pass the final as an argument for FamilyInstance.ByPoint() without the conversion ToDSType() it will fail ... just look at the Object.Type..." (last famous words...!)

ksobon commented 7 years ago

@paoloemilioserra I don't see anything wrong here. Like I said before Python node is automatically wrapping your outputs into most feasible Dynamo wrapper so that if possible you don't pass naked Revit API objects around on canvas. This is an expected behavior. You can pass some things out that won't get wrapped automatically, but that will only happen for things that Dynamo team has not encapsulated yet. I would close this issue, as it's not really a bug.

ksobon commented 7 years ago

cc: @kronz can we close this? This isn't an issue. It's an expected behavior.