Hi Len,
re:
> Is there any way to order curves by their selection order?
If you have them in an object list you can call object_list.sortBySelectionOrder();
> Also, is there a way to sort object by one of their properties, for instance:
> select a bunch of circles and order them by the diameter?
You can do this by putting them into a JavaScript Array and then using the array.sort(), passing in a compare function:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
A compare function for ordering circles by diameter would go something like this (warning untested code):
function CircleRadiusSortFunc( crvA, crvB )
{
if ( crvA.conicRadius < crvB.conicRadius )
return -1;
else if ( crvA.conicRadius > crvB.conicRadius )
return 1;
else
return 0;
}
my_array.sort( CircleRadiusSortFunc );
> Can you explain what's happening in the DoChangeClosedCurveSeam script and what
> the pickedpt.osnap(i).object and pickedpt.osnap(i).otherObject are revealing?
It waits for a point to be picked that is snapped onto a curve by calling GetPointOsnappedOnCurve(). Then it gets the "PickedPoint" object from the pointpicker (pointpicker.pt).
On a PickedPoint object there is a list of OsnapPoint objects, the number of those is on the PickedPoint.numOsnaps property and you can access them by calling PickedPoint.osnap( index );
Each OsnapPoint has these read-only properties:
.object - Object that was snapped on
.parameter - Parameter value for where it was snapped
.otherObject - Some object snaps like Intersection involve 2 objects, this holds the 2nd object for those.
.otherParameter - Parameter value on 2nd curve
.type - numeric value for type of osnap, :
0 : ObjectSnap_None
1 : ObjectSnap_Origin
2 : ObjectSnap_Axis
3 : ObjectSnap_End
4 : ObjectSnap_Mid
5 : ObjectSnap_Cen
6 : ObjectSnap_Int
7 : ObjectSnap_StraightSnapInt
8 : ObjectSnap_SelfInt
9 : ObjectSnap_CPlaneInt
10 : ObjectSnap_Quad
11 : ObjectSnap_Pt
12 : ObjectSnap_PtOnObject
13 : ObjectSnap_On
14 : ObjectSnap_OnSrf
15 : ObjectSnap_Perp
16 : ObjectSnap_Tan
17 : ObjectSnap_PerpPerp
18 : ObjectSnap_TanTan
19 : ObjectSnap_Div
.typeString - localized string value for object snap type.
.pt - 3D point with .x .y .z values.
.screenDist - Distance in screen pixels from mouse cursor to snap point
.isOnCurve - True if this is a type of osnap that is located on curve or construction line geometry. False if it's ObjectSnap_Origin, ObjectSnap_Cen, ObjectSnap_Pt, ObjectSnap_OnSrf
> what the pickedpt.osnap(i).object and pickedpt.osnap(i).otherObject are revealing?
it's the object that was snapped onto. Could be a construction line, curve, curve segment, or face object.
.otherObject is the 2nd object for things like intersection snaps that involve 2 objects.
- Michael