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.
Help With Helix Projection
jensen_brightman
Member Posts: 8 ✭
Hello everyone, I am trying to projecta helix that I have created onto the top plane to achieve a spiral effect, however I am not sure how to project the curved line of the helix onto a sketch. Below is something that i treid, however it doesnt quite work 😔.
annotation { "Feature Type Name" : "Torsion Spring", "Feature Type Description" : "" }
export const torsionSpring = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
// Define the parameters of the feature type
annotation { "Name" : "Plane", "Filter" : GeometryType.PLANE, "MaxNumberOfPicks" : 1 }
definition.plane is Query; annotation { "Name" : "Diameter" }
isLength(definition.diameter, NONNEGATIVE_LENGTH_BOUNDS);
annotation { "Name" : "Mate Size" }
isLength(definition.mateSize, NONNEGATIVE_LENGTH_BOUNDS);
annotation { "Name" : "Revolutions" }
isInteger(definition.revolutions, POSITIVE_COUNT_BOUNDS);
}
{
const radius = definition.diameter / 2;
const mateRadius = definition.mateSize / 2;
const turns = definition.revolutions;
const l = 3.5; // DO NOT CHANGE >:(
var helix = opHelix(context, id + "helix1", {
"direction" : vector(0, 0, 1),
"axisStart" : vector(0, 0, 0) * inch,
"startPoint" : vector(radius, 0, 0),
"interval" : [0, turns],
"clockwise" : true,
"helicalPitch" : (l / turns) * centimeter,
"spiralPitch" : (radius - mateRadius) / turns * -1
});
var mainSketch = newSketch(context, id + "sketch1", {
"sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
});
try
{ // Create a spiral on the sketch by projecting the helix
project(mainSketch, qCreatedBy(id + "helix1", EntityType.EDGE));
}
skSolve(mainSketch);
});
Thanks in advance for any response 😄
0
Comments
If you make your document public and share it, we might be able to help you more easily…
what error are you getting?
Sure,
Heres the document:
https://cad.onshape.com/documents/10f6e24327ebfd7f615a4879/w/8c73a0b1a748ca34b5a118fa/e/95253a01783f14b76e00837d
And the eror looks like this:
in the standard documentation it says:
"project (line is Line, point is Vector) returns Vector
Returns the projection of the point onto the line. See also other overloads of
project
."therefore it doesn't recognise your project function because the arguments are not matching what it expects…
all the project function does is evaluate a vector, rather than create a new curve
I think you ought to look for a different projection function. e.g.
try
projectCurves (context is Context, id is Id, definition is map)
or probably even simpler:
opDropCurve (context is Context, id is Id, definition is map)
BTW. if you just set "helicalPitch" : 0 * centimeter" you'll also end up with the same flat (projected) helix.
why are you trying to project it in the first place?
when you use opDropCurve, you can skip the whole sketch and project it immediately onto the plane.
moreover you'll need to import geometry.fs iso common.fs
I successfully got both projectCurves and opDropCurve to work, but the problem is that I can't extrude the spiral that's created. Is there a way to project the spiral onto a sketch so I can extrude it and create a 3D spiral? Or, is it possible to extrude the curve directly without having to place it on a sketch?
Thanks for the help 😁
this custom extrude features will allow you to extrude curves and faces that are not flat:
https://cad.onshape.com/documents/24819ddab7dc83c810eb8246/v/b409220bda82b907cd49f383/e/38727ba0d05188ebe79387a5