Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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 do I drive assembly-level dimensions with calculations?
tlewis3348
Member Posts: 20 ✭✭
in General
With my day job, I use Mathcad and Creo to design mechanical parts. One of the features of those products is Mathcad can be used to drive calculations for determining dimensions in Creo. I would like to do something similar with Onshape via something like a Jupyter notebook or Google spreadsheet. Is this possible, or is the only option available to use FeatureScript?
Tagged:
0
Answers
It's a good way to manage something you're wanting to expose on the web and make it configurable.
Each input value in OS can be an expression and you can make variable declarations using #var1. You'll quickly realize this isn't a good way to control geometry with numbers and should move your expressions into feature script. The IDE for feature script is wonderful and a great place to build some logic.
Here's a link to an example https://rustyshed.com/?quill=60e8c55ea30a1413a2b2f99a
Change one of the values and design updates. It's written so I can expose any OS assembly by passing in OS DWE. I use the API to read the assembly configuration table and display it as html. Onchange, I make a call to OS, it rebuilds the geometry and then sends back an image.
I've been working on web based geometry designs for a while, but, I have long way to go. I think it's got a great future.
Correct me if I'm wrong, but the Jupyter Notebook is merely used as a space to launch and run FeatureScript code. Am I understanding that correctly? If that's the case, I think I'd prefer to just write the FeatureScript directly. This isn't completely undesirable, but I'd prefer something similar to Mathcad, if it's available.
The API (which you can use through a jupyter notebook) gives you way to interact with onshape remotely. So, you can do your calculations in python with the Jupyter notebook, then use the API to tell the part studio what to do. Where again, all features in the part studio are written with featurescript.
So, within a part studio, you can create variables and use them within custom features that include all of your calculations. Alternatively, you can do your calculations in Python and then have python tell onshape what do with the results using the API.
https://onshape-public.github.io/docs/
https://cad.onshape.com/glassworks/