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.

Options

Is there a way to control dependencies in the 'configure properties' table?

I'm wondering if anyone can tell me how to use FS to control dependencies in the configurations property table(if possible). For instance, I have a hose I want to vary in both diameter and length. For any length of hose with D=1", I would want the part number to be 1. For any length of hose with D=2", I would want the part number to be 2..and so on. The part number is entirely dependent on the diameter. When using the configured properties table, Onshape requires the part number be dependent on both the length and diameter. This means, if I cut this hose a thousand different lengths over time, I have to configure the part number a thousand different times rather than just being able to say 'if d=1, then PN=1'.

P.S. I'm level 'extra-novice' when it comes to FS.

Answers

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 PRO
    edited February 2022
    To set a part property within FS, use setProperty. You can round D to the nearest whole number and use that as your part number. Note that this is not connected to the configurations panel.

    Here is one way to do this:
            var partNumber = round(D, 1);
    
            setProperty(context, {
                    "entities" : entities,
                    "propertyType" : PropertyType.PART_NUMBER,
                    "value" : partNumber
            });


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
Sign In or Register to comment.