DynamoDS / Dynamo

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

Wish: Select Ref. Point (and other objects) and Drive it #154

Closed dbaldacchino closed 10 years ago

dbaldacchino commented 11 years ago

The Select nodes only retrieve information from existing objects such as Ref. points, lines, etc. What I'd like to have are similar nodes that let me pick an element to be driven. They would graphically be a mirror of the existing nodes (maybe have a flip control or data direction control added to the current Select nodes so they can do double duty?). For example I want to select a point, retrieve the value of Z, do some calculations on X and Y and feed the current Z coordinate and the calculated X and Y back to the same point. I guess this would be another example of recursion (not entirely sure this would qualify as recursion). I don't think we currently have the ability to do this, but this would open the possibility to create "constraining" systems that are currently not possible through calculating the behavior/location of elements based on some inputs. For example I could "constrain" a ref. point to always be on a particular plane: the user interacts with it and moves it vertically and the system calculates the appropriate X and Y coordinates so it stays "constrained" to the desired plane.

tatlin commented 11 years ago

Hi David, sounds like what you are asking for is the ability to set parameter values on more types of objects. You can do this for family instances now but it could be extended to work on general parameters of nobel objects. This would handle the use-cases described above.

dbaldacchino commented 11 years ago

Yes, forgot about that since I was just thinking of ref. points at the time. So if you extend that idea it would work. I was just thinking of the inverse of the Select nodes because that's what I was using in the proof of concept I was after.

proposed node

LevL commented 11 years ago

Hi David,

I would like to clarify your wish.

As stated I understood the wish as

I think this is possible with dynamic updates in Revit API (and hence in Dynamo) only if the result of computations does not change with following iterations. Plus UI actions (say, for your example of planar constraint) might be difficult for users as point might jump under the mouse position to the computed location.

It seems much cleaner to create new ref point on computed XYZ. So in your example user would interacts with ref. point, and dynamo put “shadow” ref. point at computed location, that could be used in downstream graph and/or model. Are the reasons for this not be the acceptable option?

Thanks, Lev

dbaldacchino commented 11 years ago

Hi Lev, I understand what you're saying but I was thinking that if the user moves a point in the Z direction, computation won't start until the user lets go of that point. True, the point would "jump" to it's new location after coordinates are computed but only after user lets go, unless Dynamo starts computing without the ref. point being released.

I am honestly still not clear what I'm after! Having a "shadow" point might work, although in that case I wouldn't even need to create a new point but instead take the XYZ and use it to place an adaptive component family directly.

Basically if a user is designing in pure elevation and the facade is made up of multiple tilted planar surfaces (imagine taking carboard and folding at various angles, resulting in surfaces of multiple edges...3, 4, 5, etc.), I want to be able to make adjustments in that elevation view (ex: ZX plane) and ensure that when a point is moved in the Z direction, it adjusts the X & Y so that the original planar surface stays planar and does not distort and become a double-curved surface instead.

LevL commented 11 years ago

Hi David, About your case of prismatic building, if I understood correctly.

What is not clear to me is that Point has to be on intersection of planes, and unless some of the planes change with the Point, Point could not move. Except one or two planes could stay "as is", in which case Point is hosted by Plane or Intersection Line of pair of planes (i.e. Point stays on plane or on line).

I worked recently on enabling possibly similar workflow which is hopefully coming on labs. The workflow I worked on is: define points (XYZs) controlling the desired shape (some might be hosted by line or by plane), then connect points with lines to define desired edges of the building, then define patch faces via loops of such lines (making plane or ruled surface with each loop as boundary), then build Solid (when shape is completed), and finally make Free Form element with resulting solid shape.

Could such approach help in your case? (I had to add to API a few utilities which is why this is not in Revit 2014.) Thanks!

dbaldacchino commented 11 years ago

Hi Lev, sorry for the late reply on this.

In your example, you're assuming a certain hierarchy where the point is hosted by the line or plane, correct? The way I'm seeing it (in order to actually make planar geometry possible from a design exploration perspective) is that points would be the primary pieces from which lines then pass through and connect these points, resulting in planar surfaces. I'm thinking of this from the perspective of planar coordinate geometry (trying to brush up on old unused math I learned years ago!) where I could in theory calculate the position of one axis of these points given that I know the other two. So for example in an elevation, I know the XZ or YZ coordinates (using my view plane as the axes) and if the user is moving one point at a time, you could calculate the resulting plane that contains one of the connecting points plus the edited point, after calculating the final position through the unknown axis calculation. Hope this makes sense!

I understand also that this might be possible for one plane, but it gets more complicated if two, three or more intersecting planes exist, as moving one point might require other planes to be recalculated in order not to distort, hence multiple points might need to displace in order to maintain planar surface integrity. I have to get deeper into actually trying some stuff out in order to demonstrate further because it's too abstract and I honestly don't have a clear idea currently how it could be achieved, especially from a usability standpoint (how the user would interact with this and design such planar surfaces). In a way, I'm wanting the ability to distort surfaces by editing points but force their final positioning to result in a planar surface rather than a loft or double-curved surface, which is now really easy to do in the conceptual massing environment. In a way, it makes more sense to specify rotation and displacement of a plane and then calculate intersections, rather than moving the "rig" (the points in this case) and expect the resulting geometry to remain planar. However from a design iteration standpoint, the user might want to make changes in an elevation view to move an intersection by a set amount in either direction and expect the planes to stay true and adjust accordingly.

Sorry, I feel like I went around in one big circle and ended up where I started without making it any clearer :)

LevL commented 11 years ago

It sounds that your scenario: "points would be the primary pieces from which lines then pass through and connect these points, resulting in planar surfaces" is very similar (if not exactly) what I implemented for Dynamo on Vasari 2014: "define points (XYZs) controlling the desired shape (some might be hosted by line or by plane), then connect points with lines to define desired edges of the building, then define patch faces via loops of such lines (making plane or ruled surface with each loop as boundary), then build Solid (when shape is completed), and finally make Free Form element with resulting solid shape. " (previous post).

I wonder if you could try that and let me know how to make design and implementation better. Thanks! Related nodes: XYZ, Line, List of Lines, Curve Loop, Solid On Curve Loops, Free Form.

dbaldacchino commented 11 years ago

Yes, sounds quite familiar. I will play with this functionality. So is this also available on Revit 2014 or just Vasari? Thanks!

LevL commented 11 years ago

Thanks! Just Vasari for this year.

dbaldacchino commented 11 years ago

Hi again Lev, is this functionality available through form-making tools or is it solely through Dynamo? I would appreciate some pointers so I know where to get started playing around. Nothing jumps out at me as new in the Vasari UI in terms of form making. Thanks.

LevL commented 11 years ago

Hi Dave, "Solid On Curve Loops" node is available only in Dynamo with Vasari 2014. Resulting free form element could be used in Revit 2014, i.e. could be cut, joined, material could be set, planar faces could be pulled/pushed, etc. Here are nodes which should be available only with Dynamo connected to Vasari 2014: Bisector Line Best Fit Arc Approximate By Tangent Arcs Face Through Points Transform Solid Replace Faces Blend Edges Chamfer Edges List Onesided Edges Patch Solid Solid On Curve Loops

The reason for no UI exposure and no earlier releases is that I added them last weeks (and days) before Vasari were preparing for release, well after Revit 2014 release. In all cases resulting elements and families built on those nodes should be compatible with Revit 2014 I am glad to provide more explanation and clarification on what nodes do.

andydandy74 commented 11 years ago

Lev, this is a bit off-topic, but I'll ask anyway: Will there be a Vasari 2014 SDK available that includes documentation for these methods?

LevL commented 11 years ago

Dynamo nodes have some explanations on ports and nodes. I am not sure if API help is being generated for Vasari package, but if it is, underlying methods might be reflected in Vasari API help. I could answer questions today or after next week.

andydandy74 commented 11 years ago

Thanks & sorry for hijacking this thread... ;-)

dbaldacchino commented 11 years ago

Thanks Lev. I placed all the nodes you mentioned but the Bisector Line and Best Fit Arc seem broken. They have no input or output ports and are yellow. I might need some help on how the rest work but I'll try playing around with them first before asking, thanks!

nodes

dbaldacchino commented 11 years ago

So I'm trying the Face Through Points node (Vasari B3 & Dynamo 07/01 build) but I must be missing something. Shouldn't the NumberOfRows input be a number? I've tried various values but it stays red. Am I using it correctly? All my points are co-planar in this example, thanks.

face through points

dbaldacchino commented 11 years ago

I still cannot get the Face Through Points to work. I'm on Dynamo -- Build 0.5.2.19926 and Vasari B3. In the example below, I am selecting 4 ref. points in a massing family, get their XYZs and making a list of points. I'm still unsure what NumberOfRows is supposed to do. If I type a value that turns the node red, it says "number of rows should match number of points Face Through Points node". In my example, that should be 4 if I'm understanding correctly. However I get the error "Exception has been thrown by the target of an invocation". For some reason if I set it to 2 in this example, it is no longer red, but there is no face created. What am I doing wrong? Thanks.

PS: Bisector Line and Best Fit Arch now have inputs, so I'll play with them at some point.

face through points

LevL commented 11 years ago

NumberOfRows = 2 should work. I wonder if Watch3d node just does not show the face as resulting face has no boundary edges. Will watch node show face object if added on your graph?

For testing to see the face I used Replace Faces node on cube replacing one planar face of the cube closest to the constructed face with the constructed face. How do you plan to use the out-port face? Except for evaluation, projection, and Replace Faces node I did not plan for other uses of the result, but ideas are welcome!

On NumberOfRows input. This node creates face through n x m grid of points. Total number of points should be n x m passed as list of points.

Number Of Rows (should be n in n x m) means that each consequent sequence of n points makes u constant curve on the face, Face is interpolated through such m u-constant curves with n v-constant curves of the face going across u-constant lines, connecting corresponding points of original grid. (Note: this is not the case if loft is built on set of curves as code decides internally where to put v-lines).

So if the face is put into Solid (Replace Faces node) and Solid is used for FreeForm Element, n x m curtain system on the face will make panels on the original grid of points passed to the face node. I wish there was just curtain system by grid of points on Revit side. I tried with this node to develop a way to get curtain panels with predictable location of panel corners on given grid of points.

This node (with Replace Faces node) could also be used to build free-shaped solids.

Thanks for trying this node. Hope my explanation helps to clear intent.

dbaldacchino commented 11 years ago

Thanks Lev, I misunderstood what the "face" output means, so it doesn't create a piece of Revit geometry. I guess I was thinking "surface" in Revit and this is equivalent to "point" in Dynamo vs. "ref. point" in Revit. Yes, the watch node displays Autodesk.Revit.DB.HermiteFace so it seems to be working. I am however at a dead end and am not sure what I can do with it! Without an example of some sort, I probably won't be able to move further in testing it.

You mention "evaluation". What kind of evaluation is possible? Is it possible to determine whether face is planar or not for example? I'll play with the Re3place Faces node as well and see if I can understand how it works. I think I get the idea of Number of Rows. To be honest, this is a little bit over my head without some visual aids :) If you have some examples (even just images of a graph), they would really help me out a lot as I like to learn through reverse-engineering. Thanks again!

LevL commented 11 years ago

I'll post example on Monday from my testing. By Projection I meant project point on face and get UV, by Evaluate- find XYZ, normal, derivatives at given UV. There is no stand-alone face in Revit, except Loft Form. Loft Form makes face in its own way, it will not accept pre-made face. Plus it would return Solid and I think representing just a face as a solid is a stretch. Most methods will not work, expecting valid solid.

LevL commented 11 years ago

Here is my test graph: image

Here what you get after selecting box form at the bottom:

image

Please advice if you need more examples or have suggestions on making functionality more self-explanatory.

dbaldacchino commented 11 years ago

Thanks, I'll try rebuild the example on my end. Just looking at the graph, I'm not clear what "faces of solid along line" does, but maybe it'll come to me when rebuilding. Looks like you took a face from the selected form, created an additional solid and then replaced one of the faces with a concave face defined by those 9 points. Lots to chew on!

LevL commented 11 years ago

Node "faces of solid along line" makes list of faces of the solid which intersect the given line. Kind of XYZ based in-graph selection mechanism.

Overall scheme is correct, here are a little more details: take solid from existing form element, build face on points as needed, select face of the solid which could be replaced using in-graph selector, make new solid by replacing selected face with constructed face, send result into form element,

LevL commented 11 years ago

I would like to post another sample for Dynamo-Vasari 2014. The sample starts with importing model which is missing planar face to complete Solid: image

The following graph allows to find curve loop with one-sided edges: image

New "Patch Solid" node allows to patch planar curve loops and curve loops with 3-4 curves. Here it is used on the model above: image

Result is Free Form with valid solid:

image

Explode of imports in r2014 allows to get Solid from imported geometry. This extension allows to build solid even if original import has some missing (or extra) faces. Resulting family could be loaded into Revit 2014. Thanks for following my sample!