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: 89
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
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com
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
Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn
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);
Experts in Onshape Automation - Custom Features and 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.
Commented on the wrong post. no idea how to delete
@GregBrown just released another video which highlights the use of report/dbg/warn/info. It's also a very impressive surfacing feature preview in its own right. I'm finally installing Report and planning to use it.
Echoing @Caden_Armstrong's comment above, any chance this will become part of the standard library?
Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn
@S1mon The feature listed on this thread is a text-only feature now called Log. It works more as a logging utility like log4j with different reporting levels: https://cad.onshape.com/documents/2e41d9b14474514b465272af/v/b05df9be566d5eab15a4c310/e/df39cb0dd3d2185144de9d83
Report as demonstrated in @GregBrown's video is here:
https://cad.onshape.com/documents/e2576bfe13aaaabd67b0fe1d/v/4322f20d8f97ab12eeab937c/e/e954caf65d5d66b94f8bb90a
And it's on this thread:
https://forum.onshape.com/discussion/29653/use-report-viz-and-dbg-for-conditional-println-and-debug-visualizations
Of the two, I much prefer Report, because I find I dont need the fine-grained level control and really need the ability to visualize onscreen elements. There's been quite a bit of adoption of the earlier Log feature which is why I didn't just kill it outright.