nophead / NopSCADlib

Library of parts modelled in OpenSCAD and a framework for making projects
GNU General Public License v3.0
1.2k stars 156 forks source link

Removed hotend global enums. #201

Closed martinbudden closed 2 years ago

martinbudden commented 2 years ago

Got rid of the global enums jhead and e3d. A global hotend enum is not very desirable.

nophead commented 2 years ago

You seem to have got rid of the pseudo polymorphism. That would break my current 3D printer which has multiple extruders that vary by hotend type and I will also add two more types soon.

flexstruder_E3Dv6_175_assembled_tn

flexstruder_JHeadMk5_175_assembled_tn

martinbudden commented 2 years ago

You seem to have got rid of the pseudo polymorphism.

Yes, that was deliberate, since I don't really think hotends form a polymorphic class. I've also been doing work on using multiple hotends with my printers and I find there is little in common between hotends. If I want to support e3d, micro swiss, mosquito etc I basically have to deal with each on a case by case basis

nophead commented 2 years ago

It really needs module literals, like function literals, and then we could get rid of the type enum. But while there isn't I use it to do the case by case switching.

martinbudden commented 2 years ago

But while there isn't I use it to do the case by case switching.

When I need to do this sort of thing I just a string literal rather than an enum. So "e3d" and "jhead" rather than e3d and jhead.

if (hot_end_style(type) == "jhead") is just as readable as if (hot_end_style(type) == jhead)

nophead commented 2 years ago

Yes it is just as readable but you don't get an error if it you spell it wrong.

martinbudden commented 2 years ago

Yes it is just as readable but you don't get an error if it you spell it wrong.

You do if you spell check your code.

nophead commented 2 years ago

True, but I don't.

I have no objection to making them strings though. Although it is breaking I doubt anybody else is using it.

martinbudden commented 2 years ago

Now updated as per discussion.