Functions to process surfaces
Function Comment
GetNearestPlane(pnt)
Function returns the name of the nearest plane to the pnt point of the selected object.
pnt – variable of the Point type.
Example:
function OnConnect{
if(obj.strTheType == “StdJointParts”){
// …
} else {
strName = GetNearestPlane(pntOrigin);
if(strName != UnknownValue){
SetGeomConstraint(INSERT, CODIRECT, obj, WP1, strName, 0);
NoVectorSelect = 1;
Handled = OBJ_HANDLED;
}
}
}
//variant 1
findNearest(
pnt,
Name1,
Name2,
… ,
NameN
)
//variant 2
findNearest(
pnt,
arrName,
arrIndexStart,
arrSize
)
Returns an index of the nearest point or plane according to the parameters types, specified with the Name1, … NameN or arrName names.
Function supports two types of call:
1) the particular names of the public parameters are specified as arguments
2) the array of the public parameters with the starting index for searching and calculating a number of the array elements, is specified as the arguments
pnt – variable of the Point type.
Name1, NameN, arrName – names of the public parameters of the selected object
arrIndexStart – starting index for searching in the array
arrSize – array size
Example:
//variant 1
rNearest = findNearest(pntOrigin, obj.WP1, obj.WP11, obj.WP21);
// rNearest takes 0, 1 or 2 values
//variant 2
rNearest = findNearest(pntOrigin, obj.WP, 1, 4);
// rNearest takes 1, 2, 3 or 4 values
//variant 1
nearestPlaneName(
pnt,
Name1,
Name2,
… ,
NameN
)
//variant 2
nearestPlaneName(
pnt,
arrName,
arrIndexStart,
arrSize
)
Returns an index of the nearest point or plane according to the parameters types, specified with the Name1, … NameN or arrName names.
Function supports two types of activation:
1) the particular names of the public parameters are specified as arguments
2) the array of the public parameters with the starting index for searching and calculating a number of the array elements, is specified as the arguments
pnt – variable of the Point type.
Name1, NameN, arrName – names of the public parameters of the selected object
arrIndexStart – starting index for searching in the array
arrSize – array size.
Example:
//variant 1
strNearest = nearestPlaneName(pntOrigin, obj.WP1, obj.WP11, obj.WP21);
// strNearest takes “obj.WP1”, “obj.WP11” or “obj.WP21” values
//variant 2
strNearest = nearestPlaneName(pntOrigin, obj.WP, 1, 4);
// strNearest takes “obj.WP1”, “obj.WP2”, “obj.WP3” or “obj.WP4” values
restoreBasis(vecOld, vecNormal, vecNew);
Function converts an old basis according to the new position of the vector.
Following combinations are applied in the next order:
(x, y, z, newX)
(y, z, x, newY)
(z, x, y, newZ) vRrev – previous vNext in the XYZ
MakeVectorsFromView(lViewType, vecDirection, vecPlane);
Sets the position of the vectors from the view type
Example:
MakeVectorsFromView(VTOP, vecDirection, vecPlane);
setBasePlaneForSelect(planeName, vecPlane = vecPlane);
Sets a plane coordinate system, where the SelectParam will work, i.e. the rXcoord, rYcoord will depend on this system.
Applying. When selecting non-symmetrical details whose selection direction depends on the fixed plane and the distance is calculated from any plane; for example, the standard ends of the arbors, not from the pntOrigin.
Example:
setBasePlaneForSelect(WP1);
Used for connecting the ends of the arbors.




Post your comment on this topic.