DynamoDS / Dynamo

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

Migration issue: How to get Revit face? #1704

Closed andydandy74 closed 10 years ago

andydandy74 commented 10 years ago

Prior to 0.7.x selecting a face would give me the Revit Face. Now I get a DS Surface. How do I get the Revit Face if I want to access its properties? Is there a node that I have overlooked? Another thing: Element.Faces is categorized under Revit in the node browser - if it doesn't get me a Revit element or Revit geometry, shouldn't it be categorized under Geometry? howtogetrevitface

eproca commented 10 years ago

With properties of the face, do you mean revit related properties or general geometrical properties (area, perimeter...etc)?. As a normal surface you can get as usual the second group

andydandy74 commented 10 years ago

Revit related properties, unfortunately...

eproca commented 10 years ago

I assume that you need more than the ones avaliables in Revit>Element>Query. (to be used after Select Model Element and before extracting the surface, obviously). I have never tried for faces so I can not tell about how they work.

Maybe we need specific query methods for revit faces

andydandy74 commented 10 years ago

Have a look at the graph above. Element.Faces is listed under Revit.Element.Query but returns a DS.Surface - not very useful... ;-)

eproca commented 10 years ago

I have seen it. I understand the problem, Select face is not consistent with other select revit elements methods. It returns directly a dynamo surface. Its practical, because it avoids the aditional step of extracting the geometry. but there is not revit face to query the revit properties.

I was wondering if you can select the face via Select model element (for example a face in the conceptual mass enviroment) and query the revit properties

(note: i just discover Element.ElementFaceReferences that is returning a "Revit.GeometryReference.ElementFaceReference" for every face of a wall for example. I haven't figure out yet how to query the revit properties of every face with it )

andydandy74 commented 10 years ago

That might possibly work - no idea. I guess my point is: This used to work - why doesn't it work anymore?

riteshchandawar commented 10 years ago

Thank You for reporting!

We know that with new implementation, selecting a Face in Revit will convert that in DS Surface in Dynamo.

We are tracking this issue internally with issue ID MAGN-3641

pboyer commented 10 years ago

Hi andreas,

What kind of properties do you wish to extract from the face? I can provide those. There are also mechanisms to obtain the Reference from the surface presently or passing around the face reference directly. This will allow you to do a reverse lookup. This is why you can hand such a surface to a divided surface node in 070.

Part of the idea of this implementation is to have a single unified geometry library. Consider the alternative - we could provide both (revit face AND an asm face), but this is highly confusing to new users. Beyond providing a user with the greatly increased power of the asm representation (try evaluating principal curvatures on a revit face or constructing a solid manually from a collection of faces - either quite difficult or impossible), this facilitates moving workflows between standalone, revit and other apps.

If you can elucidate what particular properties you are looking for, I can make them available or show you how to get them. :)

Sorry if this is poorly written I wrote it on my cell. ;) On Jun 3, 2014 4:31 AM, "riteshchandawar" notifications@github.com wrote:

Thank You for reporting!

We know that with new implementation, selecting a Face in Revit will convert that in DS Surface in Dynamo.

We are tracking this issue internally with issue ID MAGN-3641

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

andydandy74 commented 10 years ago

Peter, in this case I was trying to migrate a node that is using the Triangulate() method, but here are some examples of other Revit specific properties and/or methods that would be valuable to access:

And of course the different face classes in the Revit API have some unique properties, too (e.g. RevolvedFace.Radius). Plus it might be necessary to access the underlying form element. Or I might want to create a node that places a face-based family. All of this was easy as pie (or at least possible) in 0.6.3 ... I understand completely why Dynamo is using the ASM library and I'm all for it. And I am all for not confusing new users, too. But let's not confuse the old users either, please... ;-) So I would really like to learn how I can get from an ASM face to the corresponding Revit face in Dynamo (and its properties)

pboyer commented 10 years ago

Hi Andreas,

It is possible to obtain the Revit geometry Reference from the ASM Surface and then look up the Face from the Reference via the Revit API.

I assume that you intend to call these kinds of methods from Python, as I don't think any of them were a node in Dynamo.

Anyhow, the quick fix is to do this in your python code, where surface is the ASM surface returned from Select Face:

ref = surface.Tags.LookupTag("RevitFaceReference");

Simply put, the ASM Surface is "tagged" with the Reference, so you can look it up. The above code returns the Revit geometry Reference. I say it's the "quick fix" because there is a better way to do it that I have not yet exposed as public API. :( I am currently at a conference, but it should be as easy as surface.GetRevitGeometryObject().

Then, you can look up the Face in the document like this:

face = document.InternalDocument.GetElement(ref). GetGeometryObjectFromReference(ref);

Where document is the what's returned from the node Document.Current.

Just for record, here is where you can find the RevitNodes library, which is where Revit functionality lives in the new world:

https://github.com/DynamoDS/Dynamo/tree/master/src/Libraries/Revit/RevitNodes

~Peter

On Wed, Jun 4, 2014 at 12:16 AM, Andreas Dieckmann <notifications@github.com

wrote:

Peter, in this case I was trying to migrate a node that is using the Triangulate() method, but here are some examples of other Revit specific properties and/or methods that would be valuable to access:

  • GetRegions()
  • GraphicsStyleId
  • HasRegions
  • MaterialElementId
  • Visibility

And of course the different face classes in the Revit API have some unique properties, too (e.g. RevolvedFace.Radius). Plus it might be necessary to access the underlying form element. Or I might want to create a node that places a face-based family. All of this was easy as pie (or at least possible) in 0.6.3 ... I understand completely why Dynamo is using the ASM library and I'm all for it. And I am all for not confusing new users, too. But let's not confuse the old users either, please... ;-) So I would really like to learn how I can get from an ASM face to the corresponding Revit face in Dynamo (and its properties)

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

andydandy74 commented 10 years ago

Works like a charm. asmtorevt With your permission, I would like to upload this to the package manager and keep it in there as long as there is no built-in node for this. Enjoy the conference!

dronov-dmitry commented 9 years ago

Hi Andy. Sorry, but where i can find this custom node?

andydandy74 commented 9 years ago

@dronovdmitry - This code is being used in thre custom nodes in package Clockwork: RevitFaceReference.FromDynamoSurface, RevitFace.FromDynamoSurface & Element.FromDynamoSurface. Apparently there are some element types that seem incompatible with this code, though: #3821

dronov-dmitry commented 9 years ago

Ok. I understand. But i try to set Paint method to geometry in dynamo and i cant do this..... Because dynamo node "Select face" break away geometry face from element and all his parameter.... such as Id... How can i take element ID from surface? http://joxi.ru/KAxVNV7fQVqYm8?d=1 Thanks

moethu commented 8 years ago

Hi there,... some years later another question about this. I need to get the Revit Face because the U,V space of the Dynamo Faces are not correct. So I tried all the mentioned ways but none of them worked out. Do you have any suggestion for Dynamo 0.8?

moethu commented 8 years ago

Using GetRevitType gives me a Mesh, maybe there is a way to get from the Mesh to a Revit Face?

andydandy74 commented 8 years ago

@moethu - the UV coordinates are a known problem: #3423 Follow the link for a workaround...

moethu commented 8 years ago

that's one issue, but I was wondering if there is a way to map the U,V coordinates to the surface because right now the U,V coordinates are only on the surface if it is a rectangle. 2015-07-23_08h47_01 I assumed the U,V coordinates would be mapped to odd shaped surfaces as well. So I am up to implement a rescaled U,V Space but therefore I would need the original Revit Face to evaluate if the point is actually on the surface or not. Another solution would be to evaluate points along the edges of the surface and then evaluate a point along this line. But this wouldn't cover curved surfaces or various number of edges... any idea?

moethu commented 8 years ago

Never mind, I implemented a Surface wrapper allowing for parametrization on odd shaped surfaces within the boundaries. Code will be public soon. Thanks. 2015-07-23_11h47_31