extract information regarding an object (Details)

Next
 From:  hadri1
12081.1 
Hi,

i would like to build a function that prints information about the selected element.

i would like to start with a curve element and print information such as the number of points and number of corner points.
for surface i could would like to have information on U and V iso curves.

i manage to select the curve with the object picker and even the startPt but i was not able to loop through the curve.

thanks for your help

hadri1
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
12081.2 In reply to 12081.1 
You have details' button of a selection on page Up right that give some infos that you want! ;)
and then the Brower menu section that gives the rest!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12081.3 In reply to 12081.1 
Hi hadri1,

re:
> i would like to start with a curve element and print information such as
> the number of points and number of corner points.

You can get the number of edit points for a curve by the .numEditPoints property.

For corner points, it kind of depends on what your exact definition of what a corner point is.

Do you want the spots on a curve where the curve has a sharp corner in it? Or there is a kind of related type of corner point where curve is currently smooth at that spot but if you were to move it you will then get a sharp corner there.

Actual sharp corners will cause a curve to be divided into separate segments.

You can get the number of segments in a curve by calling:
var segment_list = crv.getSubObjects();
var num_segments = segment_list.length;


> for surface i could would like to have information on U and V iso curves.

In v5 a face has face.numControlPointsU and face.numControlPointsV properties for the number of columns and rows in the surface's control point grid.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Zooen
12081.4 
Hi everyone
1- As for corner points, it kind of depends on your exact definition of what a corner point is.
I’d love to know the definition (without giving up a kidney for it, no way!).
But it’s mentioned in the MoI3D help: For curves, you can create a point that will form a sharp corner when moved by checking the “Make corner point” option or holding down Ctrl while clicking.

2- Are you looking for the points on a curve where it forms a sharp angle?
Well, I’d really like to have those—or rather, see them (a point of a different color or shape, or a small square the same size as a point)

3- Is there another type of corner point where the curve is currently smooth at that point, but where, if it were moved, an acute angle would then be formed at that point?
‘’‘My answer is YES’‘’ I’ll clarify – I didn’t express myself clearly. There may be a corner point on a curve that we cannot see because the curve appears smooth.
At present, corner points (I’m referring to the points you see when you click on ‘Show pts’) are indistinguishable from standard points. But the ‘Properties’ panel provides the relevant information. Furthermore, with practice and experience, you learn to spot them (though it’s not always easy!).

4- Real acute angles will cause the curve to be divided into distinct segments.
Imaginary acute angles will also cause the curve to be divided into distinct segments, but we won’t be able to identify them!

X- Well, friends, I’m attaching a few screenshots and a file to fuel your thinking and the discussion. Feel free to adjust the visibility of the various elements and enable or disable the points (there are corner points among them!)

In addition, the Properties window displays different information depending on what you select; this can be helpful when creating or modifying the elements you design.

Warning! DeepL translates my French into English but plays tricks on me and doesn’t really convey what I’m thinking

EDITED: 24 Aug 7:54 by ZOOEN

Attachments:

Image Attachments:
Size: 308.2 KB, Downloaded: 20 times, Dimensions: 2560x1438px
Size: 301.2 KB, Downloaded: 12 times, Dimensions: 2560x1438px
Size: 336.5 KB, Downloaded: 15 times, Dimensions: 2560x1438px
Size: 265.1 KB, Downloaded: 8 times, Dimensions: 2560x1438px
Size: 408.7 KB, Downloaded: 13 times, Dimensions: 2560x1438px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  hadri1
12081.5 In reply to 12081.2 
Thanks Pilou. But unluckily there is no information regarding the number of control points in this section.
i just checked and there is only the length value. right ?

Bonne journée

Hadri1
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  hadri1
12081.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

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12081.7 In reply to 12081.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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Zooen
12081.8 In reply to 12081.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.

EDITED: 24 Aug 7:16 by ZOOEN

Image Attachments:
Size: 358.8 KB, Downloaded: 4 times, Dimensions: 2560x1437px
Size: 392.8 KB, Downloaded: 4 times, Dimensions: 2560x1437px
Size: 375.8 KB, Downloaded: 1 time, Dimensions: 2560x1437px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All