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.

Edge length of evaluated face?

MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
I'm trying to measure the boundary edge of an evaluated face. When using evFaceTangentPlane, if the face is not square, the evaluation will project where the face should be. I can place a plane on the invisible edge shown below with evFaceTangentPlane. However, I'm not sure how to get the length of the invisible edge.

If I use opCreateCurvesOnFace, I can see the invisible boundary curve in red, but I can't measure it.

Is there a way to measure the invisible boundary edges calculated by evFaceTangentPlane or something similar?


Learn more about the Gospel of Christ  ( Here )

CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴

Comments

  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    If you have a query for the edge you want, you can use evLength to get the length of said edge. In your case, you can probably pass the curve created using opCreateCurvesOnFace into evLength using a simple qCreatedBy call. You can also use qLoopEdges to quickly get all of the the edges bounding a particular face immediately rather than using evFaceTangentPlane, which simply returns a plane tangent to the center of the face, as defined by the face's bounding box.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited July 2021
    The edge in red is not on a face, it does not exist, it is an extension created by opCreateCurvesOnFace. The edge I'm trying to get shows up when evaluating the farthest left you can go with evFaceTangentPlane. If I use qCreatedBy for opCreateCurvesOnFace, it results in 3 edges not 4.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited July 2021
    The simpliest would be to create array of face tangent planes, extract plane origin points then create an array of pairwise point difference vectors, and find the sum of their norms. This will give you some approximation of isoline length. Or just create a spline through those points and measure its length
  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    Thank you @konstantin_shiriazdanov. That should be close enough for what I'm doing.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited July 2021
    Works great! Thanks guys.



    For anyone else who may need the unseen boundary edges of an evaluated face, here is what I used:
        var xSplineResolution = 10; 
        var ySplineResolution = 10;
        var xSamples = [];
        var ySamples = [];
        var xLength;
        var yLength;
    
        for (var i = 0; i < 2; i += 1)
        {
            var resolution = i == 0 ? xSplineResolution : ySplineResolution;
    
            for (var k = 0; k < resolution+1; k += 1)
            {
    
                var parameter = i == 0 ? vector(1 / resolution * k, 0) : vector(0, 1 / resolution * k);
                debug(context, parameter, DebugColor.RED);
    
                const plane0 = evFaceTangentPlane(context, {
                            "face" : surface,
                            "parameter" : parameter
                        });
    
                if (i == 0)
                {
                    xSamples = append(xSamples, plane0.origin);
                    debug(context, plane0.origin, DebugColor.RED);
                }
                if (i == 1)
                {
                    ySamples = append(ySamples, plane0.origin);
                    debug(context, plane0.origin, DebugColor.GREEN);
                }
            }
        }
    
        opFitSpline(context, id + "fitSplineX", {
                    "points" : xSamples
                });
        opFitSpline(context, id + "fitSplineY", {
                    "points" : ySamples
                });
                
        xLength = evLength(context, {
                "entities" : qCreatedBy(id + "fitSplineX", EntityType.EDGE)
        });
        
        yLength = evLength(context, {
                "entities" : qCreatedBy(id + "fitSplineY", EntityType.EDGE)
        });
        
        debug(context, xLength, DebugColor.RED);



    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
Sign In or Register to comment.