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.
Risks of using Number instead of Length for Variables?
It's easy to define all variables as just a number, and let Onshape autocomplete the units later by adding the millimeters or degrees. What are the risks associated with working this way? if there are none, why does the variable feature even have options for them?
Evan Reese
0
Comments
CSV: some variables will have units, others will not
Create an if statement for each unit you want to parse
inside the for loop
https://cad.onshape.com/documents/75dfbb9091b5bea038398789/w/20b6cc9fc5923631d05184a8/e/97a921379d1437bdaef7fcdf
for example, I tried just this before even trying the for loop:
I also tried "*inch*" in case it needed a substring (not sure if that's how it works at all, haha)
Also i noticed you had the number 1 in file[1][2] that was the letter i to iterate between each row
can't use ' for feet and ° for degrees though.
if anyone knows how to make a function then it would account for poor capitalization too.
well you've just done what I was setting out to do which works for me . I guess I can still help by making an icon?
In answer to your other question, I was using [1][2] to prototype the basic function before switching to [i][2] in the for loop. Thanks for pointing out the dot notation issue too. I'm really not sure how to find some things out if I don't already know the answer. Featurescript is my first and only coding language.
here. this works. https://cad.onshape.com/documents/10f46c621956684f2837646b/w/a8ff564903bbb9c81038882c/e/ac916b336cbff229af13c9d0. There's a jpg too you can set as the document thumbnail.
I just play around until things work. I haven't found a good comprehensive tutorial on fs yet.
Most of what i can do is limited to what i can carry over from c++ and c#
Still can't do any cad related stuff in fs
It works really nicely (and FAST)...but once in the Onshape document there's no way to view the variable values (unless you use Link Tab I guess). You can't view the .csv directly, and when you use the CSV Variables FS, you can't see the content of the csv anywhere. All the variables are loaded to the document.
Now that I've tried it, Link Tab (at least in Chrome) works nicely to show the Variables in the document:
@TimRice did you have to do anything special to your Sensor feature to enable the Table?
Thanks!
Yes I believe that is possible to list out the variables. To learn more about writing custom tables please see the FS documentation:
https://cad.onshape.com/FsDoc/tables.html
Onshape, Inc.
I like the idea of using the custom table to show the variables. I've not had time to dig into the tables yet and it's still all Latin to me. I like the Link Tab solution. This whole undertaking is really turning into a Bargain Basement version of the Global Variables that Onshape is supposedly already working on 😆. Either way, I'm having fun.
@romeograham
That's the way I've typically been doing it, but I like something about the CSV. I'll probably use it for things that won't change as much. For example, I made a library of press-fit threaded inserts that will never change, but I still want a feature to call out the lengths and hole sizes as variables. it's easier to do it with a CSV than typing each one. In fact, when I've had a lot to write, I've set up some concatenate functions in a spreadsheet so I can type them faster, then copy/paste them into my custom feature.
Also - right back to your original question: for me, having variables unitless would cause real problems. When I deal with different suppliers / partners / customers that "think" in Standard (inches, etc) and my design work is done in metric - the only way to quickly show a distance or edge on the model in inches (without making or switching to a drawing) is to change the units of the document.
We need dual dimensions to show in the Measure dialogue...this would reduce the need to change document units just to query dimensions in Part Studios.
Multi-unit Measurement
Manage Units Per Tab
because every dimension that drives geometry must have a unit.
if you call it out during variable creation, then you don't need to call it out at the dimension
if you don't call it out at variable creation, then you do need to call it out at the dimension (Onshape auto-completes this)
So I haven't had anything break.
and i'm doing some math on the values unitless in the background
IR for AS/NZS 1100