I’m trying to express general constraints in AnyScript.

For instance, there are several ‘mate’ conditions in CAD.

‘Coincident’ condition between two planes

‘Tangent’ condition between a cylindrical surface and a plane.

Of course it is possible to express above constraints in algebraic equations.
But because I’m not good at AnyScript, so I’d like to know how to express those constraints in AnyScript.

There is probably several ways to model those contact conditions in AnyScript. Here are some ideas i have:

First the planes have to be defined. One solution is to use a reference frame (Plane1RefFrame), the plane would be defined by the origin of the ref frame and one normal axis (z). So the plane 1 would be defined by z=0 in Plane1RefFrame. In the same way the plane 2 would be defined by z=0 in Plane2RefFrame.
Then to make them coincident you can lock the x and y rotation between the two ref frames and drive the distance between the ref frames to be zero along the local z axis.

Let’s keep the same plane definition: z=0 in PlaneRefFrame. For the cylinder let’s say it is constructed so we have two non coincident nodes (or ref frames) on the cylinder axis: CylNode1 and CylNode2. You can drive the distance between PlaneRefFrame and CylNode1 to be equal to the cylinder radius, as well as the distance between PlaneRefFrame and CylNode2 to be equal to the cylinder radius.