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.
Text sketching qSketchRegion FilterInnerLoop detection bug?
brian_guan
Member Posts: 13 ✭✭
Hi,
Before Thanksgiving I posted a question in this forum and I was getting some help but my issue is still not completely resolved. See:
https://forum.onshape.com/discussion/5254/how-to-query-text-for-extrusion-to-avoid-inner-empty-area-s
Basically if I have some text I wanted to extrude, qSketchRegion with FilterInnerLoop set to true is not really detecting glyphs with any internal feature e.g. the inner C in the Copyright symbol "©", or many CJK words e.g. "国", symbols and emojis like ☺ will have this problem too.
Here's what it looks like:
My document with FeatureScript demonstrating this bug is here:
https://cad.onshape.com/documents/dfe47c38f8c2d31762a5130d/w/b447e2582ee3a8273fda859c/e/8c4c6a795ebbfcb76fe31687
Obviously I can perform selective querying to get the surface area for problematic glyphs but that will require too much intimate knowledge of the glyphs which is not appropriate for the script to handle.
If OnShape folks are monitoring this, I hope you can suggest some remedy and/or enter a bug report. Thanks.
Before Thanksgiving I posted a question in this forum and I was getting some help but my issue is still not completely resolved. See:
https://forum.onshape.com/discussion/5254/how-to-query-text-for-extrusion-to-avoid-inner-empty-area-s
Basically if I have some text I wanted to extrude, qSketchRegion with FilterInnerLoop set to true is not really detecting glyphs with any internal feature e.g. the inner C in the Copyright symbol "©", or many CJK words e.g. "国", symbols and emojis like ☺ will have this problem too.
Here's what it looks like:
My document with FeatureScript demonstrating this bug is here:
https://cad.onshape.com/documents/dfe47c38f8c2d31762a5130d/w/b447e2582ee3a8273fda859c/e/8c4c6a795ebbfcb76fe31687
Obviously I can perform selective querying to get the surface area for problematic glyphs but that will require too much intimate knowledge of the glyphs which is not appropriate for the script to handle.
If OnShape folks are monitoring this, I hope you can suggest some remedy and/or enter a bug report. Thanks.
0
Comments
We agree that the filterInnerLoops flag is better with the change you describe. I've written up the bug and will let you know here if the change gets made.
Thanks for reporting.
I have worked out one way to handle the case of glyphs that have more than one level of nested inner loops. The technique is shown in this public document (this link points to a particular version of the document, which is still a work in progress -- the latest version might be more cleaned up). Look particularly at the deleteEvenRankFaces() function, which deletes the appropriate faces so that only the correct "ink" faces remain (I use the word "ink" here in the sense of a region of ink on paper in a glyph - in the case of the copyright glyph, there are two ink faces: (1) the closed annulus, (2) the 'C' character. An OnShape sketch containing a sketchText entity that contains the copyright glyph creates a sheet body that has 3 faces: the aforementioned two 'ink' faces, and the face that covers the region of plane bounded by the inner loop of the closed annulus and the loop that bounds the 'C' character. This latter face is not an ink face. deleteEvenRankFaces() processes an arbitrary set of sheet bodies (such as the sheet bodies that are created by a sketch containing a sketchText object) and is not specific to text. As an example of how you might use this function to work with text, see the new_textLayout() function, specifically the definition of the this[].build() function within the body of the new_textLayout() function.
The deleteEvenRankFaces() algorithm works like this:
For any set of faces in a sheet body, we identify (using the onShape query functions), a subset of those faces that have an edge that belongs to a single face. Call this subset the set of 'outer faces'. Starting with the set of all faces of all sheet bodies created by the sketchText sketch entity, we peel away sets of outer faces, iteratively, until all the faces have been peeled away. (One iteration of 'peeling away' consists of identifying the outer faces, and then removing those faces from the sight of subsequent iterations of the peeling process; it is this 'removal from sight' that I am calling 'peeling away'. We assign each face a 'rank' (an integer, starting with 1 and counting up) that is the number of the iteration on which it was peeled away. (The faces that are peeled away in the first iteration are assigned rank 1, the faces peeled away in the second iteration are assigned rank 2, etc.) The ink regions are the faces with odd rank. The function deleteEvenRankFaces() uses opDeleteFace() to delete all the faces having an even rank. The sheetBodies, having had their even faces deleted by deleteEvenRankFaces(), then consist of precisely the faces that we want to extrude to form "ink."
-Neil
Here is a screenshot showing the sheetBodies created by a text containing a sketchText entity, after the sheetBodies have been processed by deleteEvenRankFaces().
Those characters that look like zeros after the '3' are not actually zeros - they are in fact Unicode codepoint U+0298, which, in the Tinos font, consists of a ring containing an isolated dot (topologically the same as the copyright symbol).