Jump to content
Ultimaker Community of 3D Printing Experts

Kin

Member
  • Posts

    36
  • Joined

  • Last visited

Everything posted by Kin

  1. Any update on this? Hope it's acceptable to be bumping the thread. I just was thinking the same thought, and was doing some searching to see if it has already been done. (Hello to dahai8 who got me to the point of having a working script!)
  2. Thanks again for finding the issue I had! I imagine the criteria in .search are more familiar for traditional programmers. It sounds like regular expressions section of the python documentation I need to get more background on. I had quite a hard time understanding how to parse the difference between your search criteria and the default criteria. That is, between re.search('^[0-9]+\.?[0-9]*', sub_part) and re.search('^[-+]?[0-9]*\.?[0-9]*', sub_part) In fact, at first I was sure you had a typo with * vs +, but I understand a bit better that the characters are shorthand for a number of categories and parameters. I wish I had an easier time parsing what is being said, so I'll make sure to checkup again the documentation until I do get it. For sure, yours did work, and I was also able to cut the extraneous couple checks I implemented while chasing the incorrectly perceived cause of my script bug.
  3. Seriously, you're amazing. I am grinning, as this has been a lonnnggg struggle for some simple functionality, but totally worth it (selective memory?) I admit I looked into getValue to even confirm how it was working, but balked at trying to understand the .search functionality (embarrassed to say.) I will now make sure I fully understand that code and your version.
  4. So I think I finally have a reasonable proto that works-almost. It seems reliably to add the gcode and resume the z height, for every layer except layers 0 and 1. In those two layers the gcode first line is not "G1" or "G0" but rather M106 or M106 and M107. I can't confirm that is the problem but it's the only thing I can notice different about those layers (and that my code doesn't start in earnest until after it passes "layer:0".) In my code I believe I should be resolving those cases of M106 and M107 by iterating linewise until I find a G1 or G0 command, but the behavior doesn't seem to follow that. Don't know if you have interest or time to take a look at what I've written, but I've been pouring up and down it for ages trying to execute the code as I think it should be executing, but it doesn't. https://dl.dropboxusercontent.com/u/3619097/Wipe_ScriptZZZ.py
  5. Heh, I am still chugging away at this. In the past I would have used raw file manipulation, but here I'm trying to build this properly as a cura gcode script. That said, I am thinking I basically don't know where the functionality is even coming from. Like, I am not clear on how cura expects the data input to be formatted (I can mimic the basic integer and yes/no inputs from example scripts) and even am not 100% certain how functionality like "for layer in data" work. I mean, I get that I am cutting the dataset apart(by layers? using the "LAYER:" key I assume?), but I don't even know what structure the gcode data is coming in as, or where I would find that out. Then something like "lines =layer.split("\n") cuts presumably the layer into strings by line. But I am guessing that from structure and it's taken ages to piece it together. I finally think I understand why the basic structure of my previous code didn't work -namely that it acted to look for a "LAYER:" key, but was utilizing the "layer in data" structure that seems to abstracted away the need to look for where the layers start and end. Is that remotely correct that it does that? My impression is that in "for layer in data" I am cutting my data of a set of large text into sets of largish texts of the lines exluding the "LAYER:#" line. Then "line = layer.split(\n") further cuts it into an array of strings that are each carriage return line of the set of layer gcode. So to take a step back - I am a mech-E with decent C++ microcontroller experience and random small python scripting stuff (pandas manipulation, CVS generation, array manipulation & image types). I don't have a lot of experience but I am used to normally scouring documentation to figure out how structures and things work. Here, it seems I'm grasping at straws while slowly testing small changes to my script by loading them into cura and slicing code, but finding that my script doesn't cause the effects I want. In any case, surely, there must be a better way to develop my script and see what is going on in the script. Unless, this kind of scripting is meant for more familiar programmers who might not make errors in the drafting of such a script, and are used to the basic conventions without need for commenting explaining how the code works. very very grateful! Thanks again for all the insight so far. And I promise I'm trying to use four spaces not tabs now.
  6. So Dahai, thanks again for all this help. I definitively have been struggling with this more than most simple projects, probably because I can't see my errors well. I think in your last post, you made me realize python is supposed to use four spaces over the tab notation, per some convention. I used the "untabify" type function of notepad++ to do that, and ran through everything. "return data" is supposed to be four spaces indented of "def execute" I think... Am I missing something there? When I do that, I still can't get cura 2.3 to load the script. UPDATE: Just kidding! Untabify, looking more closely, made me realize all my interior statements were totally off on their tabbing. Not sure how I messed that up so bad. Now off to actually implement my script. By the way, I actually did install Komodo edit, but I can't seem to troubleshoot why it won't work on my windows 10 PC. It seems to simply not load! Kind of unusual, so I uninstalled and will try to install again.
  7. You are a wonderful saint. Can't tell you how frustrated I was getting and confused! It's just that I feel I couldn't understand where I was going wrong, since this was such a simple protoscript. Now I look forward to really fleshing this out into a useful script. Thank you!
  8. Heyo, six hours in, kind of certain my error is basic in nature. Not really sure what it is though. I can't get the script to show up, so I think I'm doing something wrong. Been trying to do things like "work from base case up" in terms of modifying the existing scripts into doing what I want them to. But besides the fact cura takes 20ish seconds to startup on my computer, it's been slow and not very effective to understand what kind of issue I am seeing. I'm hoping it won't take too long for someone to be able to redirect me where I'm probably doing something obviously wrong. Sidenote: I noticed when I edit in notepad++ the formatting isn't clean if I open in IDLE. So I go back to IDLE to format indents nicely, but I presumably notepad++ should handle things correctly when in the python setting. I made a copy of my code here: https://dl.dropboxusercontent.com/u/3619097/Wipe_ScriptZZZ.py
  9. So I started working on this again this weekend, and I do find the basics to be approachable. I am a little confused about how to "load" the plugin. I thought if the .py was saved in the plugins folder, it would be automatically loaded. But I don't see my script when I open cura. I assume this means I have an error in my script format, but it seems at first few glances correct, although I am an amateur. Is there a better way to understand how to load a custom plugin, or where I might find an error log of that process? Thanks! Updates: So far I have found I can tweak an existing working script to change names and become a "new" script. This autoloads at start of cura. I can break the script with a while(1) loop, which then means the script will fail to load next time I open cura (i think.) So I am guessing this means I need to scour my code and see what I did wrong, assuming that it is not autoloading because of a functional error in the script. I'm not really a programmer so I find myself uncertain if I don't know the basics of how to do this right because I simply lack knowledge of convention, or if I am missing out the ways/location that these basics would be detailed (or if they are simply not yet clear for this plugin.)
  10. Thanks DaHai8! So it sounds like there isn't any particular functionality built into cura for the plugins, and I'll just be parsing the gcode with standard python string parsing tools? I think I will take a closer look at the example scripts, thank you. This should be doable I suppose, even if my solution isn't very robust. Thanks!
  11. Hi! I have the code I would like to introduce between every layer change on my gcode. It's a nozzle wipe, ideally I'd have a way to do every "X" layers, or something like that, but every layer is great start. My understanding is that Cura doesn't have this functionality built in to the user-side (Simplify3D does, and Slic3r does), but I would suspect it's a semi-common need. Would anyone have such a plugin already, or something they'd recommend I try repurposing? I can write some python, though not an expert, but I don't really have any idea of the format for Cura plugins (especially as I think it is slightly different than 15.X plugins.) Thanks for any help or pointers!
×
×
  • Create New...