JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    vectorChar vs. vectorText

    General Discussions
    2
    6
    858
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • rozek
      rozek last edited by

      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 require statements 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 vectorChar and vectorText: while both methods are described as producing outlines which have to be converted into paths in order to be used for rendering, vectorChar "hides" its segments in a sub-property outlines.segments while vectorText directly produces segments (although the example calls them outlines as 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

      z3dev 1 Reply Last reply Reply Quote 0
      • z3dev
        z3dev @rozek last edited by

        @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.

        https://github.com/jscad/OpenJSCAD.org/pull/1252

        1 Reply Last reply Reply Quote 1
        • rozek
          rozek @z3dev last edited by rozek

          @z3dev Good morning!

          As a very first starting point I've implemented a new function "text" in package @jscad/modeling.text which directly creates Path2 arrays.

          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!

          z3dev 1 Reply Last reply Reply Quote 2
          • z3dev
            z3dev @rozek last edited by

            @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

            rozek 1 Reply Last reply Reply Quote 0
            • rozek
              rozek @z3dev last edited by

              @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 vectorText to its own subproperty segments (outlines.segments = outlines) : in that case, one would always have to convert outlines.segments.

              From a user's point of view, however, the main question should probably be why vectorChar and vectorText do not produce paths right away - and why there are two such methods (since vectorText looks like a superset of vectorChar).

              A possible non-breaking consequence could be: invent a new function textPaths (or similar) with a signature like vectorText which 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

              z3dev 1 Reply Last reply Reply Quote 0
              • z3dev
                z3dev @rozek last edited by

                @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?

                rozek 1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB | Contributors