Is it possible to make

maciek
maciek OS Professional Posts: 35 PRO

Hi,

I'm a beginner in FeatureScript, please tell me is it possible to make a feature which is automatically moving some faces to adjust the height of the body.

It will be much easier if I write an example:

I'm buying material as 50, 60, 70 and 80 mm aluminum billets. I have one standard 3D solid body (50 mm height). I'm adding another body on the upper face and now overall height is for example 74 mm. Now I have to manually move some bottom faces to achieve the 70 mm. Which faces should I move? For example I can change color of these faces to green.

Thanks,

Maciek

Comments

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

    Yes this is possible with Featurescript, but it might also be possible with configurations and no code needed. I'm not 100% clear on the intended use-case. Screenshots or an example Onshape document would help.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • maciek
    maciek OS Professional Posts: 35 PRO

    Every part is different document, so configurations won't help here.

    https://cad.onshape.com/documents/5b978e14ef53de7bc156076a/w/9f9a81154c69f036052af5ab/e/35b33558dea2b11720dfd1f2?renderMode=0&uiState=67eff49847fe9d4e6b568ea2

  • eric_pesty
    eric_pesty Member, pcbaevp Posts: 2,941 PRO

    I would think a "move face" "up to" (with offset if needed) should do it no?

  • maciek
    maciek OS Professional Posts: 35 PRO

    in featurescript?

  • MichaelPascoe
    MichaelPascoe Member Posts: 2,965 PRO
    edited May 2025

    Try something like this:

        opOffsetFace(context, id + "offsetFace1", {
                        "moveFaces" : adjacentFaces,
                        "offsetDistance" : (definition.oppositeDirection ? 1 : -1) * definition.Offset
    
                    });
    

    RENDERCAD - Photorealistic product rendering.
    CADSharp - Professional CAD + software consulting.

    ▚▞▚▞▚▞▚▞▚