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.

Formula for getting vector

papawopapawo Member, Developers Posts: 206 PRO

Best Answers

Answers

  • lanalana Onshape Employees Posts: 706
    edited July 2018 Answer ✓
    vector(pt1[0] +1 * inch, pt2[1])

    EDITED - sorry missed pt1[0]
  • papawopapawo Member, Developers Posts: 206 PRO
    That is how I interpret it. But it doesnt work. its not giving me the correct 1"

      var startPoint2D = worldToPlane(oplane, pt1);
      var endPoint2D = worldToPlane(oplane, pt2);
      var sketch1 = newSketchOnPlane(context, id + "sketch1", {
                    "sketchPlane" : oplane
                });

            skRectangle(sketch1, "rectangle1", {
                        "firstCorner" : startPoint2D,
                        "secondCorner" : endPoint2D
                    });
            skSolve(sketch1);
        var rect2 = vector(1 * inch, endPoint2D[1]);
    ....

          skRectangle(sketch2, "rectangle2", {
                        "firstCorner" : startPoint2D,
                        "secondCorner" : rect2
                    });
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    p3 = p1 + dot(p2-p1, vector(0,1)) * vector(0,1) + vector(1,0) * inch
  • papawopapawo Member, Developers Posts: 206 PRO
    Answer ✓
    @konstantin_shiriazdanov
    can you explain pls?
  • papawopapawo Member, Developers Posts: 206 PRO
    is dot a syntax?

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited July 2018
    dot() is builtin FS function which gives vector dot product (vector operation defined in linear algebra, for vectors a and b dot(a, b) = length(a) * length(b) * cos(a^b) where a^b is an angle between a and b)
  • papawopapawo Member, Developers Posts: 206 PRO
    thank you guys! Ive learned something new today! :)
Sign In or Register to comment.