pic: Custom Length Extrusion - Onshape FeatureScript



Don’t you hate importing STEP files into your CAD program and then having to edit it to be exactly the length you need? And then doing it over and over again for each part you include in your robot assembly?

Fear no more!

If you are using Onshape, just add the following FeatureScripts to your Document!
[LIST]
[]Press ‘Add custom features’
[
]Go to the ‘Other Documents’ Tab
[]Search ‘Extrusion FeatureScript - FRC 1745’ or just ‘1745’
[
]Click on ‘Extrusion FeatureScript - FRC 1745’
[]Add the ‘Custom Length Extrusion’ FeatureScript by clicking on it
[
]Also add the ‘Extrusion Grid’ FeatureScript
[/LIST]

Extrusions Available:
VexPro
[LIST]
[]VersaFrame
[INDENT][LIST]
[
]Rectangular Tubing
[]Angle
[
]C-Channel
[/LIST][/INDENT]
[]VersaRoller
[
]Shaft Stock
[INDENT][LIST]
[]ThunderHex
[
]Hex Shaft
[]Acetal Hex Spacers
[
]Tube Axle
[/LIST][/INDENT]
[/LIST]
AndyMark
[LIST]
[]Churro and Churro Lite
[
]Shaft Stock
[INDENT][LIST]
[]Hex Shaft
[
]D-Shaped Shaft
[]Keyed Shaft
[/LIST][/INDENT]
[
]C-Channel
[]Other Extrusions
[INDENT][LIST]
[
]Peanut
[]Walnut
[/LIST][/INDENT]
[/LIST]
Rev Robotics
[LIST]
[
]Extrusions
[INDENT][LIST]
[]15mm
[
]1"
[/LIST][/INDENT]
[]Shaft Stock
[INDENT][LIST]
[
]5mm Hex
[]UltraHex
[/LIST][/INDENT]
[/LIST]
Standard Extrusions - Common parts from other metal suppliers or McMaster
[LIST]
[
]Rectangular Tube
[]Circular Tube
[
]Angle
[*]Keyed Shafts
[/LIST]

Other Extrusions (Size them yourself!)
[LIST]
[]Rectangular Tube
[
]Circular Tube
[]Hex Tube
[
]Angle
[]C-Channel
[
]Rectangular Bar
[]Circular Rod
[
]Hex Rod
[/LIST]

Creating an Extrusion Grid allows you to consolidate all your Custom Length Extrusions into a single Part Studio. Just create your grid and select a different vertex for each extrusion. Make sure to create the Grid as your first feature!

*Please let me know if there is anything major or minor missing and I will try to add it.

**NOTE: FeatureScript does not currently allow me to set part materials. You will have to set the materials and appearances yourself. If this functionality is ever added, I will update this.

Created with love by FRC Team 1745 - The P-51 Mustangs

To keep it 100, I only created the thread for this image posting so I could shower you in green dots. Lots of folks make custom libraries and doohickeys in CAD to suit their particular needs or philosophy on robot building, and that’s fine. But to sweat out all 20 custom extrusions that AndyMark, REV, and VEXpro offer (and which no one team is ever realistically going to use for themselves) is going further to make something for the whole community. I can’t wait to try it!

Another FRC person making featurescripts for the community?! This is an awesome tool that makes life easy for tons of Onshape teams. I got the chance to beta test this a few weeks ago and liked it a lot! Super convenient to have every FRC extrusion useable in one place. I’ve been impressed by Ricky’s dedication to coding in all of these profiles.

Thanks for your hard work in putting this together and sharing it to the community!

Just started using this today and it’s amazing. I have a couple requests.

It’d be great if we could align the stock along an axis (example below, sorry for the huge pic).
It’d also be great if we could have the typical extrude options with this (up to face, up to plane, etc)

Hi Ty, Thanks for trying it out! I’ll look into what it would take to implement those features, but no promises in the near future (especially since kickoff is basically a week away). Might be more of a summer project.

I’d like to understand more about how you use Onshape. I’ve been creating the extrusions in one part studio and then inserting them into an assembly where I can place them exactly where I need them. This works since most of the parts in my assembly are other inserted COTS parts.

Feel free to PM me if you want to discuss.

The direction one could be as simple as setting the sketch plane to a variable, setting that variable as an enum of the direction options, then setting your extrude to normal of the sketch if it isn’t already. Doesn’t seem too hard, though I may be totally misunderstanding what Ty is asking for. For the rest of them, you could go into the Onshape library where they literally coded the extrude feature and take a look at how they implemented up to vertex, up to part, etc. Onshape features are written in featurescript so it’s often easy to just copy the code the devs used.

This would work for simple things like shafts that are essentially revolved features, but would fail on anything more complex. For example, if I want to extrude a 1x2 VersaFrame tube normal to a selected plane, I would then need to add another variable to allow for arbitrary rotations about its axis. Not super difficult, but that is only the first consequence of this change that I could think of.

I’ve been looking through the extrude.fs code. It probably isn’t too bad if I strip out all the second direction and draft portions.

I create as many parts as possible in the same part studio in order to make use of onshapes awesome multipart features. It helps me easily make shafts adjust length automatically, as well as making sure all of my bearings are aligned.

For the example above, i’d prefer the shaft to be colinear with the hole in the yellow plate, and then to up to a face on the other side of the grey tube. Then, if i decide the tube needs to be bigger or smaller, the shaft will automatically change length.

Here’s the part studio if you’d like to poke around: https://cad.onshape.com/documents/a10f620727b4d36fcec447f1/w/1b84c9ef6e3037056fbae62d/e/33944a6afd2ff618ffa44cd4

Check out V32. I’ve got 1 of 2 requests for you.

The FeatureScript now extrudes along the normal of the sketch plane that owns the selected vertex. Also added options to flip direction and rotate about the longitudinal axis.

The ‘extrude up to’ will require a much bigger change to the code due to how I structured it. Might be a next summer project, we’ll see.

Thanks! This is awesome! In the meantime, I can just make the custom extrusion longer than needed and use move face.

This is quite awesome.

Although I think the cross section of the REV extrucion is incorrect via the cad model available here:



http://www.revrobotics.com/content/cad/REV-21-1000.STEP

Thanks for making this!

Yesterday Onshape added the ability to edit part properties in FeatureScript! So I’ve updated the Custom Extrusion FeatureScript to automatically assign part materials to all COTS parts from Vex, Rev, and AndyMark! Enjoy!

If you’ve already added this custom feature to your UI in Onshape, you will need to right click and update it.

*Important Note: Existing extrusions will not necessarily update smoothly to the latest version. This is because some parts (like VersaFrame) come in two materials and I split these out as different options which resulted in some code restructuring. I recommend editing materials manually for existing parts.

Thank you for putting this together!

@RickyRobot Is there any way to make the extrusion rotate? I am trying to build an elevator with a piece of Andymark Walnut at the top of two 1x2" rectangular tubes. I would like to connect the Orange and Dark Grey tubes with Walnut in this part studio:

One way is to make all of the extrusions in separate part studios, however it would be awesome to be able to select extrusion direction tpo make use of Onshape’s powerful multi-part partstudios.

Also is it possible to have extrude length options like the extrude command namely up to part would be super useful. In the same elevator example above if the Orange or Dark Grey tubes move one would have to edit the walnut extrusion unless there was an “up to part” or “up to face” option.

This is very doable.

My typical workflow using this featurescript is to create a sketch on the face normal to where you want the extrusion. In this case, it would be either on the dark grey or orange faces where you want your extrusion to start. Then create a sketch point at the center of where you want the extrusion to be. Close out of your sketch and open the Custom Length Extrusion Feature. Select the point you drew as your starting point and the script will make it normal to the plane. Enter your length. You can also rotate it around that point or reverse direction to get the right orientation.

If this doesn’t work, make sure you’re using the latest version of the featurescript. You should be able to update it in the toolbar.

I agree it would be nice to do up to part or face, but that isn’t in the cards for this build season. However, you can kinda fake it. Extrude the part an arbitrary distance. Then you should be able to use the ‘Move Face’ command to move it up to any face you’d like.

If you need any assistance, you can share your document with me (PM me first).