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.
FeatureScript writers: Stop using println! And start using Report (New FeatureScript announcement)
jnewth_onshape
Member, Onshape Employees Posts: 78
Actually, It's totally ok to continue using println!
But I wanted to introduce a new FeatureScript called Report that will help you control your featurescript notice area output. It's a bit hard to describe, so take a look at the HOWTO video below:
https://www.loom.com/share/1675f893610c4b09b2be446d53ffb3c5?sid=2c13d7c5-cd78-4449-8a13-583772e25596
Report lets you control which messages get reported to the Notices area via feature, making it much easier to debug your code. You can specify importance (info, debug, or warn), and you can "key" messages so that only certain key messages get reported. This is a lot simpler than having to remove all your println statements before shipping your feature!
Here's the document, which includes some helpful examples: https://cad.onshape.com/documents/2e41d9b14474514b465272af/v/906eb0d4ca75f78b4e3515f4/e/f6a2d12db7090f97b92d54ea
Let me know what you think in the comments.
But I wanted to introduce a new FeatureScript called Report that will help you control your featurescript notice area output. It's a bit hard to describe, so take a look at the HOWTO video below:
https://www.loom.com/share/1675f893610c4b09b2be446d53ffb3c5?sid=2c13d7c5-cd78-4449-8a13-583772e25596
Report lets you control which messages get reported to the Notices area via feature, making it much easier to debug your code. You can specify importance (info, debug, or warn), and you can "key" messages so that only certain key messages get reported. This is a lot simpler than having to remove all your println statements before shipping your feature!
Here's the document, which includes some helpful examples: https://cad.onshape.com/documents/2e41d9b14474514b465272af/v/906eb0d4ca75f78b4e3515f4/e/f6a2d12db7090f97b92d54ea
Let me know what you think in the comments.
9
Comments
One request: A simple FS function enableAllReports(). This lets an author get started writing with everything on by default (without needing to add an extra feature and navigate its UI), but then easily switch before shipping to only logging when needed.
So the usage pattern would be:
1. start FS writing
2. add enableAllReports() in custom FS to turn everything on.
3. Eventually get around to adding a Report feature to the feature tree in the test part studio.
4. Remove the call to enableAllReports() (alternative: The Report feature itself ignores the directive if there is a report feature already active in the tree)
https://www.youtube.com/watch?v=Vr9811KgqQQ
Is there a reason that its not part of the standard library?
Itd be a little bit easier to find if we just had to do an import(path:"onshape/std/report.fs", version:xxxx);
Custom FeatureScript and Onshape Integrated Applications
I thought about it but it didn't seem like a typical fit for the standard library. Perhaps we can reconsider, if people use it a lot.