Featurescript - Manipulator

Hugh_Goodbody
Hugh_Goodbody Member Posts: 41 PRO
I have instantiated a part in a part studio using feature script. In the picture it is the port at the rear of the cylinder. I would like a manipulator to allow the user to graphically rotate the port around the cylinder to the desired position. The snippet I have tried is:

var testPoint = vector(-capPortPos,0,0)*millimeter;

angularManipulator({
        "axisOrigin" : testPoint,
        "axisDirection" : X_AXIS,
        "rotationOrigin" : vector(-capPortPos,0,10)*millimeter
});

Where testPoint is the blue dot.
Am I on the right track?





Comments

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    @Hugh_Goodbody
    It seems like you're on the right track. You'll next need to add that manipulator with the addManipulators() function, and control its effect with a manipulator change function.

    A full working example (and IMO the best place to start) is in the documentation for the manipulator module.
  • Hugh_Goodbody
    Hugh_Goodbody Member Posts: 41 PRO
    I am getting the following error:
    Precondition of angularManipulator failed (is3dDirection(definition.axisDirection))

    Are there any examples using the angular manipulator?

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    The X_AXIS is a Line (which specifies both a direction and an origin point) while axisDirection wants a direction.

    You can instead use X_AXIS.direction, or X_DIRECTION, or vector(1, 0, 0), which are all the same thing: A unit vector pointing in the positive x direction.