Loading ...
Sorry, an error occurred while loading the content.

SCALING DIMENSIONS

Expand Messages
  • bozlawless
    IF i have a file that has numbers and i want to take away the amount can this be done in nottab example I need for it to ask me how much to change by then
    Message 1 of 15 , Nov 20, 2009
    • 0 Attachment
      IF i have a file that has numbers and i want to take away the amount can this be done in nottab example

      I need for it to ask me how much to change by then search the document and do the following
      example
      X3.000 CHANGE TO X2.500
      X2.000 CHANGE TO X1.500
      X1.000 CHANGE TO 0.500 ECT


      SCALING DIMENSIONS
    • hsavage
      ... amount can this be done in nottab example ... document and do the following ... boz, Will the subtraction always the same, e.g., in your example the take
      Message 2 of 15 , Nov 20, 2009
      • 0 Attachment
        bozlawless wrote:
        > IF i have a file that has numbers and i want to take away the
        amount can this be done in nottab example
        >
        > I need for it to ask me how much to change by then search the
        document and do the following
        > example
        > X3.000 CHANGE TO X2.500
        > X2.000 CHANGE TO X1.500
        > X1.000 CHANGE TO 0.500 ECT
        >
        >
        > SCALING DIMENSIONS

        boz,

        Will the subtraction always the same, e.g., in your example the take
        away is .500 on each line. If so, it should be fairly easy to do the
        chore in NoteTab.

        Please submit a slightly larger, real, example for the list members
        to work on.

        ·············································
        ºvº SL_day# 324 - created 2009.11.20_22.37.07

        Suburbia; where they tear out the trees -
        • then name streets after them.

        € hrs € hsavage € pobox € com

        >
      • bozlawless
        OK HERE IS A LARGER EXAMPLE and no it will not always be .500 it will change form file to file but it should only change the numbers with X INFRONT CLEAR DRAW
        Message 3 of 15 , Nov 20, 2009
        • 0 Attachment
          OK HERE IS A LARGER EXAMPLE and no it will not always be .500 it will change form file to file but it should only change the numbers with X INFRONT

          CLEAR
          DRAW
          N 0001 G00 X20 Z20
          N0002 G50 S2500
          NAT11
          N0010 G97 S255 M41 M04 M08
          N0011 G00 X3 Z-0.156 T111111
          N0012 G96 S200
          N0013 G73 X2.641 Z-0.856 K0.14 D18 L0.5 F0.1 E0.47
          N0014 G97 S255 M09
          N0015 G00 X20 Z20
          N0016 M01
          NAT03
          N0020 G97 S446 M08
          N0021 G00 Z0.075 T030303
          N0022 X3
          N0023 G96 S350
          N0024 G87 N0025
          N0025 G81
          N0026 G00 X2.91
          N0027 G01 Z0 G42 F0.0015
          N0028 Z-0.156 F0.002
          N0029 X2.897
          N0030 Z-0.2166
          N0031 G03 X2.897 Z-0.2354 I-0.0034 K-0.0094
          N0032 G01 Z-0.3566
          N0033 G03 X2.897 Z-0.3754 I-0.0034 K-0.0094
          N0034 G01 Z-0.4966
          N0035 G03 X2.897 Z-0.5154 I-0.0034 K-0.0094
          N0036 G01 Z-0.6366
          N0037 G03 X2.897 Z-0.6554 I-0.0034 K-0.0094
          N0038 G01 Z-0.7766
          N0039 G03 X2.897 Z-0.7954 I-0.0034 K-0.0094
          N0040 G01 Z-0.9166
          N0041 G03 X2.897 Z-0.9354 I-0.0034 K-0.0094
          N0042 G40 G01 I0.0004
          N0043 G80
          N0044 G01 X2.9048 Z-0.9265
          N0045 G00 X20
          N0046 G97 S67 M09
          N0047 M01
          NAT03
          N0050 G97 S446 M08
          N0051 G00 Z0.075 T030303
          N0052 X3
          N0053 G96 S350
          N0054 G87 N0055
          N0055 G81
          N0056 G00 X2.91
          N0057 G01 Z-0.2 G42 F0.0015
          N0058 X2.897 F0.002
          N0059 Z-0.2166
          N0060 G03 X2.897 Z-0.2354 I-0.0034 K-0.0094
          N0061 G01 Z-0.3566 F0.02
          N0062 G03 X2.897 Z-0.3754 I-0.0034 K-0.0094 F0.002
          N0063 G01 Z-0.4966 F0.02
          N0064 G03 X2.897 Z-0.5154 I-0.0034 K-0.0094 F0.002
          N0065 G01 Z-0.6366 F0.02
          N0066 G03 X2.897 Z-0.6554 I-0.0034 K-0.0094 F0.002
          N0067 G01 Z-0.7766 F0.02
          N0068 G03 X2.897 Z-0.7954 I-0.0034 K-0.0094 F0.002
          N0069 G01 Z-0.9166 F0.02
          N0070 G03 X2.897 Z-0.9354 I-0.0034 K-0.0094 F0.002
          N0071 G40 G01 I0.0004
          N0072 G80
          N0073 G01 X2.9048 Z-0.9265
          N0074 G00 X20
          N0075 G97 S67 M05 M09
          N0076 Z20
          N0077 M01
          N0078 M02

          --- In ntb-clips@yahoogroups.com, hsavage <hsavage@...> wrote:
          >
          > bozlawless wrote:
          > > IF i have a file that has numbers and i want to take away the
          > amount can this be done in nottab example
          > >
          > > I need for it to ask me how much to change by then search the
          > document and do the following
          > > example
          > > X3.000 CHANGE TO X2.500
          > > X2.000 CHANGE TO X1.500
          > > X1.000 CHANGE TO 0.500 ECT
          > >
          > >
          > > SCALING DIMENSIONS
          >
          > boz,
          >
          > Will the subtraction always the same, e.g., in your example the take
          > away is .500 on each line. If so, it should be fairly easy to do the
          > chore in NoteTab.
          >
          > Please submit a slightly larger, real, example for the list members
          > to work on.
          >
          > ·············································
          > ºvº SL_day# 324 - created 2009.11.20_22.37.07
          >
          > Suburbia; where they tear out the trees -
          > • then name streets after them.
          >
          > € hrs € hsavage € pobox € com
          >
          > >
          >
        • hsavage
          ... will change form file to file but it should only change the numbers with X INFRONT ... boz, Will the subtrahend be a fixed amount or percentage throughout
          Message 4 of 15 , Nov 20, 2009
          • 0 Attachment
            bozlawless wrote:
            > OK HERE IS A LARGER EXAMPLE and no it will not always be .500 it
            will change form file to file but it should only change the numbers
            with X INFRONT
            >
            > CLEAR
            > DRAW
            > N 0001 G00 X20 Z20

            boz,

            Will the subtrahend be a fixed amount or percentage throughout an
            individual file or will it vary with each line, occurrence of Xnumbers.

            If there's no pattern the job would be nearly impossible to achieve.

            ·············································
            ºvº SL_day# 325 - created 2009.11.21_00.27.08

            Telephone Skills; How to Hang Up.

            € hrs € hsavage € pobox € com
          • Axel Berger
            ... I ve cobbled this together and it seems to work: ^!Set %Diff%=^?{Value to subtract: } ^!Jump TEXT_START ... ^!Find X([0-9.]+) D RS1 ^!IfError Weiter
            Message 5 of 15 , Nov 20, 2009
            • 0 Attachment
              bozlawless wrote:
              > it will change form file to file

              I've cobbled this together and it seems to work:

              ^!Set %Diff%=^?{Value to subtract: }
              ^!Jump TEXT_START
              :Loop
              ^!Find "X([0-9.]+)\D" RS1
              ^!IfError Weiter
              ^!InsertText ^$Calc(^$GetSelection$-^%Diff%;3)$
              ^!Goto Loop
              :Weiter
              ^!Jump TEXT_START

              Axel
            • flo.gehrke
              ... Regrettably, we still don t know bozlawless exact intentions. Nevertheless, Axel s solution is possibly a suitable approach. What interests me is how we
              Message 6 of 15 , Nov 21, 2009
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                >
                > I've cobbled this together and it seems to work:
                >
                > ^!Set %Diff%=^?{Value to subtract: }
                > ^!Jump TEXT_START
                > :Loop
                > ^!Find "X([0-9.]+)\D" RS1
                > ^!IfError Weiter
                > ^!InsertText ^$Calc(^$GetSelection$-^%Diff%;3)$
                > ^!Goto Loop
                > :Weiter
                > ^!Jump TEXT_START
                >
                > Axel

                Regrettably, we still don't know "bozlawless'" exact intentions. Nevertheless, Axel's solution is possibly a suitable approach.

                What interests me is how we could cut off decimal numbers from the result in case they are '.000'. Note that, in the original data, we see decimal numbers only in case the "X-number" is a fraction.

                Similar to Axel's approach, the following clip might be a solution:


                ^!Set %Diff%=^?{Value to subtract: }
                ^!Jump 1

                :Loop
                ^!Find "X\K[\d.]+" RS
                ^!IfError End
                ^!Set %Result%=^$Calc(^$GetSelection$-^%Diff%;3)$
                ^!If ^$Calc(^%Result% - TRUNC(^%Result%))$ <> 0 Next Else Skip_2
                ^!InsertText ^%Result%
                ^!Goto Skip
                ^!InsertText ^$Calc(TRUNC(^%Result%))$
                ^!Goto Loop

                Please let me know if there is better to check for decimal numbers. I have always missed a function like "^$GetDecimal(fraction)$".

                Flo
              • Axel Berger
                ... I noticed that too, but I just assume some extra digits won t hurt. As ^$Calc only seems to be able to make a fixed number of digits and I didn t want to
                Message 7 of 15 , Nov 22, 2009
                • 0 Attachment
                  "flo.gehrke" wrote:
                  > how we could cut off decimal numbers from the result

                  I noticed that too, but I just assume some extra digits won't hurt. As
                  ^$Calc only seems to be able to make a fixed number of digits and I
                  didn't want to lose information I made them equal to the highest number
                  I saw in the sample.

                  I still balk at the more involved elements of Regex like \K, look behind
                  and such and try to make do with the subset I have mastered so far.

                  Axel
                • Don - HtmlFixIt.com
                  Not following this one fully ... but calc will do set decimals ... ^$Calc(Expression[;Decimals])$ Calculates mathematical expressions. Use the optional
                  Message 8 of 15 , Nov 22, 2009
                  • 0 Attachment
                    Not following this one fully ...
                    but calc will do set decimals ...
                    ^$Calc(Expression[;Decimals])$

                    Calculates mathematical expressions. Use the optional Decimals parameter
                    to define how many decimals should be displayed


                    Axel Berger wrote:
                    > "flo.gehrke" wrote:
                    >> how we could cut off decimal numbers from the result
                    >
                    > I noticed that too, but I just assume some extra digits won't hurt. As
                    > ^$Calc only seems to be able to make a fixed number of digits and I
                    > didn't want to lose information I made them equal to the highest number
                    > I saw in the sample.
                    >
                    > I still balk at the more involved elements of Regex like \K, look behind
                    > and such and try to make do with the subset I have mastered so far.
                    >
                    > Axel
                  • flo.gehrke
                    ... Thanks, Don! But that s not the point. As you can see in both Axel s and my clip we don t have any problem with defining decimals . The question was how
                    Message 9 of 15 , Nov 22, 2009
                    • 0 Attachment
                      --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                      >
                      > Not following this one fully ...
                      > but calc will do set decimals ...
                      > ^$Calc(Expression[;Decimals])$
                      >
                      > Calculates mathematical expressions. Use the optional Decimals
                      > parameter to define how many decimals should be displayed

                      Thanks, Don! But that's not the point. As you can see in both Axel's and my clip we don't have any problem with "defining decimals".

                      The question was how to find a *flexible* solution, that is: Calculate with three decimals but cut them off in case they are zeros only. For example, reduce a result that is 12.000 to 12 but don't change a result that is '12.345'.

                      For that, we must have a solution for separating integral and decimal numbers. The only way I've seen so far is using ^$Calc$ with the TRUNC operator (see my clip). But is there a better way?

                      A work-around would be to use the EVAL utility I described in message #19834. For example, when entering '12.75' in...

                      ^!Set %Val%=^?[Enter a fraction:]
                      ^!Info ^$GetDosOutput(Eval FRACC(^%Val%))$

                      the value '0.75' will be returned. So we could use this to check for .000 too.

                      Regards,
                      Flo
                    • Hugo
                      Hi Flo, What about this? ^!Set %NR%=^$GetSelection$ ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ END ELSE ^!Prompt There is a fraction Hugo
                      Message 10 of 15 , Nov 22, 2009
                      • 0 Attachment
                        Hi Flo,

                        What about this?

                        ^!Set %NR%=^$GetSelection$
                        ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ END ELSE ^!Prompt There is a fraction

                        Hugo

                        --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                        >
                        >
                        > The question was how to find a *flexible* solution, that is: Calculate with three decimals but cut them off in case they are zeros only. For example, reduce a result that is 12.000 to 12 but don't change a result that is '12.345'.
                        >
                      • flo.gehrke
                        ... Hugo, Thanks! That s certainly a good solution for checking whether a number is a fraction or an integer. I adapted your INT construction to my clip (see
                        Message 11 of 15 , Nov 22, 2009
                        • 0 Attachment
                          --- In ntb-clips@yahoogroups.com, "Hugo" <hugopaulissen@...> wrote:
                          >
                          > Hi Flo,
                          >
                          > What about this?
                          >
                          > ^!Set %NR%=^$GetSelection$
                          > ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ END ELSE ^!Prompt There is
                          > a fraction

                          Hugo,

                          Thanks! That's certainly a good solution for checking whether a number is a fraction or an integer.

                          I adapted your INT construction to my clip (see #19979). It works fine but, in the end, it makes no difference...

                          ^!Set %Diff%=^?{Value to subtract: }
                          ^!Jump 1

                          :Loop
                          ^!Find "X\K[\d.]+" RS
                          ^!IfError End
                          ^!Set %NR%=^$GetSelection$
                          ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ Next Else Skip_2
                          ^!Set %Result%=^$Calc(^$GetSelection$-^%Diff%;0)$
                          ^!Goto Skip
                          ^!Set %Result%=^$Calc(^$GetSelection$-^%Diff%;3)$
                          ^!InsertText ^%Result%
                          ^!Goto Loop

                          Regards,
                          Flo
                        • Don - HtmlFixIt.com
                          again I don t understand the issue ... trailing zeros and period from a doc file: ^!Replace ^(.*?)0+$ $1 RAWS ^!Replace ^(.*?) .+$ $1 RAWS
                          Message 12 of 15 , Nov 22, 2009
                          • 0 Attachment
                            again I don't understand the issue ...
                            trailing zeros and period from a doc file:
                            ^!Replace "^(.*?)0+$" >> "$1" RAWS
                            ^!Replace "^(.*?)\.+$" >> "$1" RAWS

                            Before:
                            123.000
                            124.740
                            124.555

                            After:
                            123
                            124.74
                            124.555

                            Is that the desired goal?

                            Or this:
                            ;clip by don AT htmlfixit DOT com
                            ;removes trailing zeros and numbers from a variable
                            ;tested with a file of numbers
                            ^!Jump Doc_Start
                            :Loop
                            ^!Select Eol
                            ^!Set %data%="^$GetSelection$"
                            ^!Set %datalength%="^$GetSelSize$"
                            ^!Set %datalengthorg%="^$GetSelSize$"
                            :CheckZero
                            ^!If "^$StrPosRight("0";"^%data%";False)$" = "^%datalength%"
                            RemoveRightCharacter ELSE CheckPeriod


                            :CheckPeriod
                            ^!If "^$StrPosRight(".";"^%data%";False)$" = "^%datalength%"
                            RemoveRightCharacter ELSE NextNumber


                            :RemoveRightCharacter
                            ^!Set %data%="^$StrDeleteRight("^%data%";1)$"
                            ^!Dec %datalength%
                            ^!Goto CheckZero

                            :NextNumber
                            ^!If "^%datalength%" = "^%datalengthorg%" ContNextNumber
                            ^!InsertText ^%data%

                            :ContNextNumber
                            ^!ClearVariables
                            ^!If "^$GetRow$" = "^$GetTextLineCount$" Finish
                            ^!Jump +1
                            ^!Goto Loop

                            :Finish
                            ^!Jump Select_End
                            ^!Goto End


                            Before:
                            123.005
                            123.000
                            124.740
                            124.555

                            After:
                            123.005
                            123
                            124.74
                            124.555


                            flo.gehrke wrote:
                            > --- In ntb-clips@yahoogroups.com, "Hugo" <hugopaulissen@...> wrote:
                            >> Hi Flo,
                            >>
                            >> What about this?
                            >>
                            >> ^!Set %NR%=^$GetSelection$
                            >> ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ END ELSE ^!Prompt There is
                            >> a fraction
                            >
                            > Hugo,
                            >
                            > Thanks! That's certainly a good solution for checking whether a number is a fraction or an integer.
                            >
                            > I adapted your INT construction to my clip (see #19979). It works fine but, in the end, it makes no difference...
                            >
                            > ^!Set %Diff%=^?{Value to subtract: }
                            > ^!Jump 1
                            >
                            > :Loop
                            > ^!Find "X\K[\d.]+" RS
                            > ^!IfError End
                            > ^!Set %NR%=^$GetSelection$
                            > ^!IfFalse ^$Calc(INT(^%NR%)-^%NR%)$ Next Else Skip_2
                            > ^!Set %Result%=^$Calc(^$GetSelection$-^%Diff%;0)$
                            > ^!Goto Skip
                            > ^!Set %Result%=^$Calc(^$GetSelection$-^%Diff%;3)$
                            > ^!InsertText ^%Result%
                            > ^!Goto Loop
                            >
                            > Regards,
                            > Flo
                            >
                            >
                            >
                            >
                            > ------------------------------------
                            >
                            > Fookes Software: http://www.fookes.com/
                            > NoteTab website: http://www.notetab.com/
                            > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                            >
                            > ***
                            > Yahoo! Groups Links
                            >
                            >
                            >
                            >
                          • bruce.somers@web.de
                            ... I haven t grasped that either. If the data are accurate to 3 decimal digits, why would one want to truncate certain of them? If they were accurate to only
                            Message 13 of 15 , Nov 23, 2009
                            • 0 Attachment
                              don@...:

                              > again I don't understand the issue ...
                              > trailing zeros and period from a doc file:
                              > ^!Replace "^(.*?)0+$" >> "$1" RAWS
                              > ^!Replace "^(.*?)\.+$" >> "$1" RAWS
                              >
                              > Before:
                              > 123.000
                              > 124.740
                              > 124.555
                              >
                              > After:
                              > 123
                              > 124.74
                              > 124.555
                              >
                              I haven't grasped that either. If the data are accurate to 3 decimal digits, why would one want to truncate certain of them?
                              If they were accurate to only 1 decimal digit, wouldn't one truncate them all?

                              123.0
                              124.7
                              124.6

                              Bruce
                            • Art Kocsis
                              ... There s a big difference between truncation and rounding: 124.555 = 124.5 (truncated) 124.555 = 124.6 (rounded) or more dramatically: 5.4999999 =
                              Message 14 of 15 , Nov 23, 2009
                              • 0 Attachment
                                At 11-23-09 02:52, Bruce wrote:
                                > > Before:
                                > > 123.000
                                > > 124.740
                                > > 124.555
                                > >
                                > > After:
                                > > 123
                                > > 124.74
                                > > 124.555
                                > >
                                >I haven't grasped that either. If the data are accurate to 3 decimal
                                >digits, why would one want to truncate certain of them?
                                >If they were accurate to only 1 decimal digit, wouldn't one truncate them all?
                                >
                                >123.0
                                >124.7
                                >124.6

                                There's a big difference between truncation and rounding:

                                124.555 => 124.5 (truncated)
                                124.555 => 124.6 (rounded)

                                or more dramatically:

                                5.4999999 => 5.4 (truncated)
                                5.4999999 => 5.5 (rounded)

                                Namaste', Art


                                ----------


                                No virus found in this outgoing message.
                                Checked by AVG - www.avg.com
                                Version: 9.0.709 / Virus Database: 270.14.77/2520 - Release Date: 11/22/09 11:40:00


                                [Non-text portions of this message have been removed]
                              • flo.gehrke
                                ... Don, (also to Bruce), It would be an easy job, of course, to remove the period and three trailing zeros from numbers in a document. Since bozlawless is
                                Message 15 of 15 , Nov 23, 2009
                                • 0 Attachment
                                  --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                                  >
                                  > again I don't understand the issue ...
                                  > trailing zeros and period from a doc file:
                                  > ...
                                  > Is that the desired goal?

                                  Don, (also to Bruce),

                                  It would be an easy job, of course, to remove the period and three trailing zeros from numbers in a document. Since bozlawless is focussing on numbers beginning with an X we could do that job with just a single line...

                                  ^!Replace "\d+\K\.0{3}" >> "" AWRS

                                  What I was dealing with was another issue -- but maybe this was not the best example to illustrate what I had in mind. We were talking about capturing numbers, re-calculating them and replacing the original number with the result and in a format that depends on the format of the original number.

                                  My main interest in this context, however, was to identify integers and fractions and to separate decimal numbers from a fraction. That's why I came to the conclusion that a function like ^$Decimal(Fraction)$ is missing in NT (cf FRACC(fraction) in EVAL.EXE).

                                  Again, it was a clumsy attempt to explain this with bozlawless' job and I better had chosen another example to illustrate my point.

                                  So I think it isn't worth to keep going on about that issue. We have seen that there are no better tools in NT than calculating with the TRUNC and/or INT operator as long as we don't have something like that FRACC operator in EVAL.EXE.

                                  Thanks for the trouble you have been taking in that matter!

                                  Flo
                                Your message has been successfully submitted and would be delivered to recipients shortly.