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.

Need coordinate system (xAxis, zAxis) help for a transform

Marc_MillerMarc_Miller Member Posts: 104 ✭✭✭
I'm trying to learn some Featurescript but am having trouble getting the xAxis and zAxis  vectors for a transform.
My Featurescript UI has the user select a start point (vertex), and a direction.  From that I'm trying to move the orange strip (that was created by FS and is located at the origin) to the user selected point, and also orient it to the picked direction.

Here's my test file.   I tried to get values for xAxis and zAxis on lines 42 and 43, but that doesn't seem to evaluate to anything (returns "undefined").
So I'm not sure how to get that, or what I need to put in Line 71 for xAxis and zAxis.


Thank you for having a look.

Best Answer


  • lanalana Onshape Employees Posts: 680
    evAxis returns line:
    const axis = evAxis(..);
    const origin = axis.origin;
    const direction = axis.direction;
    Should work.

  • Marc_MillerMarc_Miller Member Posts: 104 ✭✭✭
    Thank you @Jake_Rosenfeld
    I got it to work after correcting those filter and eval lines, and adjusting my moveFrom coordinate vectors.
    More to experiment with now!

    Thank you @lana
    I might come back and try that out if I decided I don't want to use a mate connector.

  • Marc_MillerMarc_Miller Member Posts: 104 ✭✭✭
    edited March 2020
     I experimented a bit more and decided that the simplest UI that is also really flexible about where to locate AND orient the object is simply a Mate connector option.  With the ability to locate, rotate, flip direction, re-orientate, and offset all right there, Mate connectors are awesome!

    I saved a version of the document here for anyone that may be searching the forums for this sort of example in the future.


    It has two Featurescripts, the first with the Point and Mate connector option, and now a second one with just the MC option.


  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Nicely done :+1:
    Owen S.

    Business Systems and Configuration Controller
    HWM-Water Ltd
Sign In or Register to comment.