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.

"Face Curves" in Featurescript?

S1monS1mon Member Posts: 14 ✭✭
In Solidworks, and countless other CAD tools it's easy to create curves on surfaces based on U-V. They're useful for creating patterns of 3D curves with similar styles, trimming surfaces, or just diagnosing the quality of the surface. Note that these are vaguely similar to the edges created by Onshape's "move boundary" when it's trimming the surface, but those are trying to move things in a offset fashion, not in a U or V direction.

This screenshot shows an arbitrary surface with a 5 x 5 pattern of curves in Solidworks. You can also do it based on position - either a selected point, or percentages. I'd like to have this basic functionality in Onshape. It seems like something which shouldn't be too hard to do with FeatureScript, but I haven't written any yet. While it would be great if someone else would just write this for me, I was hoping for some pointers on the following:
  1. Is it possible and relatively straightforward to create curves in FeatureScript?
  2. Are there any example FeatureScripts which do anything similar?


  • Evan_ReeseEvan_Reese Member Posts: 353 PRO
    I have no idea, but I'd use this! Mostly just to eval and understand my surfaces, but maybe occasionally to actually use a face curve in a model.
    Evan Reese / Agency Owner and Industrial Designer
    Website: fractalmade.com
    Instagram: @evan.reese.designs
  • mahirmahir Member, Developers Posts: 1,005 ✭✭✭✭
    Agreed. Something similar to Catia's parallel curve feature would be nice for generating construction curves.
  • S1monS1mon Member Posts: 14 ✭✭
    So oddly enough there's some FeatureScript documentation which references "opCreateCurvesOnFace". I can't find the documentation for that.

    The enum types here seem to correspond to the functionality that's in Solidworks perhaps because it's what the Parasolid kernel provides. Is Onshape working on the feature I'm trying to create? What is the reason for the asterix in this line: "Specifies type of curve on face. *" ?

  • Jacob_CorderJacob_Corder Member Posts: 14 PRO
    Look up sculptFace.
    This will generate splines in the U V Directions of a face. it does not however, give you the splines relative to an edge or parallel to an edge, I Actually need what you posted.  If i figure anything out, i will definitely share it.
  • S1monS1mon Member Posts: 14 ✭✭
    @Jacob_Corder Thanks! 

    Also thanks to @maximilian_schommer for creating sculptFace.

    I managed to sift through sculptFace and even though I don't really understand what I did, I was able to copy the bits which created the splines and leave behind all the rest. What is interesting is that it's clearly not extracting the isoparameters, but instead making approximate splines based on sampling the face (or something like that). If the U or V count is too low, the curves don't follow the surface. In any case I have more work to do, but I was able to get something to happen.

  • Jacob_CorderJacob_Corder Member Posts: 14 PRO
     you are correct. the tolerance in the faces is basically from the U V grid.  I  have found that the curves can be very bad because they are created using opfitspline.

    I need this opCreateCurvesOnFace feature like last month.

    I am working on cracking it but it may be tough. maybe onshape can help. hopefully.

  • Jacob_CorderJacob_Corder Member Posts: 14 PRO

    Here is what i discovered so far. 

    the feature works, however, i cannot find a way for it to use a guide on the edge to control the U V Parameters instead of using the basic underlying U V directions of the surface.

    FeatureScript 1324;
    import(path : "onshape/std/geometry.fs", version : "1324.0");

    export enum FaceCurveCreationType
        annotation{"Name":"Primary Direction"}
        annotation{"Name":"Secondary Direction"}
         annotation{"Name":"Primary Direction equal Spaced"}
        annotation{"Name":"Secondary Direction equal Spaced"}

    annotation { "Feature Type Name" : "UV ParallelCurves" }
    export const uvParallelCurvesOnFace = defineFeature(function(context is Context, id is Id, definition is map)
            annotation { "Name" : "Curve Definition", "Item name" : "Curve Definition", "Item label template" : "#creationType" }
            definition.curveDefinition is array;
            for (var cDef in definition.curveDefinition)
                annotation { "Name" : "Face", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
                cDef.face is Query;
                annotation { "Name" : "Curve Creation Type" }
                cDef.creationType is FaceCurveCreationType;
                if(cDef.creationType==FaceCurveCreationType.DIR1_AUTO_SPACED_ISO || cDef.creationType==FaceCurveCreationType.DIR2_AUTO_SPACED_ISO)
                    annotation { "Name" : "Number of Curves" }
                    isInteger(cDef.nCurves, POSITIVE_COUNT_BOUNDS);                
                    annotation { "Name" : "parameter" }
            for(var i =0;i<size(definition.curveDefinition);i+=1)
                if(definition.curveDefinition[i].creationType == FaceCurveCreationType.DIR1_ISO || definition.curveDefinition[i].creationType== FaceCurveCreationType.DIR2_ISO)
                    definition.curveDefinition[i].parameters = [definition.curveDefinition[i].param];               
                    definition.curveDefinition[i].names = ["curve1"];
                    definition.curveDefinition[i].names = makeArray(definition.curveDefinition[i].nCurves, "Name");
                    for(var j =0;j<definition.curveDefinition[i].nCurves;j+=1)
                        definition.curveDefinition[i].names[j] = "curve"~i~j;
                @opCreateCurvesOnFace(context, id,definition); 
           catch (error)

  • maximilian_schommermaximilian_schommer Member Posts: 31 EDU
    So one possibility to get a "parallel to edge" feature, is to sample a given edge, and extract what the UV parameters are of that edge. Then, we need to interpolate the parameters to some other UV bound in order to make the "parallel" edges (which wouldn't really be parallel, since that's not possible with nonlinear curves anyways).

    Another possibility is to use the tangent edges along the edge we want to make parallel lines for, and we move in direction perpendicular to the sampled tangent lines, and then find the UV parameters of that new curve when projected on the surface, and then iterate on that process. It would take a bit more computation since it is an iterative solution, but satisfies the idea of "parallel" a lot more.

Sign In or Register to comment.