How to set construction line angle?

oleg_bovykin
oleg_bovykin Member Posts: 1 ✭
Hi! Ive been playing with featurescript and got a problem.
I want to draw a construction line with angle from parameters. But I can't find any definition of dimension for it.
Or should I calculate end point via the angle? That feels like very inconvenient way.

Comments

  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,279 image
    While you could do this with angle dimensions (using skConstraint with ConstraintType.ANGLE), I expect calculating the endpoint with sin/cos or  will actually be much more convenient -- with the constraint, there's an ambiguity of which of two supplementary angles you mean.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • pierre_gr
    pierre_gr Member Posts: 12 ✭✭
    edited October 2017
    Hi,

    There is little to no doc about skConstraint.

    Is that code supposed to work ?

    <div>skLineSegment(gearSketch, "axis", {"start" : center, "end" : center + vector(0, 1) });
    
    </div><div>skLineSegment(gearSketch, "axisAngled", {"start" : center, "end" : center + vector(1, 0) });
    
    </div><div>skConstraint(gearSketch, "fix1", { "constraintType" : ConstraintType.FIX, "localFirst" : "axis" });
    
    </div><div>skConstraint(gearSketch, "constraint1", {"constraintType" : ConstraintType.ANGLE, "localFirst" : "axisAngled", "localSecond" : "axis", "angle" : 5 * degree});
    
    skSolve(gearSketch);</div>


    In my case, I'm still getting a 90deg angle between the two axis.