Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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

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 😄

Comments

  • jelte_steur814jelte_steur814 Member Posts: 208 PRO

    If you make your document public and share it, we might be able to help you more easily…

    what error are you getting?

  • jensen_brightmanjensen_brightman Member Posts: 8

    Sure,
    Heres the document:
    https://cad.onshape.com/documents/10f6e24327ebfd7f615a4879/w/8c73a0b1a748ca34b5a118fa/e/95253a01783f14b76e00837d
    And the eror looks like this:

  • jelte_steur814jelte_steur814 Member Posts: 208 PRO

    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)

  • jelte_steur814jelte_steur814 Member Posts: 208 PRO

    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?

  • jelte_steur814jelte_steur814 Member Posts: 208 PRO

    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

  • jensen_brightmanjensen_brightman Member Posts: 8

    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 😁

  • jelte_steur814jelte_steur814 Member Posts: 208 PRO

    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

Sign In or Register to comment.