• Login
sketchucation logo sketchucation
  • Login
Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

Wrong menu text when it contains forward slashes

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 5 Posters 1.4k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    RunnerPack
    last edited by 17 May 2009, 04:53

    I wrote a Ruby script that adds a Context menu item called: "Draw Curve/ArcCurve/Circle Center-point". It appears correctly when the menu is shown by right-clicking or pressing the menu key (between Alt and Ctrl on the right side of a 104-key keyboard) but under "Edit|<Type-and/or-number-of-selected-item(s)> e.g. Edit|Arc" it only shows up as "Circle Center-point".

    I tried putting the string in single quotes and in double-quotes with the forward slashes escaped with back-slashes (restarting SU after each change). There was no change in either menu after either change.

    I'm running the latest free version of SU (7.0.10247) under 32-bit Win XP Pro SP3.

    You might have noticed... I'm a bit of a ferpectionist.

    1 Reply Last reply Reply Quote 0
    • R Offline
      remus
      last edited by 17 May 2009, 06:38

      try putting double slashes instead of singles. Ive got a feeling theyre needed as slashes are ruby operators (or something along those lines) so you need to distinguish them.

      http://remusrendering.wordpress.com/

      1 Reply Last reply Reply Quote 0
      • R Offline
        RunnerPack
        last edited by 10 Aug 2009, 06:07

        @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...

        You might have noticed... I'm a bit of a ferpectionist.

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 10 Aug 2009, 06:58

          You can't include '/' in menu titles... Try using a '|'. '...' or ':' instead.

          TIG

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by 10 Aug 2009, 17:59

            @tig said:

            You can't include '/' in menu titles ON WINDOWS... Try using a '|'. '...' or ':' instead.

            Todd

            1 Reply Last reply Reply Quote 0
            • R Offline
              RunnerPack
              last edited by 11 Aug 2009, 10:18

              With all due respect to those who have replied, I can and have used slashes in menu items - both in SU plugins and in general Windows development environments. You can check for yourself: open Notepad. At the very bottom of the Edit menu you'll find an item called "Time/Date". AFAIK, the only special character used by Windows menus is the ampersand (&) used to underline the accelerator letter.

              As I stated in my original post, slashes work fine in the Right-click context menu. The problem is the "mirror" context menu that appears as the last item in the Edit menu on the main menu bar.

              I'll concede that it could be something I'm doing wrong, but if so it's an undocumented rule I'm breaking. It seems more likely to simply be a bug in SketchUp (perhaps in the Windows version only; I can't test on a Mac). Either way, I'm not really complaining, I just wanted to point it out. It's an odd bug, but not a deal-breaker.

              BTW, TIG, thanks for the replacement suggestions. I think the "pipe" might work just as well as the commas I switched to.

              You might have noticed... I'm a bit of a ferpectionist.

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 11 Aug 2009, 11:55

                We stand corrected 😳 πŸ˜‰ - I have tested it on v7 and you are right '/' do [now] work in menu titles...

                However, up to v6 I found that using a '/' in a SUp Windows menu title caused the '/' and any following characters to disappear - that's why some of my tools' sub-menus have ':' or '|' - simply because the '/' was failing !

                Perhaps it was fixed quietly in a v7 update ?

                TIG

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by 11 Aug 2009, 12:41

                  hm... I'm nto sure. I remember having issued with the forward slash myself - I develop and test in SU7 mainly.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    todd burch
                    last edited by 11 Aug 2009, 22:07

                    I'm glad they fixed it. I remember reporting it as a bug some time ago.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement