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.
Script for generating spheres (fSphere)
anass_assadiki
Member Posts: 2 ✭
Hello All,
I am still new to FeatureScript. I am trying to write a FS to generate spheres taking in the following input:
- Radius
- X,Y,Z coordinates of the center
Here is what I could do so far and I don't know how to more further. I don't know what to do with the coordinates..
FeatureScript 799;
import(path : "onshape/std/geometry.fs", version : "799.0");
annotation { "Feature Type Name" : "drawSphere" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "Radius" }
isLength(definition.Radius, NONNEGATIVE_LENGTH_BOUNDS);
annotation { "X" : "X coord" }
isLength(definition.Xcoord, LENGTH_BOUNDS);
annotation { "Y" : "X coord" }
isLength(definition.Ycoord, LENGTH_BOUNDS);
annotation { "Z" : "Z coord" }
isLength(definition.Zcoord, LENGTH_BOUNDS);
}
{
// Define the function's action
fSphere(context, id, definition.Radius);
});
Any help would be appreciated, thank you.
A.A.
I am still new to FeatureScript. I am trying to write a FS to generate spheres taking in the following input:
- Radius
- X,Y,Z coordinates of the center
Here is what I could do so far and I don't know how to more further. I don't know what to do with the coordinates..
FeatureScript 799;
import(path : "onshape/std/geometry.fs", version : "799.0");
annotation { "Feature Type Name" : "drawSphere" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "Radius" }
isLength(definition.Radius, NONNEGATIVE_LENGTH_BOUNDS);
annotation { "X" : "X coord" }
isLength(definition.Xcoord, LENGTH_BOUNDS);
annotation { "Y" : "X coord" }
isLength(definition.Ycoord, LENGTH_BOUNDS);
annotation { "Z" : "Z coord" }
isLength(definition.Zcoord, LENGTH_BOUNDS);
}
{
// Define the function's action
fSphere(context, id, definition.Radius);
});
Any help would be appreciated, thank you.
A.A.
0
Comments
TVP, Onshape R&D