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.

How to select only created sketch objects?

EFishEFish Member Posts: 16 EDU
I've been working on improving the part lightening script that I made, and have run into a issue that I can't think of a way to get past. I have the script create rectangles follow the path of selected lines to make the ribs between parts. But I'm running into the problem where the extrude operation includes automatically generated faces from enclosed regions. 
Like so:

When I want the selection to be like so:

Does anybody know how to do this?

Thanks in advance  :)
FRC Team 2471 Designer - Alumni
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com
Tagged:

Best Answer

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Answer ✓
    One option is to make multiple sketches and extrude them all.
    var toExtrude is array = [];<br>// sketch1, has one rectangle<br>toExtrude = toExtrude->append(qSketchRegion(id + sketch + 1));
    ...
    opExtrude(... "entities" : qUnion(toExtrude) ...);
    In Onshape, sketches really only have their 1d entities until skSolve is called, at which point all relevant regions are created (imprinted). So, without splitting into multiple sketches, the in-between regions are not easily distinguishable from the ones you want. If you modeled this without code you might rely on manually selecting the right regions instead of making many sketches, but with code we can just automate the sketches so that's easier!

Answers

  • EFishEFish Member Posts: 16 EDU
    FRC Team 2471 Designer - Alumni
    Seattle Pacific University - Mechanical Engineering
    efishg2020@gmail.com
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Answer ✓
    One option is to make multiple sketches and extrude them all.
    var toExtrude is array = [];<br>// sketch1, has one rectangle<br>toExtrude = toExtrude->append(qSketchRegion(id + sketch + 1));
    ...
    opExtrude(... "entities" : qUnion(toExtrude) ...);
    In Onshape, sketches really only have their 1d entities until skSolve is called, at which point all relevant regions are created (imprinted). So, without splitting into multiple sketches, the in-between regions are not easily distinguishable from the ones you want. If you modeled this without code you might rely on manually selecting the right regions instead of making many sketches, but with code we can just automate the sketches so that's easier!
  • EFishEFish Member Posts: 16 EDU
    Ok, that would work for this case very well, I am a bit concerned about the effect on the performance this method may have. But I'll try it out to see how it does, thanks!
    FRC Team 2471 Designer - Alumni
    Seattle Pacific University - Mechanical Engineering
    efishg2020@gmail.com
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    Performance is easy to check with the FS profiler: https://cad.onshape.com/FsDoc/debugging-in-feature-studios.html#profiling-regeneration-timings
    As you're not making thousands of sketches I wouldn't think the performance should be hugely different!
  • EFishEFish Member Posts: 16 EDU
    True, it works great! Thank you Kevin!
    FRC Team 2471 Designer - Alumni
    Seattle Pacific University - Mechanical Engineering
    efishg2020@gmail.com
Sign In or Register to comment.