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.

Newb Question? - Paraboloids

marc_cromptonmarc_crompton Member Posts: 10 EDU
I'm a teacher wanting to help students integrate their math curriculum into something more hands on through CAD.  The students already use Onshape at a basic level and have studied quadratic equations in math.  I'd like them to be able to design physical objects using some level of coding, specifically, I'd like them to calculate parabolic nose cones in Onshape.  I can show them how to do this in OpenSCAD, and then move the geometries into Onshape, but I'd like to see if they can work directly with FeatureScript as well.  Has anyone done this successfully here?  Can someone point me to a resource that might walk me through this project (or something similar)?

Comments

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    The function you want in FeatureScript is skConicSegment. It's is marked "internal" in std (generally meaning not yet meant for production use) but I believe that can be updated since the function is now stable and in production use, so you can certainly feel free to use it.

    Here's an example FeatureScript feature making a parabola:
    https://cad.onshape.com/documents/37b0e0b35735ff60b372cf33/w/4d836e6c27ced4be10e74f0e/e/a53a863c4036a3a1d3f0ef6d

    The inputs may not be what you're used to mathematically – the shape is specified by three 2d points and a "rho" value, as is done in an Onshape sketch. Parabolas have a rho value 0.5, and the "control" point will lie on the parabola's axis of symmetry.
  • marc_cromptonmarc_crompton Member Posts: 10 EDU
    Thanks for your reply, Kevin.  Maybe I'm even more of a newb than I thought.  What is the rho value? I need to know how Onshape calculates the parabola and how we might be able to adjust parameters. How do I actually run the Create conic function?  I see the dialogue but no opportunity to interact.  When I simply click on the checkmark after running it, I see no change, even when I've previously deleted the initial Create conic that you ran.  

    I also seem to be unable to rotate or thicken the parabola that you've created.  (yes, I've made an editable copy of your file.)

    Thanks,


    Marc
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Hi @marc_crompton

    Apologies for the wait!

    The "rho" value Kevin is referring to is described nicely here: https://www.quora.com/What-does-it-mean-by-rho-value-for-conic-section

    The reason there is no interaction in Kevin's feature is that he has not programmed the feature with any inputs.  If you take a look at the "Feature Studio 1" tab, you'll see Kevin's simple feature which takes no inputs and produces a parabola on the top plane. 

    If you wanted to adapt the feature to have rho as an input (as an example of adding some interaction), you could change it to this:

    export const RHO_BOUDS = {
                (unitless) : [0, 0.5, 1]
            } as RealBoundSpec;
    
    annotation { "Feature Type Name" : "Create conic" }
    export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Rho" }
            isReal(definition.rho, RHO_BOUDS);
        }
        {
            var sketch1 = newSketch(context, id + "sketch1", {
                    "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
                });
            skConicSegment(sketch1, "conic1", {
                        "start" : vector(0, 0) * inch,
                        "controlPoint" : vector(0.5, 0.5) * inch,
                        "end" : vector(1, 0) * inch,
                        "rho" : definition.rho
                    });
            skSolve(sketch1);
        });
    https://cad.onshape.com/documents/3cf1e0bd7c1f6afc553d9b0d/w/f3f8a5be778cc0d018ff92c4/e/1092576dd70d0d88a5bdea80


    The reason that you are unable to revolve is because this sort of share is not revolvable in our system.  Ideally, you would only want half of the parabola as input to the revolve operation, not the entire parabola.  I haven't come up with a good solution for how to do this in FeatureScript, but I'm brainstorming and will get back to you.  The way you would do it in a part studio would be to split the parabola during the sketch, and then rotate the half:

    https://cad.onshape.com/documents/3cf1e0bd7c1f6afc553d9b0d/w/f3f8a5be778cc0d018ff92c4/e/2b85cec95818e1238673cb4e

    Jake Rosenfeld - Modeling Team
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    @marc_crompton
    Alternatively, instead of writing your own featurescript, I have a couple existing FS that can be used to generate a 2D curve for revolving, or generate a 3D surface outright, respectively.

    Parametric Curve

    Parametric Surface
  • marc_cromptonmarc_crompton Member Posts: 10 EDU
    Thank you Jake_Rosenfeld and mahir.  I appreciate you taking the time to respond.  While the particular class that I was hoping to use this in has come and gone, I think that this project (and getting to know FeatureScript better generally) is valuable and I will dig into both of your responses when I have a the time to do so properly.  I may be back to this post in a few days.
Sign In or Register to comment.