Monday, January 31, 2022

Acuitas Diary #45 (January 2022)

I mentioned last October that I had started reworking the Text Parser to add support for branching and coordinating conjunctions. My objective for this month was to finish that. It proved to be a little too ambitious, but I did get the output format altered to be branch-friendly, and the parser now supports two-part branches in a number of key places. Compound subjects, verbs, direct objects, adjectives, and adverbs, branching before or after the verb, and compound sentences with two fully separate independent clauses can all be processed now. What's missing? Compound prepositions, objects of prepositions, nouns of direct address, dependent clauses, and things inside clauses ... as well as comma-separated lists, larger compounds than two, nested compounds, and probably some other stuff I haven't even thought of yet.

Even though I pared down what I wanted to accomplish, it was still a rush to get that much done, make sure all the old parser functionality was compatible with the new features, and update the visualizer to work with the new output format. That's why this blog is going up on the final day of the month ... I literally just finished about an hour ago. Included in this was an update of the Out of the Dark benchmark data, and now I can correctly diagram a sentence that was previously in the "unparseable" category:

Sentence diagrams: "Kevin was a busy man, but he always made time for his son."
Just the one example doesn't give a good sense of what the Parser can do now, but maybe I can give some more expansive results next month, when I'm not as pressed for time.

Why is all this so hard? Partly because nothing in my Parser was originally designed to support compounds, so there are many different pieces that have to be reworked. More importantly, because it is not a simple matter to decide what a conjunction is actually joining. Consider these two example sentences:

The people of the city and the country are different.
The residents of the city and the folk of the country are different.

Same basic meaning, different structure. In the first sentence, the conjunction "and" joins "city" and "country" to form a compound object of the preposition "of," whose phrase modifies the single subject. In the second sentence, the conjunction joins "residents" and "folk" into a compound subject. A naïve parser would try to link "city" and "folk" instead, to generate the comically wrong reading "residents of the folk of the country." To know this is wrong, you have to access not just the sentence structure, but also the meanings of the words. Then you can spot some parallelism: residents and folk are both collective nouns for persons, while city and country are both locations. And it is not possible to be a resident of the folk (unless you are a tapeworm, I suppose). With access to the semantic database, the Parser could eventually make judgments like this, but that's for later because it's complicated, argh. For now, I've just got some of the basic structural support in place.

Now I need to get the other parts of the text processing chain (Interpreter, Conversation Engine, and Narrative Engine) ready to accept the new output. I think that will end up occupying much of next month.

Until the next cycle,
Jenny

Tuesday, January 11, 2022

New Frontiers in 3D Printing

I had the 3D printer busy last November, but a lot of the results were embargoed on account of being Christmas gifts. Now the embargo is no more and I can be a showoff! In case you've just arrived, my printer is a Qidi Tech X-one2. You can read my review of it if you're interested. Over the summer I added a small modification to solve the problems with the filament feed tube, and I'm happy to report that this worked very well -- I never had to wait around at the beginning of a print to properly settle the tube, and never had any trouble with the filament kinking.

 

My giftee happened to like Star Wars and I settled on a couple of things in that vein. The first was this clever little Death Star box by Thingiverse user C47_3D, with added stand from an alternate model by monkey_g. This was a PLA print and was fairly straightforward. I decided to be daring and print the two half-spheres without any supports, and to my surprise the printer handled the bridging beautifully. Perhaps it helped that the upper interior surfaces were flat. Microcenter was out of gray PLA, so in desperation I bought marble instead ... and I'm actually glad, because I think it fits and even ended up adding some textural interest. The other great thing about this model is that the threaded ring prints separately and, if you're careful and patient, you can friction-fit it into one of the two domes without any glue.


The other thing I wanted to print were these coasters by QuantumZ. Since coasters are for drinks, these needed to be printed in water-resistant PETG. (PLA is a bioplastic and eventually breaks down if exposed to too much water.) And while I *could* have printed them in just one color, I saw that they seemed ideal for printing two-tone, and somebody had already done it, and it looked too good to pass up. So because I'm crazy, I decided to do two new things I'd never done with the printer before, with a deadline of shipping in time for Christmas.


My printer only has one extruder, so to print the coasters in two colors I had to get it to pause at the right time so I could change the filament. Adding the pause after a particular layer proved surprisingly straightforward in Cura, which is the slicing software I use. And after printing so many coasters, I even got kind of good at swapping the filament (which continues to be the most frustrating thing to do with my printer).

Getting the PETG to behave was quite a bit harder. It has a higher melt temperature than PLA and tends to ooze out of the nozzle, leaving annoying strings on your prints. I made some cookie cutters as test prints before I started on the coasters, and experimented with different temperatures and retraction settings. In the process I got my bed height and leveling dialed in so I could get a really nice first layer -- but I never really solved the stringing, no matter what settings I tried. Fortunately, once I started on the coasters, their particular shape didn't seem to lend itself to quite such bad stringing, and what did happen was easy enough to clean up.

A closeup of that pretty bottom-side finish. I still print on tape, and you can see the faint lines ... but otherwise, this is smooooth.

I did observe that it became more important to clean the nozzle often. Some of the PETG would migrate or splatter up onto the brass, where it would turn into burnt gunk that eventually wanted to fall off onto the print, producing ugly discolored areas. I am sorry to say that babysitting the prints was also necessary for the best possible results. It helped if I went to check them every now and then, and snatched or scraped or cut off any large strings or globs that had developed, before they could mess up subsequent layers.

Bed adhesion was also trouble. To get that smooth, professional-looking bottom layer without any weird wrinkles in it, I had to make the distance between the print bed and the nozzle larger than I normally would. And as soon as I did that, the PETG started having trouble sticking, because I wasn't smashing it hard against the bed surface anymore. The only solution was to print the first layer verrrry slowly. I mean very ... I think I went down to 10 mm/s.

Early attempt with bad top surface (left) and final product (right)

In the end, the most difficult thing was getting a nice top finish. The final layers of the print would always turn out really rough; either there would be "whiskers" of broken filament left sticking out all over them, or they would just be very rumpled, as if too much filament had been extruded and the nozzle had dragged through it. It took me forever to figure out what was causing this. One important clue was that the extruder would start making a loud, intermittent "tunk! tunk!" sound as the printer was working on the final layers. This means it's having trouble pushing the filament out; in the past, I've heard it when the nozzle was partially clogged, but that wasn't the problem here.

I kept thinking it was a problem with the way the filament was melting or flowing, and messing with the nozzle temperature and retraction settings. I also tried "ironing," and that was its own little disaster. If you turn on ironing, the nozzle makes an extra pass over the final layer, re-heating it while only extruding a tiny amount of additional filament. This is supposed to get you a really smooth top surface. In this case, what it did was melt the excess lumpy filament and push it around ... so I just got really smooth lumps. It also re-melted some of the base color filament at the margins and smeared the two colors together. Ew.

Trying to wish away the problem with bad ironing (left) and final product after the problem was actually fixed (right).

I finally realized that the print was warping. It was subtle enough that I didn't notice it until I looked for it; the fact that the top surface was always worse toward the edges finally got me to check. And sure enough, the bottoms of the coasters weren't flat. The center was staying in place while the outer rim curled away from the print bed. This explained both the nasty upper surface and the thunking extruder. The warping was raising the already-printed layers closer to the nozzle, forcing it to drag across them as it printed the last layer and effectively jamming it.

Warping can be caused by uneven cooling of the lower layers, and one of the standard solutions is to raise the print bed temperature (assuming you have a heated bed). The articles I've seen about printing with PETG seem to vary widely on what they think a good bed temperature is. Some give 70 C as the high end of the ideal range; others give it as the low end! The articles that counseled a fairly low bed temp steered me wrong at first, but once I identified the warping I started raising it, and ended up settling on 80 C (which still might not have been high enough, but I was running out of time for experiments). I also added a pretty big brim to the print ... and for good measure, once the brim was done printing, I strapped it to the bed with extra blue tape so it couldn't curl up.

Last before (left) and after (right) photo.

The other thing that helped was turning off the layer cooling fan. Not turning the speed down, no, I turned it completely off. I did this before I figured out the warping was happening, so it didn't solve that, but it did seem to stop the weird "whiskers" from forming on the top layer. And it didn't seem to have any disadvantages. Supposedly layer cooling is not as important for PETG as it is for some of the other materials.

I finally manufactured a set of coasters that I was happy to give as a gift -- after making so many bad ones that I have a complete set of "mistakes" to keep for myself. I think they were worth the effort, because the final results look amazing. The only thing I might change for the future is to try turning on z-hop to get rid of the "construction lines" on the final layer, but I don't find these obnoxious. (Z-hop can cause its own problems with stringing, and by the time I solved the warping I was ready to stop messing with settings and finish the project.)

Translucent PETG shines.

In summary, if you want to print in PETG and are interested in learning from my mistakes:

*For perfect bed leveling, you may just have to do a bunch of test prints. Getting it right by using a piece of paper/cardstock to check the distance between nozzle and bed is pretty hard.
*For a good first layer, PETG likes a greater nozzle height. If that means you can't get it to stick, try just doing the first layer very slowly.
*Clean your nozzle often.
*Try turning off the layer cooling fan.
*Check for warping, especially if you are doing a wide, flat print. Make sure your printer is enclosed, and raise your bed temperature if you have trouble.
*Don't be afraid to try very high (up to 100 C) bed temperatures.
*If your extruder is jamming, and you know you have the nozzle temperature high enough, and the nozzle is not clogged, CHECK FOR WARPING.
*If you have a garbage top layer because something is wrong with your print, ironing will not fix it!

The printer adding the first white layers to a red/white coaster.

Until the next cycle,

Jenny