Show messages: All
1-6
7-11
From: Michael Gibson
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
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
Hi Michael,
How does this script (code) work?
I've tested it but I can't see any results.
From: Michael Gibson
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
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-6
7-11