Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reported Sizes #11

Closed
thothloki opened this issue Oct 6, 2019 · 12 comments · Fixed by #13
Closed

Reported Sizes #11

thothloki opened this issue Oct 6, 2019 · 12 comments · Fixed by #13
Assignees
Labels
bug Something isn't working
Milestone

Comments

@thothloki
Copy link

How is the sizing calculated when you load a file?
When i load a file that is 83x50mm, it shows up as over 100k mm

@barnold96
Copy link

I always use the center of a project as my origin. I had a similar issue to your description when I forgot to set Lightburn to use the center as origin. It was set for left front origin, so the size was reported as many times the actual size of my project. I changed Lb, re-saved the gcode and all was well.

@thothloki
Copy link
Author

I always use the center of a project as my origin. I had a similar issue to your description when I forgot to set Lightburn to use the center as origin. It was set for left front origin, so the size was reported as many times the actual size of my project. I changed Lb, re-saved the gcode and all was well.

so all I have to do is use center start and i am good?. Dang. I am going to try that tomorrow

@AlligatorFate
Copy link

I changed the init.py script for Bettergrblsupport that I run in on_event so that I initialize minX and minY to 100000 and maxX and maxY to -100000. Then I calculate x from float(match.groups(1) [0]) rather than x+float(match.groups(1) [0]). (And similar for y.)

After doing this, the size calculations are correct, even with the origin is not the center. In my case, because of the way my machine is set up, it's more convenient for the origin to be the bottom left. So this change causes the size to be correct.

I could make a change and check it in somwhere here, if that's helpful to synman.

@synman
Copy link
Owner

synman commented Nov 1, 2019

sorry for the delay guys... life has gotten in the way of my hobbies lately. attach your change here, submit a pull request ... however you want to get it to me and I'll make sure it gets integrated back into master.

@AlligatorFate
Copy link

I checked changes in here:
https://github.com/AlligatorFate/Octoprint-Bettergrblsupport
Please let me know if there's a better way. Only 1 file changed.

@synman
Copy link
Owner

synman commented Nov 5, 2019

This is going to require some testing as I suspect what you've effectively done is change the calculation to respond to absolute positioning rather than relative positioning.

We may need to keep track of the Grbl Positioning mode for this cover all use cases. While this may work for your machine, I doubt it will work with mine.

Some additional thoughts. I never thought to test Lightburn positioning other than center. I'll have to play with that.

@AlligatorFate what "slicer" are you using? Am also curious why you needed to cast the regex extraction to float before the final cast to int.

@synman synman added the bug Something isn't working label Nov 5, 2019
@synman
Copy link
Owner

synman commented Nov 5, 2019

G90 vs G91 -- should be a good place to start for further testing

https://gcodetutor.com/gcode-tutorial/g90-g91-gcode.html

@synman
Copy link
Owner

synman commented Nov 5, 2019

ok, you guys have me going today.... Check out some of things I always do as part of "my workflow".

I think this is a big part of the problem.... this is my workflow.... not necessarily yours :)

First notice where I always place images Lightburn:

Screen Shot 2019-11-05 at 6 27 47 PM

Second, notice how I configure my start position:

Screen Shot 2019-11-05 at 6 28 18 PM

I'm thinking the Start From is more at play here than Job Origin. I could swear I tested various job origins... What I have not deviated from is I always use "Current Position" as my Start From.

I believe we can probably fix this by keeping track of the positioning mode. G90 will require absolutes (always taking the last value entered --- hence not accumulating the value). G91 will require accumulation as was originally developed.

@synman
Copy link
Owner

synman commented Nov 5, 2019

It is GCODE like this that is throwing off the calculation:

Screen Shot 2019-11-05 at 6 44 50 PM

@AlligatorFate
Copy link

@synman: Yes, I'm using absolute positioning, G90 with a local coordinate system. I'm using FreeCAD Path workbench to generate the gcode. I'm using CNC, not laser. Yeah, I see where you're going with keeping the positioning mode. Might be just a switch between methods based on the state.

I understand the risk that an arc could go outside the box since the code only considers G1 or G0. In practice (so far) that hasn't been much of a problem. But yeah. The G3 gives the endpoint as X, Y, Z. So a slight improvement would be to just consider G3 along with G0 and G1. But still a chance the arc curves out of the box. I'd still rather have an "approximate" bounding box rather than none. (Of course I may change my mind on that with experience....) I'd rather have the arcs than the box.

@synman
Copy link
Owner

synman commented Nov 6, 2019

I'm working on a fix at this moment.

First up is tracking positioning mode ... simple enough to do so by keeping track of the last G90 / G91.

G3/G4 support was inadvertently already in place with the existing regex. I've always assumed it's okay to ignore IJR / etc because all we really care about are the min and max stops of X and Y.

It's rather silly fix truth be told.... basically:

                        if relative positioning:
                            x = x + float(match.groups(1)[0])
                        else
                            x = float(match.groups(1)[0])

@synman
Copy link
Owner

synman commented Nov 6, 2019

this fix is working well with neje example provided

Screen Shot 2019-11-05 at 11 09 06 PM

@lathemaster I'm assuming I've at least got your dimensions in the ball park now.

@synman synman self-assigned this Nov 6, 2019
@synman synman added this to the v1.7.0 milestone Nov 6, 2019
@synman synman closed this as completed in #13 Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants