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.
Best Of
Re: Anyone have an FS that can convert a decimal length to a (reduced) fractional equivalent
Thanks @Caden_Armstrong ,
Ended up writing something with some help from ChatGPT (for the algorithm part)…
Seems to work and looks like this if anyone is wondering:
FeatureScript 2780;
import(path : "onshape/std/common.fs", version : "2780.0");
annotation { "Feature Type Name" : "Decimal to Fraction", "Feature Type Description" : "Convert a decimal length to a fraction string" }
export const DectoFrac = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Decimal Length" }
isLength(definition.decLength, LENGTH_BOUNDS);
annotation { "Name" : "Smallerst Denom, eg: 16 for 1/16", "UIHint" : UIHint.REMEMBER_PREVIOUS_VALUE }
isInteger(definition.precision, POSITIVE_COUNT_BOUNDS);
annotation { "Name" : "Variable Name" }
definition.varName is string;
}
{
const decValue = definition.decLength/inch;
const precision = definition.precision;
var whole=floor(decValue);
var frac = decValue - whole;
var denominator= precision;
var numerator = round(frac * denominator);
println(whole~" "~numerator~" / "~denominator);
if (numerator !=0)
{
var a=numerator;
var b=denominator;
var r=1;
while (b!=0)
{
r=a%b;
a=b;
b=r;
}
var GCD=a;
println(GCD);
numerator= floor(numerator/GCD);
denominator = floor (denominator/GCD);
}
else
{
denominator=1;
}
if (numerator==denominator)
{
whole += 1;
numerator=0;
}
/*
println(whole);
println(numerator);
println(denominator);
*/
var theString;
if (whole==0)
{
theString=numerator~"/"~denominator;
}
else
{
theString=whole~"-"~numerator~"/"~denominator;
}
setVariable(context, definition.varName, theString);
// Define the function's action
});
Re: Don't know how to delete a post
Well it was a very niche and silly little problem that I overlooked. Thought the maxPathDeviation wasn't working correctly. But I was thinking in 2D when it only analyses things in a very rudimentary way.
Re: Why can't I get Transform Tool To Show on the RIght Click Menu?
You have to manually select the sketch by highlighting it first, and then the arrows will appear. You can copy and paste a sketch into a plane as well and it's like it's all auto selected. You just have to then re-constrain the sketch probably using the origin as the anchor point as the shared reference.


