Lock inference
-
I'm trying to figure out how locking inference works with creating a tool. But I'm a little lost.
As best as I can tell, lock_inference will fail if the point you pass ("view.lock_inference pt") is just a point, but it will succeed if you pass a point that is on an edge or face. Passing in two points, however, doesn't seem to do a single thing different than passing one point. It just uses the first. So is anyone able to explain what passing two points should do?The next question is that the line tool allows you to hit an arrow key and lock inferencing to an axis. Is this something that should be repeatable in a user-defined tool? Any help, especially with the axis issue, would be great! Thanks.
-
Hi avariant,
I sort of grasp what you are saying but not fully. Could you demonstrate with a screen video grab what your problem is. I am sure that you will get a response even if I can't supply an answer.
Mike
-
Sure.
From the line tool, if you hit the up arrow, you get a constraint along the vertical axis, running through whatever point you were on at the time you hit the up arrow.But this doesn't appear to be a standard behavior for the lock_inference command. The best I can do is lock to an edge, if I happen to pass it a point on an edge, or in the plane of a face, if the point I pass is on a face. I'd like to imitate the behavior of the line tool, where I constrain along an axis no matter what point I have.
-
Avariant,
Can you have a look at LineOnSurface and tell if this is the functionality you need. Note that you don't need a real surface to work with the tool.
Fredo
-
The behavior seen from the "Line on Surface" tool, when you hit an arrow key, is exactly what I'm looking for. I'm not trying to draw lines, it's actually a "positioning" tool of sorts, but that behavior is very much what I'm looking for. Can you make suggestions on how to do it?
[EDIT] glancing through the Surface Tools code, I can see that there is some very significant trigonometry / vector math going on to implement that axis constraint. I had high hopes that this was something built into SU's inference, but apparently not.
-
@avariant said:
[EDIT] glancing through the Surface Tools code, I can see that there is some very significant trigonometry / vector math going on to implement that axis constraint. I had high hopes that this was something built into SU's inference, but apparently not.
Yes there is!! But LineOnSurface is particularly convoluted because it also supports drawing on surface with constraints on the initial and target faces.
In the simple case of 2 points, you have mainly to take care of 2 situations:- The input point is located on an existing geometry (vertex, line, surface). It means that it is well located in 3D space. You can then use 3D calculations to manage inferences (essentially projections)
- the input point is in the 'empty' space. Then, you'd better try to bring back everything in the 2D viewport, compute the right projections, and swith back to 3D to see if the line matches a particular direction like axes.
In addition, you have to trap the SHIFT key, manage the arrows, etc... and also recreate some stickiness.
At the end it is not so simple, and I agree that we would expect this to be available in some form in the Ruby API.
Fredo
PS: I have coded it once for all as a class, which I put in LibFredo6 (this is why I have this shared library by the way)
-
Thanks very much for your replies. I think, knowing that SU doesn't provide any inherent method for this kind of inference, that I can see how it might be done. I'll tinker around a bit; even if I never use it, it will be good to familiarize myself with this area of the Ruby API. Thanks again.
BTW, I mentioned earlier that passing two points to lock_inference does nothing different for me than one point. Any thoughts on that, as to what two points should do?
Advertisement