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.

"Retrieve" trailing edge resulting from EDGE extrusion

mirko_schiamirko_schia Member Posts: 18

I apologize in advance for any nonsense or simplicity.
how do i retrieve the terminal wire of an edge extrusion?
I need to retrieve the 2 end points to draw other things.
Thanks

    precondition
    {
        annotation { "Name" : "Curve", "Filter" : EntityType.EDGE || EntityType.BODY && BodyType.WIRE }
        definition.Skizzo is Query;
        
        annotation { "Name" : "Face", "Filter" : EntityType.FACE,"bodyType" : ToolBodyType.SURFACE }
        definition.Faccia is Query;
    }

    {
        opExtrude(context, id + "extrude1", {
                    "entities" :     definition.Skizzo , 
                    "direction":     evOwnerSketchPlane(context, {"entity" : definition.Skizzo}).normal,
                    "endBound" :     BoundingType.UP_TO_SURFACE,
                    "endBoundEntity" : definition.Faccia
                    });

        var piano = newSketch(context, id + "sketch", {
                    "sketchPlane" : qCreatedBy(id + "extrude1", EntityType.FACE)
                });
//???????????????????????????????
        var endPoint is Query = qCreatedBy(id + "extrude1");
        var startPosition is Vector = evVertexPoint(context, {"vertex" : qNthElement(endPoint, 1) });
        debug(context,endPoint);
        debug(context, startPosition);
//???????????????????????????????
    });

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,537
    Take a look at qCapEntity, then filter by edge
    Director, Technical Services, EMEAI
  • mirko_schiamirko_schia Member Posts: 18
    thanks, but banality is also difficult for me, and I need an extra help.
    then I don't understand why the CapType seems correct when I set it to START while it should be END
    Thanks
    https://cad.onshape.com/documents/0c64fef5e971bca634d38f9f/w/2d55e179cdb15b3a8d661d86/e/a2ca94fc2759ce4bf3c1627d
    precondition
        {
            annotation { "Name" : "Curva", "Filter" : EntityType.EDGE || EntityType.BODY && BodyType.WIRE }
            definition.Skizzo is Query;
            
            annotation { "Name" : "Accia", "Filter" : EntityType.FACE,"bodyType" : ToolBodyType.SURFACE }
            definition.Faccia is Query;
        }
    
        {
            opExtrude(context, id + "extrude1", {
                        "entities" :     definition.Skizzo , 
                        "direction":     evOwnerSketchPlane(context, {"entity" : definition.Skizzo}).normal,
                        "endBound" :     BoundingType.UP_TO_SURFACE,
                        "endBoundEntity" : definition.Faccia
                        });
    
            var piano = newSketch(context, id + "sketch", {
                        "sketchPlane" : qCreatedBy(id + "extrude1", EntityType.FACE)
                    });
    
            var CapEnti is Query  = qCapEntity(id + "extrude1", CapType.START);
            var risu is Query = qGeometry(CapEnti, GeometryType.OTHER_CURVE);
            //??// var Pos1 is Vector = evVertexPoint(context,{"vertex" : qNthElement(risu, 0)});
    
            //debug(context,CapEnti);
            debug(context,risu);
            //debug(context,Pos1);
    
            skSolve(piano);
        });

  • mirko_schiamirko_schia Member Posts: 18
    Good evening, saw Neils advice I was able to find the 2 points of the resulting spline and draw something on it, now can someone tell me how I can bring the spline to "sketch1"?
    do I have to "redesign" it with skEllipticalArc or how?
    Thanks
    https://cad.onshape.com/documents/5bc75a5ed5ddc798b43cdf2a/w/1f899b34d7278eee6d1be959/e/75d62d635744761d1933092e



     
    <div>opExtrude(context, id + "extrude1", {
                        "entities" : definition.Skizzo,
                        "direction" : evOwnerSketchPlane(context, { "entity" : definition.Skizzo }).normal,
                        "endBound" : BoundingType.UP_TO_SURFACE,
                        "endBoundEntity" : definition.Faccia
                    });
            var QPiano is Query = qCreatedBy(id + "extrude1", EntityType.FACE);
            var BordoVoluto = qSubtraction(qGeometry(qCapEntity(id + "extrude1", CapType.START, EntityType.EDGE), GeometryType.OTHER_CURVE),definition.Skizzo);
            debug(context, BordoVoluto);
            var endPoints is Query = qAdjacent(BordoVoluto, AdjacencyType.VERTEX, EntityType.VERTEX);
            var startPosition is Vector = evVertexPoint(context, {
            "vertex" : qNthElement(endPoints, 0)
            });
            var endPosition is Vector = evVertexPoint(context, {
            "vertex" : qNthElement(endPoints, 1)
            });
            var ellisse is map = evCurveDefinition(context, {"edge" : BordoVoluto}); //-Crea una map del risultato
            var xDirection is Vector = normalize(endPosition - startPosition);
            var zDirection is Vector = perpendicularVector(xDirection);
            var cSys is CoordSystem = coordSystem(startPosition, xDirection,zDirection);
            //debug(context, cSys);
            var sketchPlane is Plane = plane (cSys);
            var lunghezza is ValueWithUnits = norm(endPosition - startPosition); 
            var sketch1 = newSketchOnPlane(context, id + "sketch1", {
                    "sketchPlane" : sketchPlane
                });
                   skLineSegment(sketch1, "line1", {
                        "start" : vector(0, 0) * millimeter,
                        "end" : vector( 0 * millimeter, -5 *millimeter)
                    }); 
             skLineSegment(sketch1, "line2", {
                     "start" : vector( 0 * millimeter, -5 *millimeter),
                     "end" : vector(lunghezza+0 * millimeter, -5 *millimeter)
                     });
             skLineSegment(sketch1, "line3", {
                     "start" : vector(lunghezza+0 * millimeter, -5 *millimeter),
                     "end" : vector(lunghezza+0 *millimeter, 0 * millimeter)
                     });
            skLineSegment(sketch1, "line0", {
                     "start" : vector(lunghezza+0 *millimeter,0 * millimeter),
                     "end" : vector(0, 0) * millimeter,
                     "construction" : false
                     });
             
            skSolve(sketch1);<br></div>
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 509
    I haven't understood the purpose of the feature yet, but if your immediate goal is to just get the region inside the sketch, I'd suggest you use opFillSurface instead of a sketch to create that region. This way, you can give opFillSurface any combination of sketch curves and other edges, without needing to replicate that edge onto the sketch, or to rely on it being elliptical.

    Something like opFillSurface(... qUnion(qCreatedBy(id + "sketch1", EntityType.EDGE), BordoVoluto) ...)

    You can use that created surface for any downstream operation, and delete it afterwards if you wish.

    Would that work?
  • mirko_schiamirko_schia Member Posts: 18
    Well, you can see what I have to do from the drawing here attached.I’m build a plate lined to the “spline” elliptical I obtain before
    i’m a building a plate , I need,now, to find the parallel line from “startPosition” to “endPosition” and tangent to the elliptical line
    thanks
Sign In or Register to comment.