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

mko_scmko_sc Member Posts: 24 PRO

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: 5,683
    Take a look at qCapEntity, then filter by edge
    Senior Director, Technical Services, EMEAI
  • mko_scmko_sc Member Posts: 24 PRO
    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);
        });

  • mko_scmko_sc Member Posts: 24 PRO
    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: 565
    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?
  • mko_scmko_sc Member Posts: 24 PRO
    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
  • mko_scmko_sc Member Posts: 24 PRO
    sorry kevin
    but failing to get the "opFillSurface" command to work all night. and I was ashamed to ask ...;)
    i slept all night and i just did: 
    <div>       
    var sketch2 = newSketchOnPlane(context, id + "sketch2", {
                    "sketchPlane" : sketchPlane
     });
    <div>&nbsp; &nbsp; &nbsp; &nbsp; skLineSegment(sketch2, "line0", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "start" : vector(0 * millimeter, -definition.hdia + 1 * millimeter),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "end" : vector(lunghezza + 0 * millimeter, -definition.hdia + 1 * millimeter)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; skSolve(sketch2);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; var opplacca = opExtrude(context, id + "extrude1", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "entities" : qCreatedBy(id + "sketch2", EntityType.EDGE),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "direction" : yAxis(sketchPlane),                    //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<important</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endBound" : BoundingType.UP_TO_SURFACE,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endBoundEntity" : definition.Faccia</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var Contorno2 is Query = qCreatedBy(id + "extrude3", EntityType.FACE);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; opExtrude(context, id + "extrude4", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "entities" : Contorno2,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "direction" : zzDirection,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endBound" : BoundingType.BLIND,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endDepth" : x * millimeter</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });
    </div></div>
    I practically draw a line on 2 points now known and re-extruded this line on the same surface and I solved the problem!
    the desired distance is missing (2mm) .. but for this I try something like "maximum distance" from the edge.
    (if you have some help for the tangent it is appreciated)
    parallel to:<div>var sketch2 = newSketchOnPlane(context, id + "sketch2", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "sketchPlane" : sketchPlane</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); </div>and tangent to:
    <div> &nbsp; &nbsp; &nbsp; &nbsp; var CapEntiCurva is Query = qGeometry(CapEnti1, GeometryType.OTHER_CURVE); //spline elliptical result</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var ellisse is map = evCurveDefinition(context, { "edge" : CapEntiCurva }); //map of the result <br></div>
    now! ,I can't understand how "opFillSurface" works, is there an example something I can study?
    thanks

    and sorry for my writing! google translator is live :(
    :))
Sign In or Register to comment.