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.

Extrude Function Having Strange Behavior

EFishEFish Member Posts: 16 EDU
Hi, while working on a shaft FeatureScript, some interesting behavior came up when using the extrude function (I do wish I could use the hole function). Where in certain inputs the extrude to apply the values work, but other times it doesn't. Some help would be greatly appreciated.

Document link:
TMM Featurescripts
FRC Team 2471 Designer - Alumni
Seattle Pacific University - Mechanical Engineering
efishg2020@gmail.com
Tagged:

Best Answer

  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    Answer ✓
    I see you're building a shaft generator for FRC. It might not be a bad idea to take a look at Julia's Shaft FeatureScript, which can be found here.

    Since you've been pretty vague with everything, I'll stick to giving you some general advice about troubleshooting your own problems. I would start looking for problems by adding some relevant print and debug statements before any extrudes which you think are acting up. For example:
    // Print some stuff!
    println("roundExtrude");
    debug(context, qSketchRegion(id + "startSketch"));<br>println(length);
    
    extrude(context, id + "roundExtrude", {
                    "entities" : qSketchRegion(id + "startSketch"),
                    "endBound" : BoundingType.BLIND,
                    "depth" : length
                });
    Generic print statements (like println("roundExtrude")) can also be used to quickly check what sections of code are running. If you see one thing printed in the console when you're expecting something else, then you've found your issue.

    P.S. You should consider using opExtrude and opBoolean instead of the Onshape extrude feature. They'll perform better and be easier to understand. They're also documented better.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Answers

  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    Happy to help, but I think I'll need a more specific question or an example of what you mean by "interesting behavior". Maybe manually model what you want to happen, and show what's happening instead?
    Evan Reese
  • EFishEFish Member Posts: 16 EDU
    While using the feature, it seems to only do a through extrusion in some configurations, while only doing blind extrusions in others. But there is no errors or anything, just nothing happens, and this has really puzzled me.
    FRC Team 2471 Designer - Alumni
    Seattle Pacific University - Mechanical Engineering
    efishg2020@gmail.com
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    Answer ✓
    I see you're building a shaft generator for FRC. It might not be a bad idea to take a look at Julia's Shaft FeatureScript, which can be found here.

    Since you've been pretty vague with everything, I'll stick to giving you some general advice about troubleshooting your own problems. I would start looking for problems by adding some relevant print and debug statements before any extrudes which you think are acting up. For example:
    // Print some stuff!
    println("roundExtrude");
    debug(context, qSketchRegion(id + "startSketch"));<br>println(length);
    
    extrude(context, id + "roundExtrude", {
                    "entities" : qSketchRegion(id + "startSketch"),
                    "endBound" : BoundingType.BLIND,
                    "depth" : length
                });
    Generic print statements (like println("roundExtrude")) can also be used to quickly check what sections of code are running. If you see one thing printed in the console when you're expecting something else, then you've found your issue.

    P.S. You should consider using opExtrude and opBoolean instead of the Onshape extrude feature. They'll perform better and be easier to understand. They're also documented better.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • EFishEFish Member Posts: 16 EDU
    Thanks for your input! I've only started using FeatureScript about 2 weeks ago so I'm still learning a lot! I'll use Julia's Shaft FeatureScript as a reference more. I've been staying away from that a little bit just cause I'd like to learn how to build the Feature myself so that I'm not copying and pasting very much.
    FRC Team 2471 Designer - Alumni
    Seattle Pacific University - Mechanical Engineering
    efishg2020@gmail.com
Sign In or Register to comment.