sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Talk] Edit Mode Warning Flag (Beta)

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 6 Posters 1.1k Views 6 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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by Dan Rathbun


      Obsolete duiscussion.
      **Get released version here: Edit Mode Warning Flag


      ` %(#008000)[# An example that displays an edit warning flag when

      in edit mode of a component instance or group.

      A SketchUp Ruby Example by Dan Rathbun, 23 FEB 2013.]`**

      %(#BF4000)[Please consider this a test of concept, that was abandoned due to the "con" below.
      The plugin was rewritten and released as CoastalConcepts::EditFlag]

      CONS:

      1. Modifies every model opened (if it does not yet have a Warning Flag Text object tagged with the plugin's attribute dictionary.

      The toggle and options link are at the bottom of the View menu.
      The options are saved between sessions.

      v1.1.0 :

      • You can now see the position changes for the warning flags, without exiting SketchUp.

      (But you must cycle through model editing context to see the position change take effect.)

      • Changed the timer block per Fredo's suggestion
      • Flag text is now a replacable template in the @@say hash
      • Flag also appears in the statusbar, until the mouse moves

      editflag.rb

      code sample removed, released version here: Edit Mode Warning Flag

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        Dan,

        Just curious. Is there a reason why you don't create a local variable, say model, to hold the value of Sketchup.active_model, as you use it several times. Is it for performance reasons?

        
            tid = UI.start_timer(1.0,true) {
                if Sketchup.active_model.valid? &&
                Sketchup.active_model.tools.active_tool_id != 0
                  UI.stop_timer(tid)
                  Sketchup.active_model.add_observer(ModSpy.new(Sketchup.active_model))
                end
            }
        
        

        Fred

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by

          Hi dan,

          basically work on mac, but it generate a 'Save Changes' dialog on empty models, which is very annoying.

          I'm not likely to use this myself but just pointing out this behaviour, and curious as to why it does this...

          john

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @unknownuser said:

            Sketchup.active_model, as you use it several times. Is it for performance reasons?

            Normally it would be faster to make one reference and reuse that - as you get an overhead of Ruby looking up the method calls every time.

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

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              @thomthom said:

              @unknownuser said:

              Sketchup.active_model, as you use it several times. Is it for performance reasons?

              Normally it would be faster to make one reference and reuse that - as you get an overhead of Ruby looking up the method calls every time.

              The key word is normally ...

              ... but the above is not a normal situation. This block executes only during startup, which differs between the PC and Mac, .. as to when the object returned by Sketchup.active_model is a valid Sketchup::Model object. (On the PC, the template model gets loaded before the UI is initialized, ... on the Mac I think it happens after the menus and toolbars are built.)

              I was being extra cautious.

              But Ruby has a trick that allows assignment within one of the conditional expressions (although it is considered very bad form,) ... so we possibly could do the following, because the conditionals will short circuit if any of them evaluate as false:

                  tid = UI.start_timer(1.0,true) {
                      if (model = Sketchup.active_model).is_a?(Sketchup;;Model) &&
                      model.valid? &&
                      model.tools.active_tool_id != 0
                        UI.stop_timer(tid)
                        model.add_observer(ModSpy.new(model))
                      end
                  }
              

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @driven said:

                basically work on mac, but it generate a 'Save Changes' dialog on empty models, which is very annoying.
                I'm not likely to use this myself but just pointing out this behaviour, and curious as to why it does this...
                This is the number 1 con for using a model note ( Sketchup::Text object,)... It modifies every model opened (if it does not yet have a Warning Flag Text object tagged with the plugin's attribute dictionary.)

                What we really need in the UI module is a "marquee" feature for displaying info, that does NOT modify the model.

                On PC we can do this using Win32API calls. (A window with a text label in it, optionally no border and no background. Or a WebDialog, which the caption bar is off. Jim played around with this in the past.)

                I thot you had been working on this kind of feature for the Mac ?

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  Updated a bit. see notes in 1st post.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    Should the menu item that toggles the flag warning OFF/ON be under menu:

                    1. Edit1. Plugins

                    ❓ ... feedback please !

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • TIGT Online
                      TIG Moderator
                      last edited by

                      I vote for 'Edit'...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • Rich O BrienR Online
                        Rich O Brien Moderator
                        last edited by

                        Edit

                        Download the free D'oh Book for SketchUp πŸ“–

                        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