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.

Linear Pattern an Extruded Cut in FeatureScript

william_frietwilliam_friet Member Posts: 4
Hello,

I'm trying to wrap my head around FeatureScript but can't figure out what to do with linearPattern and an extruded cut. In the end I'm trying to get a rectangular grid of cuts. Essentially what I am trying to do is:
1) Create a solid rectangle
2) Create a rectangular hole in the corner of that rectangle
3) Pattern that hole across the original rectangle using linearPattern

If there is a better way of doing this or if you know how to do it please let me know

Thank you

Comments

  • antlu65antlu65 Member Posts: 59 EDU
    edited July 2022
    I would take the following steps to accomplish this:
    1) Create a sketch of your rectangle. Extrude the sketch profile into a solid body.
    2) Create a new sketch of the rectangular hole profile you intend to cut into your body. Extrude this rectangular hole profile into a new body (call it the 'cut tool').
    3) Apply your linear pattern to the cut tool to produce an array of cut tools. Then use boolean subtraction to produce the cuts in your original solid body.

    Do you need code to illustrate any or all of these steps? Can provide, just not sure what you are asking for.
  • steve_shubinsteve_shubin Member Posts: 1,096 ✭✭✭✭
    edited July 2022
    @william_friet

    make sure you use Linear Pattern Plus by @Evan_Reese

    make sure you have the latest version of linear pattern plus

    And when you pattern, you want to pattern the 4 faces of the square hole. Of the options that you can pattern, patterning a FACE Is the least compute-intensive to do

    https://cad.onshape.com/documents/70e7882d9bcffd2c56b7dfef/w/9a205b5dd1cb851c7b1015e5/e/65bf5609e703065f17c5d9ef


  • steve_shubinsteve_shubin Member Posts: 1,096 ✭✭✭✭
    edited July 2022
    @william_friet

    after thinking about it, I modified the document

    There are certainly times when it is best practice to have one sketch for the basic part and another sketch for the hole and then separate extrudes for each sketch

    But in this case, since I just wanted to make a simple grate, there was no need for multiple sketches and no need for multiple extrudes, being as I was patterning the faces of the hole

    Some might say it’s best to be consistent in the way that you go about your modeling. But I’m a hobbyist. What I do I do for myself. So that’s something to keep in mind

  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    @william_friet
    Are you wanting to do this in a custom feature you're working on, or just get it done in a model?
    Evan Reese
  • william_frietwilliam_friet Member Posts: 4
    @Evan_Reese
    Perhaps I should have been more specific, I'm trying to do this in a custom feature. While I understand the process to do this in the CAD interface using FeatureScript has given me difficulty. I've gotten linearPattern to work with extruding bodies but haven't with cutting bodies
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    Got it. I have no idea your comfort level with programming and FeatureScript, so I'll keep it high level, and you can ask for clarity where needed. Without trying it myself, I'd try these steps:
    1. make a cuboid where the first hole should be where I need the hole (if you'll ever need a shape other than square, then maybe create a sketch object to extrude instead)
    2. boolean subtract the cylinder from the merge scope
    3. query the faces of the hole
    4. generate an array of transforms that define the locations of the patterned holes from the center of the hole
    5. generate an array of unique instance names for each new hole
    6. opPattern to actually pattern them
    Note, patterning the faces after the boolean should be a lot faster to compute than patterning the cylinders and booleaning them all away.
    Evan Reese
  • antlu65antlu65 Member Posts: 59 EDU
    I didn't realize it was possible to form extrudes and cuts by patterning the faces - will certainly need to apply this in my performance bottlenecks. Thanks!
Sign In or Register to comment.