Thanks Thanks:  34
Likes Likes:  15
Dislikes Dislikes:  0
Page 17 of 18 FirstFirst ... 715161718 LastLast
Results 161 to 170 of 172
  1. #161
    Regular 3D Printer
    Join Date
    May 2019
    Location
    Earth.
    Posts
    132
    Post Thanks / Like
    New version posted with extrusion pressure tab changes. You can check which pressures you want to modify, then enter a value in the number up/down at the bottom of the tab. Press calculate to calculate the values. Press update to update the BFB with the changes. Note, this pressure will affect all instances of that pressure. The value in the number up/down is a percentage of change. To increase values by 50%, enter 50. To decrease values by 50%, enter -50. Values range from -100 to 100. Give this a try and let me know. There is still a bug with updating the displayed values, so there could be duplicates. I am working on that change now.

    Link to file...

  2. Thanks TommyDee thanked for this post
  3. #162
    Super Moderator
    Join Date
    Nov 2016
    Posts
    2,220
    Post Thanks / Like
    You know I went looking for that 'select all' button LOVE IT!

    Yes, round or truncate the values in the 'calculated' slot. That might help the error too.

    - - - - - - - - - -

    Oh, yea... and I see some other strange stuff going on when you hit update. One of the Y values popped up in the 'updated' list.

  4. #163
    Regular 3D Printer
    Join Date
    May 2019
    Location
    Earth.
    Posts
    132
    Post Thanks / Like
    Quote Originally Posted by TommyDee View Post
    You know I went looking for that 'select all' button LOVE IT!

    Yes, round or truncate the values in the 'calculated' slot. That might help the error too.

    - - - - - - - - - -

    Oh, yea... and I see some other strange stuff going on when you hit update. One of the Y values popped up in the 'updated' list.
    I was thinking of some of the files that I have looked at with more than 20 pressure changes, so yeah, I also wanted a "select all" button. As well as a "Clear" button.

    I will do some rounding on the numbers to only go to 1 decimal place, that makes sense. Can you show me the error you're seeing with the "Y" values?

  5. #164
    Super Moderator
    Join Date
    Nov 2016
    Posts
    2,220
    Post Thanks / Like
    When you hit update, the first entry changes to some arbitrary value. It is not consistent.

  6. #165
    Regular 3D Printer
    Join Date
    May 2019
    Location
    Earth.
    Posts
    132
    Post Thanks / Like
    New version posted! I think I fixed the issues and rounded the calculated values to 2 digits.

  7. #166
    Super Moderator
    Join Date
    Nov 2016
    Posts
    2,220
    Post Thanks / Like
    That was one heck of a revision Buddy! Wonderfully done

    There seems to be a floating point thing getting loose somewhere...

    Attachment 3392

    I haven't confirmed values yet but I went to -20 and +25 and it seemed pretty close at first glance.

  8. #167
    Regular 3D Printer
    Join Date
    May 2019
    Location
    Earth.
    Posts
    132
    Post Thanks / Like
    Yeah,

    Last night I did some checking and did some math compares using Excel, and lo and behold, there was an interesting math error occurring. In my code, the math generated 12.55 and in Excel, it generated 12.6. When I checked on my calculator, it also generated 12.6.

    I am trying to determine how my code got 12.55. I used the same formula in Excel that I use in my code, but for some reason my code is doing something odd. The only thing I can think of is that it is due to the transfer from type to type. I will look at that tonight. My current code does this:

    Code:
    Double result = Math.Round(currentValue + (changeValue / 100.0 * currentValue), 1);
    Now currentValue, changeValue and result are all type Double. Math.Round returns a "Decimal". The only thing that I can think of is that somehow, the inherent casting from Double to Decimal back to Double is getting lost in translation.

    When I modified the code to just be:

    Code:
    Double result = currentValue + (changeValue / 100 * currentValue);
    result was 12.6.

    So it has to be something with Math.Round. I was late when I got that far, so I stopped.

    - - - - - - - - - -

    so maybe I will have to go with something like:

    Code:
    Double result = Convert.ToDouble(String.Format("{0:F2}", currentValue + (changeValue / 100 * currentValue));
    I will have to try this out tonight...

  9. #168
    Super Moderator
    Join Date
    Nov 2016
    Posts
    2,220
    Post Thanks / Like
    I wonder if something is breaking a rule... I always use extra parenthesis in math... ((new/100)*old).
    I know it doesn't matter but it ensures rules are followed.
    I've noticed a few interesting math interpretations when it come to Arduino coding.

  10. #169
    Regular 3D Printer
    Join Date
    May 2019
    Location
    Earth.
    Posts
    132
    Post Thanks / Like
    Well, it had to do with the conversion to Decimal, which is a type used for monetary values. Still, weird rounding issues.. New version posted.

    https://drive.google.com/open?id=1gd...mhQ_f28-DhOI6e

    I tested with -20 on all selected, then 25% on all selected and got the original values back.

  11. #170
    Super Moderator
    Join Date
    Nov 2016
    Posts
    2,220
    Post Thanks / Like
    EXCELLENT! You know... if you dig into that little 'bug' further, you might find out what has been happening with all those 1/2-pennies in banking transactions, and how the sum seems to always favor the bank. Unlike Monopoly of course

    That is beyond perfect buddy! That is an ideal way to deal with rounding. Did something weird for a CAD program once that had to do with proper rounding. Basically multiplied by 10 and evaluated the last integer number to test for rounding using the NASA plan of making decision on "nnnn5" where the final number would need to be even. So if 6-9, add 1, endif; if 0-4, truncate; endif; if 5 -and- n [in n5] is even (0, 2, 4, 6, 8) then add 0, else add 1, endif. Then divide by 10 and take the integer. Integers are easier to deal with even in CAD.
    Last edited by TommyDee; 08-28-2019 at 01:44 AM.

  12. Thanks buddybu thanked for this post
 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •