Thursday, October 27, 2022

Acuitas Diary #54 (October 2022)

I wish I had more new features to write about this month, but I had to slow down a little bit. There was too much going on, and my brain started feeling like it was trying to brown out and stop working. So instead I'm going to talk about overhauling the Narrative module. I had gotten it pretty far, and I decided it was time to go back and address some pain points I kept running into over and over as I was adding new functions. This work is not exactly "easy" but it's much easier than adding new functionality.

A black-and-white sketch of a fountain pen lying on a collection of small notes.

A big thing I wanted to address was ease of negating or rescinding conditions in a story. Each time a new fact is introduced by a story sentence, it produces a spray of implications which are all collected by the Narrative Engine and used for future reasoning about the story. For example, the story sentence "Jack is cold" will produce the implication "Jack is uncomfortable" and will register "Jack is cold" as a problem state.

Now let's say that, at some later point in the story, we find the sentence "Jack is not cold anymore." This will replace "Jack is cold" in the current worldstate that the Narrative Engine is tracking, and will officially solve the "Jack is cold" problem. But what about "Jack is uncomfortable"? "Jack is not cold" does NOT automatically generate the implication "Jack is not uncomfortable," since a human can be uncomfortable for any number of other reasons. So there is nothing to negate "Jack is uncomfortable" and get it out of the worldstate.

Or suppose that Jack is cold, and he solves the problem by getting a jacket. "Jack wears jacket" implies "Jack is warm" implies "Jack is not cold," and this cancels "Jack is cold" out of the worldstate. But then he loses the jacket. The Narrative module ought to know that he returns to his default state of being cold ... but it doesn't.

These are just two examples of how reversing a condition can leave orphaned implied results scattered around the Narrative Engine's data structures. So as part of the overhaul, I'm working on ways to include pointers between facts registered in the Narrative's worldstate and *anything else* that was created, activated, or deactivated as a result of their presence. So when a fact gets rescinded, the Narrative Engine can easily walk through all the effects of its existence and rescind them too.

A fact can inherit its presence from multiple other facts. Let's say that Jack is uncomfortable because he's cold and hungry. If either "Jack is cold" or "Jack is hungry" is negated, "Jack is uncomfortable" will continue to be true, since *one* of the conditions that causes it is still in effect. But if "Jack is cold" and "Jack is hungry" are both negated, "Jack is uncomfortable" will be deactivated as well, since it has lost all its "supports."

A fact can also be suppressed by another fact (as in the example of the jacket canceling out the default state of cold). The solution in this case is not to remove "Jack is cold" from the worldstate, but to deactivate it and specify that "Jack wears jacket" is the source of the deactivation. If "Jack wears jacket" is deactivated, "Jack is cold" automatically becomes active again.

I had never planned a way to maintain this complex web of connections when I first wrote the module - it's one of the things I had to learn was necessary by doing the work - hence the major overhaul. And that's only one thing I'm changing; I'm also working on efficiency improvements, clarity, and general cleanup. I'm hoping to have a solid foundation from which to pursue my Goal Story next year.

Until the next cycle,
Jenny

Sunday, October 16, 2022

Design Spark Mechanical Hints and Pitfalls

I've been building my own 3D models for a couple of years now, and my favorite tool for this is still DesignSpark Mechanical. So I thought I would write up some tips and tricks I've learned as I've gained experience with it. This is not a general beginners' tutorial; I don't feel the need to create one of those, since they already exist (check YouTube). It's a list of all the weird little gotchas that weren't in the tutorials I watched and had to be learned painfully ... the things I wish somebody had told me before I started using the program.

A 3d model in DS Mechanical

DesignSpark is the free little brother of another CAD tool called Spaceclaim. They're basically the same program, so if you're searching for a way to do something in DS and striking out, try looking at Spaceclaim Q&A or tutorials. Spaceclaim has more features, naturally, so sometimes you may not be able to apply the results to DS, but other times you will.

How do I reflect or mirror an object about an axis?

DesignSpark does not have a mirroring function. You can rotate objects as much as you like, but you can't reflect them! What it does have is the option to set up a "mirror line" in the sketch plane, such that mirror images of Curves are created as you draw them. Many shapes begin in Sketch Mode, so if you are going to need a mirrored version of something make *sure* to plan ahead. Don't wait until you've created a complex object to realize that you now have no way to mirror it.

Setting a mirror line on the Sketch Plane
Now any lines or shapes drawn on one side of the line with be reflected on the other.
    
How do I turn a Surface into a Solid (or a Solid into a Surface)? Why won't my Surface become a Solid?

Sometimes you will want your models to be Surfaces, and sometimes you will want them to be Solids. There are operations that become easier in one mode or the other. The commands for converting between these modes are Combine and Detach, but confusingly, they both have multiple functions. Combine can be used to join individual surfaces (faces) to each other, but also if you use it on a closed Surface, that Surface will become a Solid. Combining a group of faces to make a closed Surface also automatically turns that Surface into a Solid. Detach turns a Solid into a Surface if used on any face of the Solid, but is also useful for separating individual faces from an existing Surface.

Meshmixer detecting an insidious issue around the base of the right-hand peg.

If you try to use Combine to turn a Surface into a Solid and *nothing happens,* that means your Surface has something wrong with it. Maybe it's not completely closed; there could be an almost-invisible crack between two of the faces, for instance. Or maybe it doesn't close around fully empty space -- if any of the faces are doubled, or if the surface has "interior walls," it can't become a solid. DesignSpark will not tell you what the problem is. Fortunately, other tools like MeshMixer *will* tell you ... so as a last resort, if you can't figure out what's wrong with your model, you can export it as an STL and have MeshMixer's inspector point out the flaws. You *do* want to fix them. Anything which prevents your model from becoming a solid may also qualify as something that makes it unprintable.

Why do I get an error when trying to Move my Solid/Surface?

If you select an object and try to move it, and it WON'T MOVE ... you've probably only selected one face, instead of the whole object. You can avoid this by clicking on the object's name in the Structure window to select it, instead of clicking on the object itself in the viewing window.

How do I draw in 3D Mode?

Selecting any of the tools for drawing Points or Curves will automatically activate Sketch Mode on whichever plane the tool guesses is best. But sometimes you don't want that -- there are times when you need to draw in 3D Mode. To get back there, just hit the 3D Mode button *after* selecting your drawing tool. You will go back into 3D Mode with the right drawing tool still active. Points and lines can't be placed arbitrarily in 3D Mode; you have to attach them to something (existing Solids, Surfaces, or Curves).

Why can't I separate two Curves that are on top of each other? How do I move one Curve at a time?

In Sketch view, if you duplicate a line or other Curve using copy-and-paste, the new Curve will by default be pasted right on top of the original. Then when you try to move the copy ... you may find that you end up moving both objects. You won't be able to separate them! To fix this, look to the "Options - Selection" box on the lower left, and untick the "Maintain sketch connectivity" checkbox. Now you will be allowed to select and move only one of the Curves at a time.

Location of the "Maintain Sketch Connectivity" checkbox

I turned off Snap to Grid/Angle, but my cursor is still snapping to things while I draw, why?

Snapping is great when you want it, and very annoying when you don't. The obvious ways to turn it off are in the "Options - Selection" box: "Snap to grid" and "Snap to angle." But after you untick these, you will find that there is still some snapping going on. Turns out there are additional, hidden snap options under File->DesignSpark Options->Snap.

The advanced snap options

Solids keep joining when I Pull parts of their geometry

"Pulling" a surface on a Solid while it is in contact with any other Solid will automatically merge those Solids into a single blob, potentially annihilating some hard-won geometry. An Undo fixes this ... unless you don't notice until you've gone many steps further in your work. To make sure this doesn't happen, always right-click and select the barred circle ("No Merge") from the popup menu before you Pull. A Solid that is being pulled also will not merge with any hidden objects, so hiding all Solids but the one you're working with reduces the chance of mistakes.

How can I split faces on a Surface?

If you need to split an existing face or cut a hole in it, you can use any of "Split Body," "Split," "Project," or "Pull," depending on the situation. If one method doesn't work, try another. The "Project" tool is powerful but very messy if not handled carefully. Make certain to use the face selection and direction options to confine the projections to your desired area, or you might find random cuts all over your models later. And if you want to cancel, hit the Escape key before you select a different tool, or the current projection will be automatically applied!

Why can't I Blend across this gap?

Blend is your friend, especially if you're trying to build curvy organic shapes ... but sometimes it can't compute a nice joining and needs guidance. The order in which you select lines or faces to be blended matters. Splitting curves/faces in order to blend across smaller regions may also help. Once you get the hang of it, you can construct whole models with little more than the Blend tool -- just draw wireframes using Splines, then Blend adjacent curves together.

A weird blend created by selecting the bounding segments in the wrong order

A good blend created by selecting the bounding segments sequentially

How do I Pull the edge of a surface out to make a plane?

"Pulling" an edge that is attached to a Solid will round or chamfer it. If you want to pull the edge out to make a plane or cylinder instead, copy-and-paste it to create a free-floating duplicate.

How do I keep curves drawn on a surface from becoming part of the surface?

Curves sketched on a Surface will become part of that Surface as soon as you leave Sketch Mode. Free-floating Curves will turn into the boundaries of new Surfaces. If you don't want this, Cut them before leaving Sketch Mode and then Paste once you are back in 3D Mode.

A curve that cuts the surface it was drawn on (left) vs. a free-floating curve (right)

Until the next cycle,
Jenny