Why debug feature is not displayed ?

hervé_pipon
hervé_pipon Member Posts: 60 ✭✭
Hello,
When I use the debug feature on a vector, the data are displayed in the FeatureScript Notice, but the lines are not drawn on the screen.
I thought they should appear, right?
I use the debug feature to display these lines on the sketch
    {
        // 1st line
        var line1Start = [x1, y1];
        var line1End = [x2, y2];
        debug(context,vector(line1Start, line1End), DebugColor.RED);

        // 2nd line
        var line2Start = [x3, y3];
        var line2End = [x4, y4];
        debug(context,vector(line2Start, line2End), DebugColor.BLUE);
    }

debug: Vector Vector : [ [ 0.15 , 0.05 ] , [ 0.1 , 0 ] ]
debug: Vector Vector : [ [ 0.1 , 0 ] , [ 0.1 , 0.05 ] ]

https://cad.onshape.com/documents/b779fbc5c77223353d4ce6aa/w/5beeb6a22fc35205de002ae9/e/8b9603a52ac1124f31a8ba58

Best Answer

  • Jacob_Corder
    Jacob_Corder Member Posts: 141 PRO
    edited August 2023 Answer ✓
    That is because a vector is just a direction. in your case its just wrong, because its a multidimension array. 

    you need this
    addDebugLine(context, line2Start,line2End,DebugColor.BLUE);

Answers

  • Jacob_Corder
    Jacob_Corder Member Posts: 141 PRO
    edited August 2023 Answer ✓
    That is because a vector is just a direction. in your case its just wrong, because its a multidimension array. 

    you need this
    addDebugLine(context, line2Start,line2End,DebugColor.BLUE);
  • hervé_pipon
    hervé_pipon Member Posts: 60 ✭✭
    @Jacob_Corder Thanks for your suggestion; with your help I made it work with 
    var line1Start = vector(x1, y1,0) * meter;
    var line1End = vector(x2, y2,0) * meter;
    addDebugLine(context,line1Start,line1End,DebugColor.RED);