Open DanRathbun opened 6 years ago
Logged as SU-40179
I was about to add this request again before finding it here. However, I think the method name shouldn't refer to the tooltip but something more general like inference_type
. The tooltip text just happened to be the current hack to get this information. In a parallel universe SketchUp Ruby developers could just as well be writing ip.drawing_style == "Circle"
as we are writing ip.toolltip.start_with?("On Face")
.
I think the method name shouldn't refer to the tooltip but something more general ...
I'll go along with this. In fact I just realized that there are several unique "properties" to an inference.
Looking again at the list(s) in the first post, the first list is the basic inference "name" or "type".
Then each has a "location" modifier (implied local, "In Group", "In Component", "Outside Active", etc.)
And the last list is the "constraint".
I've updated the first post to label these 3 lists.
So the Sketchup::InputPoint
class could also get some nifty fast Boolean methods as well.
These most likely would be used for fast conditional branching:
constrained?
& unconstrained?
constrained_on_line?
constrained_on_plane?
constrained_to_point?
constrained_to_axis?
constrained_perpendicular?
inference_local?
inference_in_group?
inference_in_component?
inference_outside_active?
@thomthom Please update SU-40179 to reflect Julia's better method name suggestion, as well as the list of boolean constraint query methods above (and anything else up can think of.)
SketchUp Ruby API Feature Request
Sketchup::InputPoint#inference_type()
method that would return an integer for faster comparison than strings returned by theSketchup::InputPoint#tooltip()
method.In addition using integers would not suffer from the need to localize a bunch of String constants in each language, if it is the case that the API returns tooltip text in the user's localized language build. (The API docs do not say whther it is always English or the
Sketchup::os_language
.)Along with this would be inference constants defined within a
Sketchup::InputPoint::Inferences
mixin module within theSketchup::InputPoint
class, such as:INFERENCE TYPES
ORIGIN
ENDPOINT
MIDPOINT
CENTER
FROM_POINT
FROM_ENDPOINT
FROM_MIDPOINT
FROM_CENTER
ON_FACE
ON_EDGE
LOCATIONS
LOCAL
OUTSIDE_ACTIVE
IN_GROUP
IN_COMPONENT
CONSTRAINTS
UNCONSTRAINED
CONSTRAINED_ON_LINE
CONSTRAINED_ON_PLANE
CONSTRAINED_TO_POINT
ON_BLUE_AXIS
ON_GREEN_AXIS
ON_RED_AXIS
PERPENDICULAR
_...etc., etc.
Coders would use them by inclusion into their custom Ruby Tool classes thus:
REF FORUM TOPIC:
https://forums.sketchup.com/t/how-to-determine-from-point-and-constrained-on-line-in-ruby/73773/