Creating Plane through 3 Points in featureScript

shane_poole
shane_poole Member Posts: 7 ✭
Does anyone have any tips for creating a new plane through 3 points. Have not had any luck with all test attempts of cPlane, opPlane, etc.

var b = vector(32, 56, 0) * millimeter;
var a = vector(88, 0, 0) * millimeter;
var c = vector(88,56,50) * millimeter;
var _origin = (a+b+c)/3;
var _normal = cross((c-a), (b-a));
var newplane = plane(_origin, _normal);

This at least creates a plane just not the correct one...
Any tips appreciated!

Answers

  • shane_poole
    shane_poole Member Posts: 7 ✭
    Points relative to origin (0, 0, 0)
  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,274 image
    Really?  That looks correct.  Posting a link to a version of a shared document would help debug this, if indeed it's the wrong plane.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • shane_poole
    shane_poole Member Posts: 7 ✭

    Attempting to create plane ABC
  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,274 image
    It looks like the plane is correctly going through a b and c and the points themselves are in the wrong place.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • shane_poole
    shane_poole Member Posts: 7 ✭
    Alright, I will try and rework the points. Thanks for taking a look!
  • shane_poole
    shane_poole Member Posts: 7 ✭
    Looks like I got some of the y and z coordinates mixed up, correct plane would be:
    a = (32, 0, 56)
    b = (88, 50, 56)
    c = (88, 0 ,0)
  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited July 2019
    Would be nice to have world origin & coord.

    Y is into page.



  • shane_poole
    shane_poole Member Posts: 7 ✭
    Yes my original coordinates were with respect to the front plane (my error), basing them relative to the top plane fixed the issue.
  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited July 2019
    I was having a hard time keeping it straight and getting the coordinates correct. Looking at the triad helped me follow along.

    Added triad as a visual guide.

    Welcome to Onshape.