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.

Custom table/property for sheet metal area

Lucas_KuhnsLucas_Kuhns Member, csevp Posts: 99 PRO
Does anyone know how I could create a custom property for the area of a sheet metal part's flat pattern?

Comments

  • eric_pestyeric_pesty Member Posts: 1,885 PRO
    Haven't tried this but if you can't get it directly you could use the volume and divide by the thickness... Depends if you want to include any cutouts or not...
  • Lucas_KuhnsLucas_Kuhns Member, csevp Posts: 99 PRO
    I would want the true area of the part like this:


  • eric_pestyeric_pesty Member Posts: 1,885 PRO
    This should just be (part volume / thickness) since the thickness is uniform...
  • Lucas_KuhnsLucas_Kuhns Member, csevp Posts: 99 PRO
    That is very true. The thing is, I'm not a programmer. Is it simple enough that taking the training course in FeatureScript would get me everything to do this? Is there someone on here I could pay to build this?
  • eric_pestyeric_pesty Member Posts: 1,885 PRO
    edited August 2022
    I haven't tried it yet but it should be fairly straightforward I think?
    Here's a "step by step" process for created a computed property (the example computes the volume so all you need to do is figure out how to get the thickness and divide the two): 
    https://cad.onshape.com/FsDoc/computed-part-properties.html

  • MichaelPascoeMichaelPascoe Member Posts: 1,988 PRO
    edited August 2022
    If you are having someone write your custom features or API, CADSharp is the way to go. I have seen tasks automated that I didn't know were possible in Onshape. You can reach out to me or visit our website CADSharp.com

    About this specific question, yes, this is possible. @eric_pesty is right. 

    Here are some different approaches you could take:
    Face area: Custom feature
    Volume / thickness: Custom feature
    FeatureScript 1821;
    import(path : "onshape/std/geometry.fs", version : "1821.0");
    
    export enum Options
    {
        Description,
        Custom
    }
    
    annotation { "Feature Type Name" : "Set property area (CADSharp)" }
    export const setPropertyArea = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Face", "Filter" : EntityType.FACE }
            definition.face is Query;
    
            annotation { "Name" : "Tangent connected faces", "Default" : true }
            definition.tanConnectedFaces is boolean;
    
            annotation { "Name" : "Save as", "UIHint" : UIHint.SHOW_LABEL }
            definition.options is Options;
    
            if (definition.options == Options.Custom)
            {
                annotation { "Name" : "Custom property ID" }
                definition.customPropertyId is string;
            }
        }
        {
            const part = qOwnerBody(definition.face);
            var face = definition.face;
    
            if (definition.tanConnectedFaces)
            {
                const tangentConnectedFaces = qTangentConnectedFaces(definition.face);
                face = tangentConnectedFaces;
            }
    
            const area = evArea(context, {
                        "entities" : face
                    });
    
            debug(context, face, DebugColor.GREEN);
    
            if (definition.options == Options.Description)
            {
                setProperty(context, {
                            "entities" : part,
                            "propertyType" : PropertyType.DESCRIPTION,
                            "value" : toString(roundToPrecision(area.value, 3)) ~ " m^2"
                        });
            }
            else if (definition.options == Options.Custom)
            {
                setProperty(context, {
                            "entities" : part,
                            "propertyType" : PropertyType.CUSTOM,
                            "customPropertyId" : definition.customPropertyId,
                            "value" : area
                        });
            }
        });


    Note that to set it as a custom property, you will need to create that property as a company admin or owner first, see this Onshape tutorial.



    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • Lucas_KuhnsLucas_Kuhns Member, csevp Posts: 99 PRO
    @MichaelPascoe Thank you for your help. I may have a project or two for CADSharp.
  • MichaelPascoeMichaelPascoe Member Posts: 1,988 PRO
    Of course.

    Great, I'll send you a DM. 

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • antlu65antlu65 Member Posts: 59 EDU
    edited August 2022
    Here is babby's attempt at it: Sheet Metal Area. Pls let me know if it needs additional functionality - or if it's completely off the mark. Cheers!




  • Lucas_KuhnsLucas_Kuhns Member, csevp Posts: 99 PRO
    WOW! Very cool. It seems to work great.
Sign In or Register to comment.