MoI discussion forum
MoI discussion forum

Full Version: extract information regarding an object (Details)

Show messages: All  1-5  6-11

From: hadri1
23 Aug   [#6]
Hi everyone,

By 'corner point,' I mean a point that behaves the same way as the start and end points of a curve.
Meaning that it is actually "on the curve" and when i move it, the transition on each side is not smooth anymore.



when having a look at the object properties : i do not see a way to identify a curve with additional corner points.
the properties indicates 8 edit points but, there is actually 5 control points and 3 corners points (start point, end point and the one i added).



when i want to get rid of extra corner point, i usually run the fillet command.
unluckily, the fillet commande script is not the easiest for me to understand.

Hadri1

Image Attachments:
corner_point_example.png  object_properties_no_info_on_corner_point.png 


From: Michael Gibson
23 Aug   [#7] In reply to [#6]
Hi hadri1,

For the case that you showed:



You can detect 3 corner points by this method:

code:
function CountCornerPoints( crv )
{
	var num_corners = 0;

	/* Count 1 for each segment after the first segment. */

	var segment_list = crv.getSubObjects();
	var num_segments = segment_list.length;

	num_corners += (num_segments - 1);

	if ( !crv.isClosed )
	{
		/* If the curve is open add one for start point and one for end point. */
		num_corners += 2;
	}
	else
	{
		/* If the curve is closed add one if it is sharp at the start/end seam point. */
		var seg = segment_list.item(0);
		if ( !seg.getIsG1ToAdjacentSegment(0) )
		{
			num_corners++;
		}
	}

	return num_corners;
}


- Michael
From: Zooen
24 Aug   [#8] In reply to [#6]
Hi hadri1,
That’s because you’re selecting the curve and the points at the same time. If you only select the curve, you’ll see other information, including the segments.
The end points are not corner points, which makes sense to me. Furthermore, if, for a selected curve, the Properties panel shows you 2 segments (even if you can’t see them visually), this indicates that you have 1 corner point on your curve.

I’m adding a curve with 3 segments, so 2 corner points (and 2 end points that are not corner points).

- Zooen

Image Attachments:
Capture d'écran 2026-08-24 131126.png  Capture d'écran 2026-08-24 134117.png  Capture d'écran 2026-08-24 150605.png 


From: Zooen
3 Sep   [#9] In reply to [#7]
Hi Michael,
How does this script (code) work?
I've tested it but I can't see any results.
From: Michael Gibson
3 Sep   [#10] In reply to [#9]
Hi Zooen,

re:
> How does this script (code) work?
> I've tested it but I can't see any results.

That script contains a function which given a curve returns the number of corner points in the curve.

It doesn't do anything if you try to run it all by itself, it is a building block that can be used in a larger script.

- Michael
From: Zooen
4 Sep   [#11] In reply to [#10]
Hello Michael,

All right, very well, thanks for the information.

I’m sorting through the scripts, code, etc. that are piling up in my MoI3D folder, as well as in my .../Moi/commands folder. I’ve just realised I’ve got more than fifty commands. That’s far too many, I don’t need all of them.

As for MoI3D, Michael has opted for a lightweight approach!

Show messages: All  1-5  6-11