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.

Surface from solid

viktor_paileviktor_paile Member Posts: 3
edited March 2021 in Community Support

Hello, here's this noob's question 1:

Is there a way in Onshape, or indeed in FeatureScript, to retrieve (or query for?) the surface of a given solid? Say, get a spherical surface from a given solid sphere?
- So little time, so much to know!

Answers

  • MichaelPascoeMichaelPascoe Member Posts: 876 PRO
    edited March 2021
    qOwnedByBody would work for this: 
    FeatureScript 1472;
    import(path : "onshape/std/geometry.fs", version : "1472.0");
    
    annotation { "Feature Type Name" : "test" }
    export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "body", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }
            definition.body is Query;
            
        }
        {
            const faces = qOwnedByBody(definition.body, EntityType.FACE);
            debug(context, faces, DebugColor.RED);
        });
  • MichaelPascoeMichaelPascoe Member Posts: 876 PRO
    edited March 2021
    Here is a neat query explorer feature may help you out: https://forum.onshape.com/discussion/14777/query-explorer-feature

    Also, if you search the forums for "new custom feature" you will find most of my features. Some of the earlier ones have nice notes for someone starting from scratch.
  • viktor_paileviktor_paile Member Posts: 3
    Beautiful! Thanks for the solution and the tip!
    - So little time, so much to know!
Sign In or Register to comment.