DynamoDS / Dynamo

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

Equal node cannot compare all data types #878

Closed andydandy74 closed 10 years ago

andydandy74 commented 10 years ago

I know I could just check if there's a distance between these two XYZs, but I think it would make sense if the Equal node were able to compare elements of this data type as well. Also, I think it would be better if the Equal node actually went into an error state once it encounters data types it's not designed to deal with. bildschirmfoto 2013-12-02 um 15 48 09

andydandy74 commented 10 years ago

And Revit components... bildschirmfoto 2013-12-03 um 11 09 06 In the 0.6.2 release notes it says: Equal can now compare all data types Strangely enough, I am running 0.6.2 ... ;-)

LevL commented 10 years ago

Seems bug on the line: | [Container(o1); Container(o2)] when o1 = o1 || o1.Equals(o2) -> Number(1.) in FScheme.fs. o1 is always o1, should be o2? Thanks a lot for pointing the issue! After fix XYZ object comparison should return false unless comparison is done to the same object even if numbers are same (to the best of my understanding).

Steell commented 10 years ago

fixed in 20b0b8aceed03690cc0c41233a50b0d62ece8de3

andydandy74 commented 10 years ago

This is not working yet - at least not for Revit elements: unbenannt Build 0.6.3.5262

andydandy74 commented 10 years ago

Please reopen this one - I'm still having this issue.

Steell commented 10 years ago

@LevL is the problem here that the RevitAPI does not supply an Equals() implementation for Elements?

LevL commented 10 years ago

I looked for XYZ class "Equals" override (actually, lack of it). No one for the Element class either. There is one for GeometryObject class, but it just compares references.

There are useful methods in Revit API: Element Id comparison, element's guid access, "is_almost_equal" (not 100% sure about the name) method for XYZ and UV classes, etc. To me it looks like Dynamo needs to have its own manual implementation.

One more thing to consider: if the same element is changed by different portions of the graph the order of changes to the element is not assured (and hence which one wins). Read-only access seems ok, but changes applied to same element in different places could easily get problematic. Say, family instance could be moved to different locations by different nodes in the graph. Is there way to flag this as an error or a warning?

jbenoit44 commented 10 years ago

HI there, any news on this? I have a problem of the same kind when I want to filter out element from lists based on the ID. One list contains all IDs, let say 5, one list only 2 IDs, I need the result list containing 3 remaining items. I tried with equal node with no luck. image error says: Key mapper result Autodesk.Revit.DB.Wall is not Comparable, and thus cannot be sorted. same when using Element's IDs.

andydandy74 commented 10 years ago

Julien, I had the same issue a while back. As long as this is not resolved you can use the following nodes to get this workflow done:

jbenoit44 commented 10 years ago

yep I tried with those great nodes. Just need some time to set this correctly in my test case.

Julien BENOIT

Le 27 févr. 2014 à 09:30, Andreas Dieckmann notifications@github.com a écrit :

Julien, I had the same issue a while back. As long as this is not resolved you can use the following nodes to get this workflow done:

Element to IDs List Contains Filter By Boolean Mask IDs to Elements — Reply to this email directly or view it on GitHub.