JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    vectorChar vs. vectorText

    Scheduled Pinned Locked Moved General Discussions
    6 Posts 2 Posters 2.1k Views 1 Watching
    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.
    • rozekR Offline
      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

      z3devZ 1 Reply Last reply Reply Quote 0
      • z3devZ Offline
        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?

        rozekR 1 Reply Last reply Reply Quote 0
        • rozekR Offline
          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

          z3devZ 1 Reply Last reply Reply Quote 0
          • z3devZ Offline
            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

            rozekR 1 Reply Last reply Reply Quote 0
            • rozekR Offline
              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!

              z3devZ 1 Reply Last reply Reply Quote 2
              • z3devZ Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                Powered by NodeBB | Contributors