vectorChar vs. vectorText
-
Hello!
First of all: thank you very much for [Open]JSCAD - it often helps me modeling technical objects which can then be sent to a 3D printer.
A few days ago, I've started tweaking the JSCAD User Guide mainly by adding
requirestatements to the examples found there in order to simplify coding for casual JSCAD users like me.During that process, I - again - stumbled across a difference between
vectorCharandvectorText: while both methods are described as producingoutlineswhich have to be converted intopathsin order to be used for rendering,vectorChar"hides" its segments in a sub-propertyoutlines.segmentswhilevectorTextdirectly producessegments(although the example calls themoutlinesas well).Shouldn't both methods behave similarly? Or shouldn't the examples and their descriptions clearly describe the differences between both methods?
With greetings from Germany,
Andreas Rozek
-
@rozek hope that you are still using JSCAD.
there are some changes to vectorChar and vectorText, which will become part of V3 JSCAD. if you have time then please take a look.
-
@z3dev Good morning!
As a very first starting point I've implemented a new function "text" in package
@jscad/modeling.textwhich directly createsPath2arrays.It is currently part of my own fork of OpenJSCAD only, as I expect multiple changes before it might get accepted and become ready for an official PR. Additionally, my tests are still almost empty (as I have to learn AVA first) and only test for an execution w/o throwing any exceptions...
Happy Easter!
-
@rozek thanks for the insights.
I think most of your suggestions are spot on. The logic of vectorChar and vectorText are solid but these data structures don’t produce anything that can be immediately used.
I’m not certain which direction will be taken, so I created a new issue to track these ideas, #1067
-
@z3dev well,
suggestions would depend on whether you would accept breaking API changes or prefer keeping the API stable.
A somewhat silly idea could be to assign the output of
vectorTextto its own subpropertysegments(outlines.segments = outlines) : in that case, one would always have to convertoutlines.segments.From a user's point of view, however, the main question should probably be why
vectorCharandvectorTextdo not produce paths right away - and why there are two such methods (sincevectorTextlooks like a superset ofvectorChar).A possible non-breaking consequence could be: invent a new function
textPaths(or similar) with a signature likevectorTextwhich directly produces paths:const { textPaths } = require('@jscad/modeling').text const paths = textPaths('JSCAD')Such a method should be trivial to implement.
With greetings from Germany,
Andreas Rozek
-
@rozek super analysis!
I also noticed the inconsistency, and wondered if these could be brought into a slightly more useful paradigm. Do you have any suggestions?