How Gh classifies curves

(Aris Nikolopoulos) #1

Hi,
I was going through the forum, trying to find how GH classifies curves. I couldn’t find anything but from the best I could guess there are these 6 types:
(I’m not talking about the creation method, just the curve’s nature)

1. Line-like: a straight line defined by two control points
2. Arc-like: part of a circle
3. Circular: a circle
4. Elliptical: both a full and a partial ellipse are recognized as “elliptical curve”
5. Planar: a non-straight curve that all of its control points are planar
6. (just) Curve: a curve that its control points are not planar.

(and of course the ‘polyline’ which could be a combination of all of the above…)

Are these all the ways GH can classify a curve?
Also: apart from circle/ellipse, does GH ‘recognize’ Hyperbolae/ Parabolae/ Helix(ae) etc?

curveTypes.gh (10.3 KB)

(David Rutten) #2

If you must know…

``````If (data Is Nothing) Then Return String.Format("Null {0}", name)
If (Not data.IsValid()) Then Return String.Format("Invalid {0}", name)

If (data.IsArc()) Then
If (data.IsClosed()) Then Return String.Format("{0}Circular {1}", prefix, name)
Return String.Format("{0}Arc-like {1}", prefix, name)
End If

If (data.IsEllipse()) Then
Return String.Format("{0}Elliptical {1}", prefix, name)
End If

If (data.IsLinear()) Then
Dim pts As Polyline = Nothing
If (data.TryGetPolyline(pts)) Then
If (pts.Count = 2) Then
Return String.Format("{0}Line-like {1}", prefix, name)
End If
End If

Return String.Format("{0}Linear {1}", prefix, name)
End If
If (data.IsPolyline) Then Return String.Format("{0}Polyline {1}", prefix, name)

Dim closed As String = String.Empty
Dim planar As String = String.Empty

If (data.IsClosed()) Then closed = "Closed "
If (data.IsPeriodic()) Then closed = "Periodic "
If (data.IsPlanar(0.001)) Then planar = "Planar "

Return String.Format("{0}{1}{2}{3}", prefix, closed, planar, name)
``````

`name` can be either `"Curve"` or `"Edge"`, and the `prefix` is either an empty string or `"Referenced"`.

Dispatch planar curves from a list
(Aris Nikolopoulos) #3

I wanted to make a slow transition into programming but I guess I’ll have to dive right into the deep!

#5

Does this mean that you’ll be asking all future questions over in the coders “forum” instead of here? Somehow I doubt that.

(Aris Nikolopoulos) #6

why?

#7

This is an example of using David’s list of “geo labels” (see panel on left) to parse “raw text” output. It can be written many different ways in standard GH, depending on your needs. Such as returning numbers instead of text labels. C# won’t necessarily be easier or better.

curveTypes_2018Feb1a.gh (21.2 KB)

(Aris Nikolopoulos) #8

I am not boasting or anything: I am a pationate lover of parametric design and I want to become good at it and I also feel very humbled by the gigantic knowledege of people around this forum.
Don’t misunderstand enthusiasm for arrogance… in the end it’s not about knowing, its about learning. (and of course: having fun in the process!!!)

#9

Not sure why you want to reply publicly to a PM but if that’s what you prefer, let’s put it in context.

This is the full text of my PM reply:

To answer your question privately, your statement that “It might be my last big definition I do traditionally” sounds absurd and I frankly don’t believe you. It sounds like boasting about something you haven’t even started yet. Too much talk, not much GH code yet, certainly not enough to approach the limits of what it can do.

i have a list of combination of curve types.
Is there a way to make separate list of each type of curve?

something similar to how we sort a curve by its coordinates… can we sort it by its type?