How to make a definition point of a curve?


#1

Hi all, i am Vietmanese and my English is not good. i have some questions but i dont know how to describe correctly.

i have a curve in xy plane and i want to define a max point or min point of this curve base on Y grid (or X grid). Is there any one helping me?

Thank you


#2

Hi, it sounds like you are looking for the maximum and minimum in each direction. Are you working in version 0.6.3 or in the daily build? I think that the tools in the daily build are more robust for what you would like to do. Here is an example:

curveMaxMin

I made a random curve in the XY plane, calculated its bounding box, then found the bounding box min and max points. It looks like there is a bug in that calculation right now (being tracked internally) that makes the bounding box include control points for the curve, which will not give you what you want. But don’t worry! All you need is the Geometry.GetClosestPoint node. In this example, I took the top point of the bounding box and made a line from it perpendicular to the axis I want to find the maximum dimension in (I want to find maximum in the Y direction, so I’m measuring against a line parallel to X.) Then I used the GetClosestPoint node to find the closest point on the curve to the straight line above it. Just repeat for each direction, or make a custom node to do it all in one place.


#3

Another way of doing it. But for any direction. This way assume that you will draw a straight line with the direction you want to get the max point in the curve. I tried to make the screenshot more or less self-explained. Please ask any questions.

01


#4

The previous solution was more complex that needed, taking into account that you have the aux. line with the direction. This is an improved version:

02


#5

Thank you for your help Colin McCrone and Eduardo P. Roca. I understand the logic of your node. It is very simple but the nodes you created are too complicated for me. So, can you show me how to create your node. Thanks again for your help.


#6

I am not totally sure if I understand you. Just some clarifications of the nodes:

-I am assuming that you are drawing the curve and the aux. straight line in revit (or vasari). So the nodes in the left are the node Select Model Element (in Revit > Selection). The nodes in the center are for extracting the curve with the node Curve in Revit>Elements>CurveElement>Query.

-The nodes in the right are just Code block nodes. Just double click anywhere in the canvas to create one.


#7

The other thing to note is that Eduardo is using Code Block Nodes, but it’s not as complicated as it looks if you are unfamiliar. The nodes on the right in his definition have a name (could be anything) equals the name of a node and the node’s inputs. In Dynamo 070, you can take most nodes and do this, that is, “call” them from the line of text rather than use the node. You can do the same thing that Eduardo did just by using the nodes themselves, and then you don’t have to worry about knowing what text to type!


#8

The bug that the control points were being included in the bounding box of the curve should now be fixed in the daily build.


#9

I have checked the last build but it seems that is behaving the same with nurbscurve:

01

But in a case without this issue, like for example an arc …

02

…It seems that we can get directly max and min x y coordinate. But for obtaining the max and min points we need to do some additional steps. Or maybe am I missing something? The bounding box allows to make some tasks in a really nice and natural way, so I am quite interested in knowing possible related workflows.

By the way, I just uploaded to the package manager a node with the last solution I proposed. So no need to deal with code :slight_smile:

03


#10

Dear all,

I have just used Dynamo 7.0. So i understanded what you have done. all trouble is because the old version Dynamo 6.3. Thank you very much.