MoI discussion forum
MoI discussion forum

Full Version: Midpoint of a curve?

From: bemfarmer
1 Jun 2012   [#1]
Is there a script to find the midpoint of a curve?

For open curves, which are symetrical, and planar, with the UnwrapCurve script a line perpendicular to its midpoint seems to
locate the midpoint of the curve. Does not work for flat helix, nor for 2d logarithmic spiral.
From: Michael T. (MICTU_UTCIM)
1 Jun 2012   [#2] In reply to [#1]
Hi bemfarmer,

I don't know of a script, but here is what I do using array and a point:






Hope this helps.

Michael T.

Image Attachments:
midpoint-on-curve.jpg 


From: Mike K4ICY (MAJIKMIKE)
1 Jun 2012   [#3]
Clever!
From: Michael T. (MICTU_UTCIM)
1 Jun 2012   [#4] In reply to [#3]
Thanks!
From: Michael Gibson
1 Jun 2012   [#5] In reply to [#1]
Hi Brian, yup the way Michael T shows is the way it can be done currently - Array Curve works by distributing things in even increments of distance as traveled along the curve so it will work for that.

UnwrapCurve just places the generated line's midpoint at the midpoint between the endpoints of the curve - that will only give you a wiggly curve midpoint for symmetrical curves, and you don't need to use UnwrapCurve to create that midpoint for those cases, you can just drag out a construction line between the curve's ends and then there will be a midpoint snap on that construction line to get that same point.

Thanks Michael T for showing the way!

- Michael
From: bemfarmer
1 Jun 2012   [#6] In reply to [#2]
Very nice.

Create Catenary.

Unwrap to see that actual Length of catenary is slightly less than selected distance, due to the fact that
the catenary is being approximated by nurbs control points.

Place one point on end of curve.

Do circular array of point on catenary curve, with an item count of 3. (or 5 or 7 ...)

Trim the catenary curve with the points, and change the color of the segments.
Select all the catenary segments, and Unwrap them, and see that the distances add up to the same total length.





From: Michael T. (MICTU_UTCIM)
1 Jun 2012   [#7]
Thanks guys. Always nice to be able to contribute! MoI is such an awesome tool!

Michael T.
From: bemfarmer
6 Jan 2018   [#8]
Here is a very simple little script to find the Midpoint of a curve or an edge, closed or open.

I needed a simple function to get the midpoint of a curve segment, so writing this script helped to clarify the coding.

This code of this script has a very high percentage, modified and adapted, from LineWeb and BlendCap scripts.

The script could be made much more elaborate, to pick multiple curves and/or edges, and find Midpoints of them.

- Brian

Attachments:
_CurveMidpoint.zip


From: mkdm
6 Jan 2018   [#9] In reply to [#8]
Hello Brian (and everyone...and happy new year!)

Thanks a lot for this very useful script!

I've tested it also on a 3D curve and on a merged edge and it works fine (also with V4).
(With "merged edge" I mean an edge that I first trimmed and the merged with "merge" command)

Ciao!
From: bemfarmer
7 Jan 2018   [#10] In reply to [#9]
Marco, thank you, and thank you for the testing.

A brief, extremely simple self reminder, about MoI in general:
Hidden edges or curves cannot be selected until they are unhidden, using Hide or Styles of Types, or some other script. :-)

It seems that objects saved by MoI and reloaded may have a few previously hidden edges unhidden.
It seems that objects saved by Max's ObjLibrary , and reloaded with customUI, have ALL previously hidden edges unhidden. (?)

- Brian

I assigned Shortcut key "M" to _CurveMidpoint.
From: bemfarmer
7 Jan 2018   [#11]
It might be nice to redo the script to conform to the behavior of "_MarkCurveStart" script.
And call it "_MarkCurveMidpoint.

- B
From: bemfarmer
7 Jan 2018   [#12] In reply to [#11]
Here is the script _MarkCurveMidpoint, which works like _MarkCurveStart.
Now I have shortcut key Alt+M to get curve or edge start points,
and shortcut key M to get the midpoints.

The script is essentially the same as _CurveMidpoint, with a for loop...

- Brian

Attachments:
_MarkCurveMidpoint.zip


From: Michael Gibson
7 Jan 2018   [#13] In reply to [#10]
Hi Brian,

> It seems that objects saved by MoI and reloaded may have a few previously hidden edges unhidden.

Yeah I happened to run into this recently as well - it's a bug where the last edge of a brep doesn't get its stored hidden property loaded. It's fixed for the next beta.

- Michael