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.

API: Reset part properties

john_mcclaryjohn_mcclary Member, Developers Posts: 3,890 PRO
edited July 2019 in Data management

Is there an API program I can have written up  that will reset part properties that have been manually edited, so that I can use featurescripts on a part that has had those props overridden?

It would be nice if I could pick and choose which properties I need, even If I need to paste in the internal ID each time for the custom properties.

Mainly I just need : Material, StockSize(Custom Property), Weight(Custom Property) 

This would sure beat deleting the base feature and re-linking all of the broken features after it, just to get a "fresh" part.

-Question 2: I do not have any experience with the API, so someone will have to write this up for me. Would anyone be willing?

Best Answers

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,890 PRO
    Answer ✓
    We're actually working on functionality that will let you reset part properties interactively.  I'm not aware of currently exposed APIs for this.
    That's what I really wanted to hear!
    I know I can't ask when but, How high on the priority/upcoming improvements list is this?
    It has been a request from me since featurescripts could write to properties :)

    And re-linking/dimensioning an entire model just to use the featurescripts ends up taking about the same time as filling in the properties manually.
    So I tend to bite the bullet and make the model parametric, so when I copy it again for a new job it is quick to update.

    As far as paying someone to write it, I would say no at this time. Knowing  the app will be obsolete eventually. And how often this becomes a major issue. I was hoping there was a 5 lines of code answer. "Ah yes, that's just part.property["Material"] = null;"  :( no such luck I guess

    Thanks

Answers

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,890 PRO
    Answer ✓
    We're actually working on functionality that will let you reset part properties interactively.  I'm not aware of currently exposed APIs for this.
    That's what I really wanted to hear!
    I know I can't ask when but, How high on the priority/upcoming improvements list is this?
    It has been a request from me since featurescripts could write to properties :)

    And re-linking/dimensioning an entire model just to use the featurescripts ends up taking about the same time as filling in the properties manually.
    So I tend to bite the bullet and make the model parametric, so when I copy it again for a new job it is quick to update.

    As far as paying someone to write it, I would say no at this time. Knowing  the app will be obsolete eventually. And how often this becomes a major issue. I was hoping there was a 5 lines of code answer. "Ah yes, that's just part.property["Material"] = null;"  :( no such luck I guess

    Thanks
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,890 PRO
    Thanks @billy2 I think at this point I'll wait for the Onshape native reset. I didn't think it was on their radar yet. Sounds like it is.
    I could hold out for a while longer
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    There's a bit of a cheat whereby the original part is transformed by a copy in place feature and the original deleted.  That will yield something that can be written to via FS.  Of limited use if you're using the original downstream perhaps though.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,890 PRO
    Right, pretty much one of the cheats I have tried, 
    but still need to replace in assemblies, and re-dimension

    that's why I choose to go for broke and break the first feature, for when I may a copy of the document, the problem will not still show a band-aid :)
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited July 2019
    John-

    There's a little bit to the API. It'd be harder to write the authorization than your featurescript adaptor. 

    After all, you don't want anyone with a server to be able to change your stuff. So when API'ing who have to deal with permissions.

    In your case, you want to access your stuff, which I believe the new enhancement will have baked in. A nice new enhancement for users and their data.

    Through the API, you'd need an api key, which requires registering, which isn't very hard, but....


Sign In or Register to comment.