Bed Leveller (3D Printer Assistant)

So you have written that new, must have program. Let us see it here.
PartierSP
Posts: 57
Joined: Tuesday 30th November 2021 12:14am
Location: Canada
Contact:

Bed Leveller (3D Printer Assistant)

Post by PartierSP »

This project is designed assist the user with manually tramming (levelling) their 3D printer's bed with it's print head.

In order to achieve proper adhesion and quality prints, it is of upmost importance that a 3D printer's bed is actually trammed to it's print head. When this is done properly, the printer will know how high the print head is above the print bed no matter where over the bed the head is told to go. This distance can vary depending on Z-stop location, bed temperature, bed warping, Z backlash, crashes, and changing build surfaces to name a few. Thus its required to check the machine's tram fairly often. When ever I start to get adhesion issues, this is the first thing I check.

To properly check the tram, it is required to simulate printing environment as much as possible. This means we need the bed to be heated to proper print temperature, and to have the machine move the head itself. Depending on the MDI/Jog controls on the printer, this may be difficult to do. This is where Bed Leveller comes in. It is designed to control the printer and move to pre defined locations in order to assist in the tramming process.

Bed Leveller v 1.0.0

/edit: Updated attachment to v2.0.4
Attachments
Bed-Leveller-2.0.4.zip
(24.09 KiB) Downloaded 265 times
Last edited by PartierSP on Tuesday 28th December 2021 7:19am, edited 2 times in total.
PartierSP
Posts: 57
Joined: Tuesday 30th November 2021 12:14am
Location: Canada
Contact:

Re: Bed Leveller (3D Printer Assistant)

Post by PartierSP »

This was my first project I attempted to use containers to make a form resizeable. I got the setting form to automatically resize horizontally but I didn't get the vertical direction to resize as I'd like. I am also thinking of redoing the setting form so each section is on a different tab. This would be nice for anyone who is using a low resolution monitor to control their printer (think Raspberry Pi).

You will also notice I used Sqlite to store and recall settings. I first started using it as I didn't want to manually write to and from text files. But after reading through our 'Did You Know' thread, I've since learned of the Settings function. I'm debating on rewriting all of my setting storage/retrieval functions to utilize it. I'm sure it would cut the code down significantly.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

PartierSP wrote: Monday 6th December 2021 5:45am This project is designed assist the user with manually tramming (levelling) their 3D printer's bed with it's print head...
That's good for starters Mike!

After scanning the code over breakfast this morning, then checking that it looked 'safe', I hooked up my printer and stepped through the code.

As you have already noted in another thread, you are using "==" where you only need "=". You have also used:-
  If tgbBed.Value == True Then
...in places, and simply:-
  If blnLF Then
...in other places.

If you wanted to be consistent (but its really not important) you could stick to the second format, and then stuff like this:-
If Exist(User.Home & "/.config/leveller") == False Then
...could be replaced with:-
If Not Exist(User.Home & "/.config/leveller") Then

I need to take a second look, but the main form seems to be a fixed size, so on my system looks like this:-
BedLevel.png
BedLevel.png (239.1 KiB) Viewed 8363 times
As you are displaying the data returned by the printer, I need to be able to see all of it, either directly or by scanning through it.

I'd also recommend you use the ToolTip property where necessary. For example, for the "Rapid Plain" label:-
  Label11.Tooltip = "What the hell is this?"

You have written:-
   db1.Host = User.Home & "/.config/leveller"
...several times in your code, and on one occasion:-
    db1.Host = User.Home & "/.config/leveler"
...which just shows how important it is to only write the file path once...in a Constant declaration.

You don't have a hot-end on/off at the moment, but I assume you are going to add this.

Thanks for this code, I love it.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

To implement the required Constants, I first created a string variable in the Fsettings form:-
Public strPath As String
...and replaced the string with the strPath variable:-
    db1.Host = User.Home &/ strPath
Then declared the Constants in the main form:-
Const DB_NAME As String = "config.sqlite"
Const SETTINGS_PATH As String = ".config/leveller"
Then replaced all instances of the strings like this:-
  If Not Exist(User.Home &/ SETTINGS_PATH &/ DB_NAME) Then
Then called the FSetting form like this:-
Public Sub btnSetting_Click()

  'Open Settings form
  FSettings.strPath = SETTINGS_PATH
  FSettings.ShowModal()

End
I hope this helps.

.
p.s. I don't know why the underscores are missing in two instances of SETTINGS_PATH and one of DB_NAME

Is this a gb button bug Charlie?
Last edited by stevedee on Wednesday 15th December 2021 12:22pm, edited 2 times in total.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

Sorry, just couldn't resist tweaking it!
BedLevel2.png
BedLevel2.png (66.66 KiB) Viewed 8350 times
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Bed Leveller (3D Printer Assistant)

Post by cogier »

PartierSP

I had to tinker as well. All I have done is make the Form resizeable.
Bed_Leveler-1.1.tar.gz
(18.68 KiB) Downloaded 288 times
stevedee

I don't see what's wrong?

Image
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

cogier wrote: Monday 6th December 2021 6:13pm ...I don't see what's wrong?
OK Charlie, its just me then;
MissingUnderscores.png
MissingUnderscores.png (86.21 KiB) Viewed 8342 times
PartierSP
Posts: 57
Joined: Tuesday 30th November 2021 12:14am
Location: Canada
Contact:

Re: Bed Leveller (3D Printer Assistant)

Post by PartierSP »

Great! Tweaks/suggestions/comments are all welcomed! :D

I'll have to look at them when I get home.

Yes the main form was not resizable. I didn't want the window to be made too small where the buttons didn't have ample space between them. But if I was to force minimum width/height then this shouldn't be a problem.

I initially didn't want the hot end to heat up as 200C is a tad more painful to touch then say 70C. But if we look at turning this into more of a general purpose jog mode system/macro mode application, then yes hot end and even extruder control would be very useful.

I'm going to think on the 'danger' side of tramming with the hot end on today. It may not be that bad. As this would improve Z height accuracy some but shouldn't affect the actual tram (the hot end would have expanded the same amount no matter where it is above the bed, unlike the bed which may warp in unexpected ways).
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

PartierSP wrote: Monday 6th December 2021 7:46pm ...I'm going to think on the 'danger' side of tramming with the hot end on today. It may not be that bad. As this would improve Z height accuracy some but shouldn't affect the actual tram (the hot end would have expanded the same amount no matter where it is above the bed, unlike the bed which may warp in unexpected ways).
I'm not sure what concerns you about leveling the bed with the hot-end/nozzle at its working temperature. On my CR10V3, its impossible to touch the nozzle during leveling because there is just a tiny gap between the extruder body and the bed (maybe this is not the case for all extruders).

It took me a while to realise that there was often a tiny bead of plastic on the tip of the nozzle (barely visible) which can throw out your leveling if the nozzle is cold. See my post for a better explanation: http://captainbodgit.blogspot.com/2021/ ... r-bed.html

Re: bed warping; if the bed is not substantially flat, the only option is to 'map' the surface and to correct the g-code Z values to compensate. I guess this could be done manually, but the best approach is with something like a BLTouch sensor mounted on the extruder. (I've got one, still in its box, but never had the courage to update the printer software and install it...too many horror stories on the forum!).
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Bed Leveller (3D Printer Assistant)

Post by stevedee »

cogier wrote: Monday 6th December 2021 6:13pm ...I had to tinker as well. All I have done is make the Form resizeable...
Charlie, you are the king of resizable layouts!

As Mike said, what we now need are end-stops for minimum width and minimum height.
Min width looks easy; just make sure the form cannot be made smaller than the width of 3 buttons + x%.
For min height, maybe just use a simple measure like (say) the height of 6 buttons.
Post Reply