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.

Is there a way of excluding a piece of code to a single action command?

darren_13darren_13 Member, Developers Posts: 119 PRO
This makes sense in my head, to elaborate... If I have a piece of code that is intensive in terms of many iterations etc, I don't want it to run every time I change a variable. Is there a way of holding off until the setup is finalised and then have some kind of way (maybe a button) to activate the intensive part? I thought about using a boolean but then I would have to both activate then deactivate, this could suffice.

Comments

  • darren_13darren_13 Member, Developers Posts: 119 PRO
    I think to answer my own question after a bit more thought, the boolean might be my better option.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    I think a boolean is the best thing available for that kind of thing right now, for e.g. a checkmark saying "build" at the bottom.

    Alternatively, if the heavy work is arriving at some numerical solution that's fast to verify but slow to calculate, you could put that output in a hidden variable. Then, an editing logic function can verify that value and recalculate it if necessary, ensuring the slow work is only done when the value needs to change. Naturally, this may or may not apply to your situation.
Sign In or Register to comment.