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

"UIHint" : UIHint.COLLAPSE_ARRAY_ITEMS - Help returning the definition?

MichaelPascoeMichaelPascoe Member Posts: 1,713 PRO
edited June 2021 in FeatureScript
I'm trying to add a button that collapses the array items when needed. I'm still learning how to create functions and return definitions.

What is a good way to return the definition of: "UIHint" : UIHint.COLLAPSE_ARRAY_ITEMS
https://cad.onshape.com/documents/0fd0d47d9fced5bd2f4e9a65/w/bc8c5451b55eed1b1f21d5c8/e/fa063cc724c97cce5e5faac2

Thanks!

Learn more about the Gospel of Christ  ( Here )

CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎

Best Answer

  • Options
    Alex_KempenAlex_Kempen Member Posts: 244 EDU
    Answer ✓
    As far as I'm aware, there isn't a way to collapse or expand arrays using editing logic, only fill in parameters inside them. You could do things like conditionally adding or removing array items (by adding on to the array), but I'm not sure whether that's useful for your application.

    If you do want to use editing logic to work with arrays, I would recommend using my arrayParamterChange functions here to help determine when to run sub sections of your code and prevent errors during runtime.

    If you're interested in learning more about functions, then you may benefit from reading through my intro to functions guide here. Editing logic essentially returns the definition but with some things rearranged (or not). The benefit of doing stuff in the editing logic (as opposed to, say, the feature body itself), is that the changed editing logic definition is filled into the feature's UI, allowing the user to make further changes as they see fit.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Answers

  • Options
    Alex_KempenAlex_Kempen Member Posts: 244 EDU
    Answer ✓
    As far as I'm aware, there isn't a way to collapse or expand arrays using editing logic, only fill in parameters inside them. You could do things like conditionally adding or removing array items (by adding on to the array), but I'm not sure whether that's useful for your application.

    If you do want to use editing logic to work with arrays, I would recommend using my arrayParamterChange functions here to help determine when to run sub sections of your code and prevent errors during runtime.

    If you're interested in learning more about functions, then you may benefit from reading through my intro to functions guide here. Editing logic essentially returns the definition but with some things rearranged (or not). The benefit of doing stuff in the editing logic (as opposed to, say, the feature body itself), is that the changed editing logic definition is filled into the feature's UI, allowing the user to make further changes as they see fit.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,713 PRO
    This is great info, thanks @Alex_Kempen!

    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.