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.

Query for X-Axis of a Plane

john_hauckjohn_hauck Member Posts: 52 PRO
How do you create a query for the x-axis of a plane.
For example, create a linearPattern, where the directionOne is the x-axis of "plane".

Here is an example of my goal (search for "HELP").
https://cad.onshape.com/documents/58de8571e7f5970f9b69196e/w/cb98dc68021732fbe1ee1c1f/e/918f9249b142236fd610d08f

Best Answer

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited March 2017 Answer ✓
    My mistake, I misread your script. You'll want the first argument to those functions to be id + "sketch"

    FeatureScript has two different kinds of "id" - operation ids use the Id type and are hierarchical arrays. Sketch ids are just plain strings. sketchEntityQuery wants one of each: the operation id of the sketch (id + "sketch") and the sketch id of a specific entity within the sketch (given by the skRectangle function... which just concatenates strings to make edges of "tile.left" etc.).

    Your confusion here is, frankly, pretty valid. We'll make a priority of documenting various sketch functions to explain this behavior better.

Answers

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    For the pattern directions, one option is to use sketchEntityQuery(id + "tile", EntityType.EDGE, "tile.left") and sketchEntityQuery(id + "tile", EntityType.EDGE, "tile.bottom"). We should document skRectangle better to make it clear that this is possible. Another option is to use opPattern directly and make a list of transforms with a double for loop.

    For identifying the different sketch regions, unfortunately the only option is to use something like qContainsPoint to disambiguate the regions. The regions that result from a sketch solve are not directly associated with the edges you create when sketching (for instance, a sketch with two rectangles and a line can produce up to six regions, each touching edges from all three operations). So if you put those operations in the same sketch, you need something like a point in space to specify the exact region you want.

    Alternatively, you could distinguish the regions by simply putting the two rectangles in different sketches. Performance-wise, I suspect a single sketch would be faster, but only the profiler can say for sure.

  • john_hauckjohn_hauck Member Posts: 52 PRO
    For the pattern directions, I made the changes (lines 75, 79). It now fails to generate.
    https://cad.onshape.com/documents/58de8571e7f5970f9b69196e/w/cb98dc68021732fbe1ee1c1f/e/a978e9aefeb5da28a9d39ab9

    Is it because of the way I defined the Id for skRectangle: "tile" vs id + "tile"? (line 43)
    Is it because there is an extrude with an Id of id + "tile"? (line 55)
    I think I ruled out those possibilities, so I'm sorry but I might need another hint.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited March 2017 Answer ✓
    My mistake, I misread your script. You'll want the first argument to those functions to be id + "sketch"

    FeatureScript has two different kinds of "id" - operation ids use the Id type and are hierarchical arrays. Sketch ids are just plain strings. sketchEntityQuery wants one of each: the operation id of the sketch (id + "sketch") and the sketch id of a specific entity within the sketch (given by the skRectangle function... which just concatenates strings to make edges of "tile.left" etc.).

    Your confusion here is, frankly, pretty valid. We'll make a priority of documenting various sketch functions to explain this behavior better.
Sign In or Register to comment.