Mapping faces from a plane onto another plane

I'm trying to make a function that "wraps" a plane onto a plane or onto a curved surface. It works for curved surfaces :

    const targetWrap is WrapSurface = makeWrapSurface(context, definition.target);
    const sketchPlane is Plane = evOwnerSketchPlane(context, { "entity" : definition.faces });
    var result is Query = qNothing();
    if (!isWrapPlane(context, targetWrap))
    {
        opWrap(context, id + "map", {
                    "wrapType" : WrapType.TRIM,
                    "entities" : definition.faces,
                    "source" : makeWrapPlane(sketchPlane),
                    "destination" : targetWrap
                });
        result = qCreatedBy(id + "map", EntityType.BODY);
    }
    else
    {
        const targetPlane is Plane = evPlane(context, { "face" : definition.target });
        const moveFaces is Query = qEntityFilter(definition.faces, EntityType.FACE);
        const planemap is Transform = transform(sketchPlane, targetPlane);
        debug(context, moveFaces, DebugColor.RED);
        opMoveFace(context, id + "map", {
                "moveFaces" : moveFaces,
                "transform" : planemap,
        });
        result = qCreatedBy(id + "map");
    }
image.png

The result when extruding the query `result` is somewhat strange (moved from a plane to an offset plane) .

I'm sure there's an obvious solution, but for now I don't have a clue.

Comments

  • EvanReese
    EvanReese Member, Mentor Posts: 3,106 PRO

    If your goal is to transform the letters from the cSys of sketchPlane to the cSys of targetPlane, then moveFace() isn't probably what you want. Look at opTransform().

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com