So on my mental roadmap in the not-so-distant future is the idea of implementing 'point controls' for models. The idea is a bit hard to describe, but I'll try to lay it out here as clearly as I can.
3D modeling in transportation engineering consists almost entirely of sweeping templates along alignments. In FreeCAD parlance, that's sweeping (or lofting) sketches along wires or splines. There's really little more to it than that.
However, in real life, road widths can vary for a number of reasons - going into a narrow area with steep cliffs, or widening out from a two-lane to a three or four-lane roadway. That means that the template / sketch needs to be able to handle transitions like those, moving from the default width to a target width.
This is where "point controls" come in handy. Basically, I specify a point in a template / sketch and tell FC that, as the sweep progresses, the point shifts position a few feet / meters one way or the other. Maybe it's a linear transition, maybe it's curvilinear. The control determines how the point moves as the template is swept.
An example can be seen in the following image:
- point_control.png (35.33 KiB) Viewed 2181 times
The purple represents edges of the roadway, and the yellow represents edges of the shoulders. Note the solid lines might indicate the original limits of the sweep / loft that the sketch template created. The dashed lines represent the transition and desired limits that the point control could provide.
I can figure all of that out. It's not hard.
What I need to sort out though, is how to create a reference system for points that
never changes. That is, if I have a template of a pavement cross-section that looks like this:
- template_snip.jpg (26.66 KiB) Viewed 2181 times
The upper-right point would be the outer edge of the pavement. I want to name it "Right Edge Of Pavement" or something like that. Then, after the user goes in and modifies the template (maybe even adds points), I want to ensure that it retains that name.
I know that the coin geometry has no way to uniquely identify a point like that - the vertices get re-indexed at will and that's necessary. I think it could be done easily enough using a list property in a SketchObjectPython instance, but that means using the point location as a way to correlate the point name with the point itself, assuming no two points ever occupy the same space (there's no reason they ever should). If the point changes it's location, then that, obviously needs to get updated in the list of names.
So... I
think I know how to manage that. The SketchObjectPython class can trap those changes and make that a feasible solution. But, that leaves a few issues. First, I'm forced to test for changes in the points and update the list every time a change occurs, which may impact performance significantly when the user edits the sketch template. Second, I don't know if it's possible for more than one change to occur before the SketchObjectPython gets notified - which could possibly break things. For example, suppose a new point gets added an existing point gets moved. I could potentially have a case where I now have two points which are not found in the list (one because it's never been added and the other because it has moved), with no way to reconcile that.
So to be clear, what I'm trying to determine is the following:
1. Is there any other feasible way to create permanent references (by a unique ID or otherwise) to a point in a sketch that will always remain, even if the sketch gains / loses points or that point moves?
2. Can I be sure that when the SketchObjectPython sees a change, that change will be atomic? That is, it won't possibly include multiple changes at once (e.g., a new point, plus an existing point moving).
3. Would it be possible to create an "empty" constraint that applies to a specific point? It's a constraint that does nothing but exist on a point (or edge).That would provide an excellent way to reference sketcher geometry externally by a unique, unchanging reference and save a lot of the hassle I've described above.
Pinging the two guys who I know will have an opinion.