Program to Calculate all Possible Lathe Thread Pitches

Advert

Program to Calculate all Possible Lathe Thread Pitches

Home Forums Suggested Online Resources Program to Calculate all Possible Lathe Thread Pitches

Viewing 13 posts - 26 through 38 (of 38 total)
  • Author
    Posts
  • #317521
    SillyOldDuffer
    Moderator
      @sillyoldduffer

      Who would have thought that people would be discussing pdf intricacies on a Model Engineering forum! Excellent explanation Richard.

      My other thought is that the pdf error is version related. Something new in edge or W10 that's incompatible with the library you're using. If so may be difficult to find and fix – so far I haven't had empty documents on linux or W10 ; pdf and csv both work. Nothing is ever easy.

      Thanks,

      Dave

      Advert
      #317522
      Neil Wyatt
      Moderator
        @neilwyatt
        Posted by SillyOldDuffer on 18/09/2017 11:45:49:

        Wild suggestion: Richard's code sets the font by name ('Helvetica' ) without checking that it actually exists. (It should but…)

        I don't know what the PDF library does if it can't find a font, but I suppose writing a document full blank glyphs is a possibility. (I've never understood how PDF files handle fonts; whether they load a copy of the font into the document, or just provide a link and expect the PDF reader to find it on the other system.)

        Might be worth initialising the PDFObject without setting a font at all. With luck a portable default will be used.

        Dave

        Edit: I hate automatic smileys!!!

        Edited By SillyOldDuffer on 18/09/2017 11:46:34

        Far cleverer that that, if you have a proper PDF creator. You can specify fonts as embedded or converted to curves. Embedded fonts can be done as subsets if less than a given percentage of characters are used

        They won't uses system fonts because that would open the possibility of loading a font that isn't identical to the one used to create the document and break the 100% consistent cross-platform appearance aim of the PDF format.

        #317526
        richardandtracy
        Participant
          @richardandtracy

          Embedding of fonts was my aim when I started.

          After reading the spec & trying to relate that to the information I could get out of Windows with my level of understanding, I fairly rapidly revised the aim.

          Maybe, one day…

          Regards,

          Richard.

          #317531
          SillyOldDuffer
          Moderator
            @sillyoldduffer
            Posted by Neil Wyatt on 18/09/2017 13:10:06:

            Posted by SillyOldDuffer on 18/09/2017 11:45:49:
            Far cleverer that that, if you have a proper PDF creator. You can specify fonts as embedded or converted to curves. Embedded fonts can be done as subsets if less than a given percentage of characters are used

            They won't uses system fonts because that would open the possibility of loading a font that isn't identical to the one used to create the document and break the 100% consistent cross-platform appearance aim of the PDF format.

            'if you have a proper PDF creator' – we may be getting closer to the problem.

            Richard's program uses a class library to set up and write the pdf document. I see he uses VCL and that Embracardo have various pdf offerings. Other pdf libraries are available, not least that sold by Adobe. Or Richard might be smart enough to have written his own.

            Whose library are you using Richard? Might be a known bug.

            Dave

            #317533
            richardandtracy
            Participant
              @richardandtracy

              My own.

              I am too much of a cheapskate to pay for anything if I can avoid it. I suppose it is rather like most of the stuff with model engineering – it's more effort, but more satisfying and cheaper to do it yourself. I have never charged for a program, and am never likely to, so paying for bolt-on's is not anything that is going to pay for itself. Software libraries are not high on my list of priorities for purchases. In July last year I found I had been using my 'PCPlus' cover disc of the C++ Builder 4 programming environment for exactly 16 years, and thought it wise to finally upgrade to C++ Builder 10.1, so when the price dropped from £205 to £49, I jumped at the chance. It is now free… teeth

              I have made my C++ Builder 10 pdf source code available for download here: **LINK** for anyone who is interested. I have been harbouring the hope some clever person may be able to use it, and maybe improve on it. Not happened so far that I have heard of, but there we go. I will update it if I can trace the source of the problems Thor is experiencing. As it is, it seems to work most of the time. Or it seemed that it did…

              Regards,

              Richard.

              #317547
              clivel
              Participant
                @clivel

                Hi Richard,
                if you want to try a PDF library, then I can completely recommend the free and open source libharu **LINK**
                Don't be put off by the fact that the library hasn't been updated for years, I first started using it in 2005, and it performs flawlessly to date generating multi-lingual PDF documents with embedded images.

                I am not familiar with C++ builder, but in the unlikely event that you ever want to change your build environment, then I would recommend the excellent gcc (Gnu Compiler Collection) C++ compiler. Again completely free and open source, it is included with http://www.cygwin.com and being cross platform I use it to compile the identical code on Windows, Linux & Mac.
                Clive

                #317550
                richardandtracy
                Participant
                  @richardandtracy

                  Thanks Clive, I have downloaded Libharu and will look into it.

                  Regards,

                  Richard.

                  #317621
                  SillyOldDuffer
                  Moderator
                    @sillyoldduffer

                    Ho hum, looks like Adobe changed the specification. Wikipedia says of the Standard Type 1 Fonts: 'However, since Adobe Acrobat version 6, most of these fonts are not guaranteed to be available in the reader, and may only display correctly if the system has them installed.'

                    Dave

                    #317644
                    clivel
                    Participant
                      @clivel
                      Posted by SillyOldDuffer on 18/09/2017 20:25:53:

                      Ho hum, looks like Adobe changed the specification. Wikipedia says of the Standard Type 1 Fonts: 'However, since Adobe Acrobat version 6, most of these fonts are not guaranteed to be available in the reader, and may only display correctly if the system has them installed.'

                      Dave

                      As the author and maintainer of an open source application that generates PDF files using the previously mentioned libharu I was very concerned upon reading that.
                      However in this case, I think that the ho hum should be directed at Wikipedia instead, Although it could possibly be true, I have not yet managed to find another reference to corroborate that statement.

                      Wikipedia is a fantastic resource, regrettably however it is not always reliable.

                      Clive

                      #317678
                      SillyOldDuffer
                      Moderator
                        @sillyoldduffer

                        Hi Clive,

                        Good point about the fallibility of Wikipedia, but they might be right. A quick look at the Adobe forum reveals that there have been multiple changes to what Acrobat does with fonts since 1993, and some of it has been further complicated by Microsoft.

                        My understanding (feel free to put me right) is that:

                        • PDF's generated by Richard's program do not contain an embedded font. Instead they contain a font name and expect the client's PDF Reader to provide the actual font.
                        • Adobe Acrobat has a number of standard fonts 'built-in'. If the pdf file calls for one of them all will be well. But there is the possibility that the list of standard fonts built into Acrobat has changed over time, or the font name is wrong, so that the named font can't be found. (There is also the possibility that Thor is using a third party pdf reader, with a slightly different font set.)
                        • If the PDF Reader fails to find the named font within the built-in set, it looks for the font on the host system. This opens up the possibility of the named font not being available at all, or on the system but in some way incompatible.

                        Thor's bug is interesting in that he gets blank pages. It implies that the document is being correctly populated but the font is empty, i.e all the characters produce white-space.

                        All supposition so far but I think the proposition could be tested by seeing if Thor gets readable text by using a font other than Helvetica, and/or by showing that a libharu program using Helvetica also produces blank pages on his computer.

                        I'm never quite sure if debugging programs is an interesting puzzle or a boring pain in the butt!

                        Dave

                        #317702
                        richardandtracy
                        Participant
                          @richardandtracy

                          I am really confused by the problems with Thor's pdf file. I sent him one that worked OK on my machine under Acrobat Reader SD (the latest) but it failed to read on his machine using Edge & Firefox (which presumably calls up a reader to embed the pdf in a tab).

                          I also got the same file to open with PDFCreator, but it failed with PDFsam. I am stumped. Very stumped.

                          I think I'll leave it be for the moment, and try a few experiments with libharu. I will upload the 'decimal comma hardened' version of the program this evening, which should make it more likely to work with more machines. If I can get the libharu libraries to work for me under C++ Builder 10, I will upgrade the program to use it, but given my likely schedule in the near/medium future, my programming time is likely to be curtailed and developments will be slow.

                          Regards,

                          Richard.

                          #317706
                          Thor 🇳🇴
                          Participant
                            @thor

                            Thanks Richard,

                            for your efforts to sort out this problem. I have now tested the revised PDF you sent me on a couple of other computers. It opened without problem in the default PDF reader on Linux Mint. I have also tried it on my old Windows XP and the old Acrobat Reader opened the file without problems.

                            Thor

                            #389202
                            Andrew Wood 7
                            Participant
                              @andrewwood7

                              Just discovered this brilliant program, thanks very much Richard. I was struggling to find an accurate 32tpi setting on my WM180 and using the program (on XP) with a bit of sorting in excel using the csv files I found several possibilities. The WM180 has an extra gear wheel but varying the initial ratio setting enabled me to get the correct answers. I already had made an excel program to calculate the pitch and tpi so it was easy to check. It's a pity this couldn't be somewhere more prominently on the ME site as it was only by chance I happened on the link. I haven't tried the pdf option btw.
                              Andrew

                            Viewing 13 posts - 26 through 38 (of 38 total)
                            • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                            Advert

                            Latest Replies

                            Viewing 25 topics - 1 through 25 (of 25 total)
                            Viewing 25 topics - 1 through 25 (of 25 total)

                            View full reply list.

                            Advert

                            Newsletter Sign-up