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.

Can I tell if a part property has already been set?

Evan_ReeseEvan_Reese Member Posts: 1,420 PRO
If a part property has been manually set, it can't be set by FeatureScript. I'm wanting to write a general-use function that can be used by any property-setting feature which can tell whether it's worked or not, and provide a message with instructions on re-setting properties if not. Seems like getProperty can't be used in the main feature function. I tried using it in editing logic, but even if the main function sets the name, it still only returns the pre-feature name. Can this be done? It seems like it could be useful to lots of people writing features, not just me.

Here's what I've tried so far: https://cad.onshape.com/documents/87f7a0c59449e08d9aa23e09/w/0badf39844ddae5eda7380ea/e/6258d6bf25bd8fed2b987dcd
Evan Reese / Principal and Industrial Designer with Ovyl
Website: ovyl.io

Best Answer

  • lanalana Onshape Employees Posts: 661
    Answer ✓
    Unfortunately, we don't know at the time of regeneration if setProperty would have the desired effect. a. A later feature might override that property, b. Interactively assigned properties are always applied at the end of regeneration.
    So it is really a question about the future.

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    getProperty() was supposed to work only in the custom tables, it's not working in features. Probably we could have at least an exception of setProperty() if it fails to reset the property or returned value of boolean type indicating completion status.
  • Evan_ReeseEvan_Reese Member Posts: 1,420 PRO
    Do you know of a way to tell whether setProperty() has worked? That's really all I'm looking for. Or are you saying it would be nice if the devs added that to the setProperty() function?
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Yes, I wanted to say that I have no idea how to find out this execution status of setProperty(), sorry.
  • Evan_ReeseEvan_Reese Member Posts: 1,420 PRO
    Got it. Well if you're not sure I'll probably table it for now.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • lanalana Onshape Employees Posts: 661
    Answer ✓
    Unfortunately, we don't know at the time of regeneration if setProperty would have the desired effect. a. A later feature might override that property, b. Interactively assigned properties are always applied at the end of regeneration.
    So it is really a question about the future.
  • Evan_ReeseEvan_Reese Member Posts: 1,420 PRO
    Thanks, Lana
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
Sign In or Register to comment.