DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
328 stars 184 forks source link

Wishlist: Dynamo solids to Revit voids #2176

Open ColinDayOrg opened 5 years ago

ColinDayOrg commented 5 years ago

Issue by eproca Sunday Mar 22, 2015 at 17:30 GMT Originally opened as https://github.com/DynamoDS/Dynamo/issues/4061


Probably the way that the solid geometry created in Dynamo is “imported” in Revit will be greatly enhanced soon. Anyway this can be an easy but practical possibility.

Recently I have been working many times creating solid geometry in Dynamo that will subtract other elements. But this operation is doing in Revit via “Cut”. This way of working is rather convenient and flexible for many reasons.

Right now, every time that I create the solid geometry in Dynamo I have to: 1.Move the elements to Revit via ImportInstance.ByGeometry 2.Explode the imported instance in Revit 3.Change the type of solid to “void”

A method that put the solid geometry in Revit directly as Revit solid would avoid having to explode the element every time. And ideally you will have the option that the element will be a “void”, so you don’t have to change the type manually .

ColinDayOrg commented 5 years ago

Comment by dimven Monday Mar 23, 2015 at 12:29 GMT


Correct me if I'm wrong but I thought that functionality already exists with "Form.ByLoftCrossSections" capture1 However I've found out that Revit's native solid creation methods are quite poor compared to Dynamo's.

ColinDayOrg commented 5 years ago

Comment by eproca Monday Mar 23, 2015 at 13:34 GMT


Hi Dimitar,

Reading your answer I am wondering If I explained myself before. In the kind of workflows that I was thinking, the solid geometry used to cut has to be created using Dynamo own geometry tools. And normally, if they will be many elements to cut the same revit entities , they are joined in one single solid in Dynamo before importing in Revit. So later in Revit I can cut with hundreds of entities in one single and fast step.

This workflow is working really well. The only thing I am wondering is why I have to explode every time in Revit the geometry created in Dynamo in order to be used to cut. If I am creating this solids with Dynamo linked to Revit and when imported in a Revit family and exploded they are recognized perfectly as solids…..why they are not translated as solids in first place instead of an imported instance?

Anyway I didn’t know that you can drive with Dynamo the creation of Revit Loft Forms. Thanks

ColinDayOrg commented 5 years ago

Comment by dimven Monday Mar 23, 2015 at 14:40 GMT


Seems like the API is pretty limited in that regard as well - the explode command is not exposed. However there might be a possible workaround with "FreeFormElement.Create()" if you can somehow trick the API and translate a Dynamo solid into a Revit solid.( xx.ToRevitType() converts solids into triangular meshes) edit: more info here - https://forums.autodesk.com/t5/revit-api/explode-sat-dwg-after-import/m-p/5501232?nobounce

ColinDayOrg commented 5 years ago

Comment by eproca Monday Mar 23, 2015 at 15:17 GMT


Thanks Dimitar. Quite interesting the link. Even if the explode command is not exposed (by the moment) to the API, it seems that maybe it is not needed at all......

ColinDayOrg commented 5 years ago

Comment by dimven Tuesday Mar 24, 2015 at 06:43 GMT


Hi Eduardo, I toyed around with the above concept and came up with the following:

2015-03-24_143721

Hope it helps. Toggle to false for a void.

ColinDayOrg commented 5 years ago

Comment by eproca Tuesday Mar 24, 2015 at 19:04 GMT


Many thanks Dimitar,

I was posting this as something nice to have in the future. Anyway you can always manually explode the imported instance created.

So I wasn’t expecting any solution for doing it NOW. I am impressed that you managed to do it.

It is a pity that you cannot convert directly a Dynamo solid to a Revit solid via APi in the python script. The irony here is that the solids created in Dynamo when hosted in Revit are as “alien” to Revit as they were created with any other software and imported via SAT

I hope that this will change soon.

ColinDayOrg commented 5 years ago

Comment by eproca Wednesday Mar 25, 2015 at 17:35 GMT


Hi again Dimitar, Please, can you copy and paste here the text of the python node?

Many thanks!!

ColinDayOrg commented 5 years ago

Comment by eproca Wednesday Mar 25, 2015 at 22:20 GMT


Dont mind, the text was not that long after all...

After playing a bit, it is really interesting. But in different scenario. When you import solid geometry in a family, maybe you will explode it. I mean solid geometry made in another software in general, not made with Dynamo hosted in Revit.

If the solid geometry is a bit complex, sometimes you will have problem with exploding it. Some elements will go away or even the whole thing. But, if via API you extract the geometry and create the freeform, it seems that you are not having any problem at all.

I have to try in more situations. But in a few that the explode were not working, now it is fine.

So maybe this is not just an alternative because currently explode is not exposed to the API. It looks like a better method than explode.

Again many thanks for this solution

ColinDayOrg commented 5 years ago

Comment by dimven Thursday Mar 26, 2015 at 01:32 GMT


Glad it helped. Sorry I forgot to post the code as well. Here it is for future reference:

import clr clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) clr.AddReference("RevitAPI") import Autodesk clr.AddReference("System") from System.Collections.Generic import * dataEnteringNode = IN el1 = UnwrapElement(IN[0]) TransactionManager.Instance.EnsureInTransaction(doc) opt1 = Autodesk.Revit.DB.Options() opt1.ComputeReferences = True geom1 = el1.get_Geometry(opt1) enum = geom1.GetEnumerator() enum.MoveNext() geom2 = enum.Current.GetInstanceGeometry() enum2 = geom2.GetEnumerator() enum2.MoveNext() x = enum2.Current OUT = Autodesk.Revit.DB.FreeFormElement.Create(doc,x),el1 TransactionManager.Instance.TransactionTaskDone()

@ikeough Could we expect a proper Dynamo node that does something similar?

ColinDayOrg commented 5 years ago

Comment by ikeough Thursday Mar 26, 2015 at 04:21 GMT


Hi @eproca and @dimven. This is a really cool hack.

The problem for us is that there is no way via the Revit API to import an ASM solid directly into Revit to be used for a FreeForm. We're working with the Revit team on a way to do this, but it will not be available as quick as you might need it. I hesitate to make your proposed solution a built-in functionality because Import Instances are slightly scary. We only really use them because it's the only way to get our geometry into Revit as elements at present. As soon as we get something better we're dropping ImportInstances like a bad habit. Also, as you point out, there's no guarantee that the geometry will always be a correct solid once your start getting objects out of the instance.

We're tracking this internally as MAGN-6779.

ColinDayOrg commented 5 years ago

Comment by dimven Friday Apr 10, 2015 at 06:27 GMT


Hi guys, I was looking in the API documentation for 2015 the other day and the two new methods for "TessellatedShapeBuilder" and "DirectShape" that were introduced to better handle IFC imports management peaked my interest. Would any of the two methods be useful for the above problem?

ColinDayOrg commented 5 years ago

Comment by josols Saturday May 02, 2015 at 07:59 GMT


Hi all, I've also read about the 2016 API, and direct shape. It also mentions a new class called WireframBuilder which can create geometry by curves and points. For a layman like myself that sounds very promising. Or am I just being naive? :)

ColinDayOrg commented 5 years ago

Comment by dimven Tuesday May 12, 2015 at 03:22 GMT


@josols As I mentioned above, Revit 2015 already exposes Direct Shape objects and I was able to create some from Dynamo solids with a method similar to the one shown above.

I can see solids and surfaces being useful but how exactly can points and lines benefit you? Keep in mind that you can already import almost any curve with "ModelCurve.ByCurve".

What kind of functionality would you like to see?

ColinDayOrg commented 5 years ago

Comment by josols Tuesday May 12, 2015 at 09:01 GMT


@dimven If you've proceeded to import solids directly to, for instance, a mass in Revit, and also that the solid is able to be handled like any other Revit created solid afterwards, then that is the kind of functionality I was looking for. Is this functionality exposed by Directshape? The reason for mentioning curves/points was only because I thought it may provide a solution for creating a Wireframe of curves/points for Revit to create a solid from so that it is editable in standalone Revit afterwards. Much like the built in function of "Create Form" does. Would love to see some examples if you managed to import solids via DirectShape, and according to Ian Keough's response to my question at the Webinar at CASE the other day so would the developers! :)

To include one example that I'm trying to achieve: Get a topo to cut an inplace family. I figured the best way would be if I could create a Void mass directly from a topo and use this to cut geometry.

ColinDayOrg commented 5 years ago

Comment by dimven Tuesday May 12, 2015 at 09:55 GMT


I'm not sure if things have improved in Revit 2016 but from my experience in R15, DirectShape elements are pretty limited and bare-bone. They are not editable. They cannot be used for references and thus cannot be cut or cut other elements. They do have some benefits over sat imports tho. They can be assigned to a category and thus you can apply parameters and graphical overrides to them.

2015-05-12_17-41-28

So for your example, you will have to perform all the solid boolean operations inside Dynamo and then import the end result as an un-editable DS element. Not sure if that is a good work flow tho.

ColinDayOrg commented 5 years ago

Comment by eproca Sunday May 17, 2015 at 10:25 GMT


@dimven I have used until now quite a bit the workflow of creating freeform element via the Revit API (always in generic families). To put in Revit geometry created in Dynamo or somewhere else. And the result is quite positive. Not perfect but far better that import and explode:

-Far more robust with complex geometry -Diferent solids become diferent Revit entities (with import and explode they get unified in one element) -If it makes sense and the solid is not very complex, direct edit with the grips will get the expected correct result -they will cut any other solid geometry in the family. Or when inserted in the project (if the family is configured to do that) -In a wall family (in place) the will work for limits of rooms