Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Why debug feature is not displayed ?

hervé_piponhervé_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_CorderJacob_Corder Member Posts: 137 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_CorderJacob_Corder Member Posts: 137 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é_piponhervé_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);


Sign In or Register to comment.