# Ghpython curve domain problem

Hello, what’s wrong with curve domain in ghpython?
i tried many methods without success

``````import rhinoscriptsyntax as rs
import Rhino as rg

if C:
d = rs.CurveDomain(C)
t = d/2
print t
p = rs.EvaluateCurve(C,t)
f = rs.CurveFrame(C,t)
``````

Because the midpoint of Domain is not equal to the midpoint of the length，If you want to find the midpoint of the curve, you can use the CurveMidPoint () function.

1 Like

No this is just a simple example
the same problem with curve frame and divide

It’s recommended to stay away from `rs.EvaluateCurve`, unless you unitise/reparameterise first. If you don’t, I believe that you get a parameter t from something similar to a closest point.
I prefer to use `your_curve.PointAtNormalizedLength(0.5)`, and for your example it gets you the exact point that the MidPt component proposes.

I believe to remember from a while ago, that if you use 0.5 to get a mid point with `rs.EvaluateCurve`, it will not necessarily be the curve middle, but the middle of the knot vector, whereas 0.5 on normalised length is going to be the actual curve mid point.

I don’t need evaluate curve but i need : rs.CurveFrame(C,t)
It give different result than horizontal frames components.
rs.EvaluateCurve and rs.CurveFrame give the same results, that’s why i want understand where is the problem?

Well you should have been more precise in your above problem description then.
What do you pass in as `t`?

It’s clear the same problem with both of them
paramater t don’t give the same result as components (divide curve , horizontal frames …etc)

domain prob.gh (7.1 KB)

The problem is Cause the midpoint of Domain is not equal to the midpoint of the length，You should look at the meaning of the parameter t.For example you can use rs.DivideCurve () function，or curve.NormalizedLengthParameters ().

CurveDomain.gh (23.1 KB)

1 Like

Yes i fix it by using divide curve

div = rs.DivideCurve(C,N)

t = rs.CurveClosestPoint(C,div[i])

To mimic the behaviour of the HFrames component, you can simply divide the curve by count and get the frames at the resulting division parameters:

``````params = C.DivideByCount(N-1, True)

frames = []

for t in params:
rc, frame = C.FrameAt(t)

if rc and frame.IsValid:
frames.append(frame)
``````

No need to play around with domains!

domain prob 2.gh (10.1 KB)

1 Like

thank you, another solution

1 Like

Another problem , in some points the frames are flipped unlike result of components

1 Like