Creating a sketch in a new coordinate system and rotating it

Tigran_Petrosyan
Tigran_Petrosyan Member Posts: 2 PRO
edited June 18 in FeatureScript

Hi guys!
I am going to create a custom feature which would make an engraving logo on a flat round surface with parametric radius.
For that purpose I need:
1. Create a coordinate system.
2. Create a plane based on that coordinate system.
3. Create a sketch.
4. Rotate it.
But my code doesn't work and breaks when I assign a variable plane to a sketch:

// Coordinate system
var coordinateSystem1 = coordSystem(
vector(0, 0, 0) * millimeter, // origin
vector(1, 0, 0), // X axis
vector(0, 1, 0) // Y axis
);

// Plane based on the coordinate system
var plane1 = plane(coordinateSystem1);

// Create sketch
var sketch1 = newSketch(context, id + "sketch1", {
"sketchPlane" : plane1 < ——— Breaks here
});

// Example geometry
skCircle(sketch1, "circle1", {
"center" : vector(0, 0) * millimeter,
"radius" : 10 * millimeter
});

// Solve sketch
skSolve(sketch1);

Why is that?

Comments

  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,123 image

    Use newSketchOnPlane - newSketch is asking for a query

    Senior Director, Technical Services, EMEA