# How Gh classifies curves

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)

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"`.

3 Likes

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

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

why?

1 Like

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)

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!!!)

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?

THANKS

Whats wrong with this solution?

his 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.png1360x481 65.5 KB

curveTypes_2018Feb1a.gh (21.2 KB)

1 Like

Thank you David, the scripting is very helpful! I wanna know is that scripting base on VB and how could I get the scripting in GH.

Thank you!

is there any difference between `arc` and `arc-like curves`?
if yes, what is the difference?
if not, so why (for example) in the grasshopper help it written like this (image below↓)

I guess the next comparison should be `line` and `line-like curve`!

1 Like

Hi @HosseinGSD,

The attached file contains two curves:

1. An arc curve
2. A degree=2 NURBS curve that has the properties an arc (i.e. arc-like)

Use the `What` command to review.

arcs.3dm (23.7 KB)

Yep.

lines.3dm (22.1 KB)

– Dale

2 Likes