@remus said:
try putting double slashes instead of singles.
Didn't help... Here's some other things I've tried:
# menu.add_item("Draw Curve\/ArcCurve\/Circle Center-point") {
# slash_workaround = '/'
# menu.add_item("Draw Curve#{slash_workaround}ArcCurve#{slash_workaround}Circle Center-point") {
@remus said:
Ive got a feeling theyre needed as slashes are ruby operators (or something along those lines) so you need to distinguish them.
I thought so too at first, but I checked all the Ruby docs I could find and they only mention strings delineated by slashes (regular expressions) but nothing about slashes inside a string. Then I realized that it has to be a bug in SU because it shows up fine in the popup context menu. Plus, I got this from the SU console:
puts 'Draw Curve/ArcCurve/Circle Center-point'
Draw Curve/ArcCurve/Circle Center-point
nil
I've settled on 'Draw Center-point of Curve, ArcCurve, or Circle' until the problem is sorted out. I suppose I should try harder to figure out which of those things is actually selected, but I'm too lazy
BTW, I've attached the plugin. It still might have bugs/quirks... The internal "ReadMe" stuff:
curve_tools.rb; (C) 2009 Amos Bieler
("find_center" method based on code by Chris Fullmer,
because my version was ugly ;)
-=_+ Description;
This Ruby code can be useful to both modelers and plugin writers.
-=_+ Modelers;
As a tool for modelers, it is used to draw a construction
point at either the center point of a Curve, ArcCurve or
Circle entity, or at the point where the perpendiculars of
two Edges intersect. The latter effect is handy when an
ArcCurve or Circle has been exploded for any reason, such as
being Push/Pull'ed.
Usage; Select and context-click on a curve or at least two
Edges and select The option ending in the phrase
"Center-point" (it changes depending on what is selected).
-=_+ Authors;
As a tool for plugin authors, it adds the "center" and
"radius" methods to Curve objects. In SketchUp's standard
API, these methods are only available to the ArcCurve class
and its derivatives. It also adds a "find_center" method to
the Edge class to facilitate the above-mentioned effects.
Usage;
require 'curve_tools'
puts curve_object.center.to_s
(0.0", 0.0", 0.0")
nil
-or-
puts edge_object.find_center(other_edge).to_s
(0.0", 0.0", 0.0")
nil
-=_+ History
2009-08-10 - Initial release
Simple, but quite handy...