cncjs / cncjs

A web-based interface for CNC milling controller running Grbl, Marlin, Smoothieware, or TinyG.
https://cnc.js.org
MIT License
2.28k stars 565 forks source link

Overlaying machine travel on to visualiser #325

Closed TobyGWilliams closed 5 years ago

TobyGWilliams commented 6 years ago

I'd like to have a way of overlaying the machine travel on to the visualizer to see if my gcode and work coordinates will cause the machine to run into it's limits.

And I'd like to have a go at building it myself despite having no experience of Three.js or React (I'm an angular and D3.js guy so far).

Maybe somebody will build it properly for me if I can cobble it together.

So far I've got:

image

So far I've:

Left to do:

FlightFixit commented 6 years ago

This would be amazing! I need this extremely badly! It would also be helpful if when the user zeros out the machine's work coordinates the rectangle wouldn't move (it would only work in machine coordinates).

nesquik011 commented 6 years ago

You mean for example you put limit for the bed or material coordination and if by mistake the machine went out it wont work and get back inside ?

Sent from my iPhone

On May 22, 2018, at 6:14 PM, Flight Fixit notifications@github.com<mailto:notifications@github.com> wrote:

This would be amazing! I need this extremely badly! It would also be helpful if when the user zeros out the machine's work coordinates the rectangle wouldn't move (it would only work in machine coordinates).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/cncjs/cncjs/issues/325#issuecomment-391050652, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ag_FBEsXqA-LCUZkL_yHRJkjQg82Dxllks5t1DlzgaJpZM4T7OkE.

TobyGWilliams commented 6 years ago

Thank you for the encouragement.

At the moment, I suspect there will be only one way of making it work logically (using the difference between the machine co-ordinates and the work co-ordinates). I'm open to suggestions.

It's taking me longer to learn react and how it's being used here than I thought.

TobyGWilliams commented 6 years ago

That took way longer than expected. I have a working prototype which I will attempt to turn into a pull request.

Toby

TobyGWilliams commented 6 years ago

I've created a branch with some limited preview here: https://github.com/tobygwilliams/cncjs

cheton commented 6 years ago

@TobyGWilliams

Just took a look at MachineTravel.js in your repo, I like your idea of visualizing machine's rectangle with axis limits, it will give you an overview of the machine coordinate, and help differentiate the relative position between MCO and WCO. I will try adding this part to CNCjs in the next release.

For configuring axis limits, I suggest adding a Machine Profile section under Settings rather than adding a new widget. This gives flexibility for adding and managing machine profiles.

Thank you for making a good start.

TobyGWilliams commented 6 years ago

Thanks, it would be useful to know if I am providing code in the right way to make life easy for you (Am I using git correctly?).

I agree with the settings instead of widget point, I just understand even less about how the settings section works than the widgets. I will look into the settings section.

I would also like to see if I can provide some nice code to the G-code widget to highlight where the limits of the gcode exceed the machine travel. Hence wanting to understand the widget system.

Did you see the allowance to the workspace json that I made to hold the machine configuration?

I guess there should be some allowance to turn on and off the limits rectangle here:

image

cheton commented 6 years ago

I would also like to see if I can provide some nice code to the G-code widget to highlight where the limits of the gcode exceed the machine travel. Hence wanting to understand the widget system.

I will deprecate the G-code widget since CNCjs v2.0 to leave more space for other widgets. The visualizer can be used to display axis limits, G-code program boundary, and running status.

Did you see the allowance to the workspace json that I made to hold the machine configuration?

Yes. I just have a question. What's the purpose of the spindle.maxSpeed settings?

machines: [
    {
        name: 'default machine',
        travel: {
            enabled: true,
            x: { enabled: true, min: 0, max: 260 },
            y: { enabled: true, min: 0, max: 130 },
            z: { enabled: false, min: 0, max: 100 }
        },
        spindle: {
            maxSpeed: 3000
        }
    }
]

I guess there should be some allowance to turn on and off the limits rectangle here:

Yes, it's doable. I will also add a dropdown for selecting a machine profile.

TobyGWilliams commented 6 years ago

Ok, understand about gcode widget. This is still a learning exercise so I don't mind the extra work.

The spindle thing is there to a) be an example of using the structure to store information about the machine. b) we have two machines, the gcode is compatible apart from the very different spindle speeds. Could be a useful check, see if you try 24,000 rpms on a 3,000 rpms machine.

I will put a table + modal thing into the settings to admin the machines.

TobyGWilliams commented 6 years ago

I have put some commits to add a machine section to the settings, I will figure out the modal things next.

Toby

TobyGWilliams commented 5 years ago

I have completed version 1. I have expanded the travels for limits in X, Y and Z. These are visualised as a cube, allowing for any angle or orthographic project to see where the machine and code is in the travel of the machine.

The settings area has been updated to control figuration of the machines and a UI element added to switch between the various machine configurations.

screenshot 2019-01-14 at 13 36 57

screenshot 2019-01-14 at 13 34 39

Things left to do:

The branch is here: https://github.com/TobyGWilliams/cncjs/tree/machine-travel

MitchBradley commented 5 years ago

Nice!

cheton commented 5 years ago

@TobyGWilliams

Thank you for initiating this. It's now available in 1.9.18.