Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Set a custom property via Featuresript for another custom property
graeme_anderson
Member Posts: 9 PRO
I am currently trying to write a bit of featurescript that will query a manual entry custom property within a part and write it to another custom property in a drawing.
The part custom property has an ID that I can access, but I am really struggling to get the syntax right. Can anyone point me at an example of this?
Tagged:
0
Best Answers
-
MichaelPascoe Member Posts: 2,013 PRO
You don't need to call getProperty in order to use setProperty. In fact, getProperty is pretty difficult to use because Onshape doesn't get the property until the entire feature has been built, that is my understanding anyways. If you do need to use getProperty, here is how you can do it: getProperty - forum post
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴0 -
MichaelPascoe Member Posts: 2,013 PRO
Yeah, when getting properties, it only updates if you open up the feature due to the current limitations. Here is an improvement request you can vote on if you like: getProperty in FeatureScript - Improvement request
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴0
Answers
@graeme_anderson, once you create your custom property, it should have an ID. You can use that ID like this to set it within a custom feature. Setting a custom property is slightly different than setting a normal property, see the example below:
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
You don't need to call getProperty in order to use setProperty. In fact, getProperty is pretty difficult to use because Onshape doesn't get the property until the entire feature has been built, that is my understanding anyways. If you do need to use getProperty, here is how you can do it: getProperty - forum post
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Yeah, when getting properties, it only updates if you open up the feature due to the current limitations. Here is an improvement request you can vote on if you like: getProperty in FeatureScript - Improvement request
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴