sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] TIG-Smart_offset

    Scheduled Pinned Locked Moved Plugins
    143 Posts 55 Posters 164.8k Views 54 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      @jim said:

      in cmd.set_validation_proc (and other places) you want to give the full scope of the suitable? method since it is being called from SketchUp outside the scope of your module.

      Also, combine the MF_ bits.

      
      > cmd=UI;;Command.new('TIG.Smart_offset'){self.dialog()}
      > if TIG;;Smart_offsetter.suitable?()
      > MF_ENABLED
      > else
      > MF_DISABLED | MF_GRAYED
      > end
      > 
      

      Thanks, knew it was obvious... This only affected MACs though ???
      This was collecting dust on a virtual dust, until Pilou reminded me that I'd written it, so sometimes things get 'forgotten'... ๐Ÿ˜’

      TIG

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

        Here's v1.2 http://sketchucation.com/forums/viewtopic.php?p=446462#p446462
        Further robustness in enabling/disabling/graying and suitable? tests [thanks to Jim!].
        Seems to be especially for MACs ๐Ÿ˜„

        TIG

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          @tig said:

          This only affected MACs though ???

          I am not sure - it was just a guess and I don't have a Mac. Did you try it? ๐Ÿ˜†

          Hi

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

            I don't have a MAC either. ๐Ÿ˜•
            Driven's reported issue was on a MAC and Jeff had other issues on a MAC too...
            Hopefully this recent v1.2 [...20121221b.rbz !] will address the suitable? check and MF_ issues with the menus/toolbar...
            It still works fine on a PC, but then v1.1 did too ๐Ÿ˜• ๐Ÿ˜„

            TIG

            1 Reply Last reply Reply Quote 0
            • elmerE Offline
              elmer
              last edited by

              Nice Christmas gift Tig, thanks a lot, it works perfectly on my Mac.

              1 Reply Last reply Reply Quote 0
              • alvisA Offline
                alvis
                last edited by

                Thanx TIG

                1 Reply Last reply Reply Quote 0
                • guanjinG Offline
                  guanjin
                  last edited by

                  @tig said:

                  Here's v1.2 http://sketchucation.com/forums/viewtopic.php?p=446462#p446462
                  Further robustness in enabling/disabling/graying and suitable? tests [thanks to Jim!].
                  Seems to be especially for MACs ๐Ÿ˜„

                  TIG: Merry Christmas

                  TIG.gif

                  I come from China, is to learn

                  1 Reply Last reply Reply Quote 0
                  • jeff hammondJ Offline
                    jeff hammond
                    last edited by

                    @tig said:

                    Here's v1.2 http://sketchucation.com/forums/viewtopic.php?p=446462#p446462
                    Further robustness in enabling/disabling/graying and suitable? tests [thanks to Jim!].
                    Seems to be especially for MACs ๐Ÿ˜„

                    Hi Tig
                    i'm still getting the same greyed out problem.
                    is there anything i can type in the console or ?? to help figure out what the problem is?
                    thanks

                    dotdotdot

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

                      Is there no difference at all - if you have nothing preselected, or one edge preselected, or one face preselected, or lots of things [including some edges] preselected ?
                      The menu/toolbar are only enabled if there's at least one face in the current selection.
                      The context-menu only appears if there's at least one face in the current selection.

                      Copy/paste+<enter> these into the Ruby Console and report the results:

                      with nothing preselected TIG::Smart_offsetter.suitable?()
                      with one edge preselected TIG::Smart_offsetter.suitable?()
                      with one face preselected TIG::Smart_offsetter.suitable?()
                      with lots of things [including some edges] preselected TIG::Smart_offsetter.suitable?()

                      with one edge preselected TIG::Smart_offsetter.dialog()
                      with one face preselected TIG::Smart_offsetter.dialog()

                      ๐Ÿ˜•

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • jeff hammondJ Offline
                        jeff hammond
                        last edited by

                        oops ๐Ÿ˜ณ
                        it actually is working now..
                        it's just the toolbar that remains greyed out at all times but the menu item becomes available once an appropriate selection has been made..

                        (which, for me personally, is fine.. i more likely than not wont want the toolbar anyway.. i think id use it with a modifier key added to my offset shortcut)

                        dotdotdot

                        1 Reply Last reply Reply Quote 0
                        • jeff hammondJ Offline
                          jeff hammond
                          last edited by

                          here are these results.. (since you took the time to write them.. i better take the time to report ๐Ÿ˜‰ )

                          @tig said:

                          Copy/paste+<enter> these into the Ruby Console and report the results:

                          with nothing preselected TIG::Smart_offsetter.suitable?()
                          false

                          with one edge preselected TIG::Smart_offsetter.suitable?()
                          false

                          with one face preselected TIG::Smart_offsetter.suitable?()
                          true

                          with lots of things [including some edges] preselected TIG::Smart_offsetter.suitable?()
                          true (drew two squares and selected all)

                          with one edge preselected TIG::Smart_offsetter.dialog()
                          warning- PreSelect Face[s !]
                          ruby - nil

                          with one face preselected TIG::Smart_offsetter.dialog()
                          (works as expected)

                          dotdotdot

                          1 Reply Last reply Reply Quote 0
                          • jeff hammondJ Offline
                            jeff hammond
                            last edited by

                            uh.. not sure what the deal is but..

                            upon entering all of that stuff in the console, the toolbar is now working
                            ๐Ÿ˜•

                            [edit] but then.. i quit sketchup then relaunched and the toolbar is greyed out again regardless of selection.. the menu item is working though

                            dotdotdot

                            1 Reply Last reply Reply Quote 0
                            • Chris FullmerC Offline
                              Chris Fullmer
                              last edited by

                              voodoo. definitely voodoo at work here.

                              Lately you've been tan, suspicious for the winter.
                              All my Plugins I've written

                              1 Reply Last reply Reply Quote 0
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by

                                @chris fullmer said:

                                voodoo. definitely voodoo at work here.

                                ha.. that darn voodoo! ๐Ÿ˜„

                                some more info:

                                so here's what the deal with the toolbar is.. (in this example, i have 3 squares with faces drawn)

                                โ€ขcmmdA (select all)
                                โ€ขtoolbar remains greyed out (menu item is live)
                                โ€ขdo something else (rotate, pan, etc)
                                โ€ขtoolbar becomes active
                                โ€ขdeselect all
                                โ€ขtoolbar remains active (menu item greys out)
                                โ€ขdo something else (switch tool, orbit, etc)
                                โ€ขtoolbar greys out

                                so it appears, on mac, that something has to happen other than simply selecting in order to jump start the toolbar into updating it's state

                                dotdotdot

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  ccbiggs
                                  last edited by

                                  Hey Tig,
                                  I am getting the same thing Jeff has. But since Jeff actually knows what he is doing, he can do the ruby troubleshooting. Will stay tuned to see what you fellas figure out.
                                  It works great on my windows machine at home.
                                  Thanks Tig

                                  Update
                                  Jeff says his works. It does not work on my mac.
                                  with nothing preselected TIG::Smart_offsetter.suitable?()

                                  TIG::Smart_offsetter.suitable?()
                                  false

                                  with one edge preselected TIG::Smart_offsetter.suitable?()

                                  TIG::Smart_offsetter.suitable?()
                                  false

                                  with one face preselected TIG::Smart_offsetter.suitable?()

                                  TIG::Smart_offsetter.suitable?()
                                  true

                                  with lots of things [including some edges] preselected TIG::Smart_offsetter.suitable?()

                                  TIG::Smart_offsetter.suitable?()
                                  true

                                  with one edge preselected TIG::Smart_offsetter.dialog()
                                  TIG.Smart_offset:

                                  PreSelect Face[s] !

                                  with one face preselected TIG::Smart_offsetter.dialog()
                                  Offset [+/-ve=out/

                                  My drop down "Tools" Menu works with a face preselected. The toolbar does not.
                                  Nothing works with just edges selected.
                                  If you need me to check anything else, and I do not get right back to ya, I am not ignoring you I am just here there and everywhere today.

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

                                    Here's v1.3 http://sketchucation.com/forums/viewtopic.php?p=446462#p446462
                                    Removed 'suitable?' method, to suit MACs, more error traps etc.
                                    Try this and report back... ๐Ÿ˜’

                                    TIG

                                    1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      ccbiggs
                                      last edited by

                                      It works the same for me. With a face selected the drop down tools menu item will work but the single icon toolbar will not.

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

                                        @ccbiggs said:

                                        It works the same for me. With a face selected the drop down tools menu item will work but the single icon toolbar will not.
                                        Which is weird... because they BOTH use 'cmd' and share the same enabled/grayed code...
                                        To check that the toolbar WILL work somehow... can you please edit the file 'TIG-Smart_offset.rb' on your MAC with a plain text editor [BBedit???] and find the three lines starting at #117 reading:

                                        		cmd.set_validation_proc{
                                        			Sketchup.active_model.selection.grep(Sketchup;;Face)[0] ? MF_ENABLED ; MF_GRAYED
                                        		}
                                        

                                        and change them to read

                                        		#cmd.set_validation_proc{
                                        			#Sketchup.active_model.selection.grep(Sketchup;;Face)[0] ? MF_ENABLED ; MF_GRAYED
                                        		#}
                                        

                                        i.e. add a # in front of each of the three lines to disable them.
                                        Now the tool's command should always be 'enabled' in the menu & the toolbar button, if you try to use it without a Face in the Selection you'll get an error messagebox...
                                        Let me know how this goes...

                                        Incidentally, BEFORE [& after] you make the changes... do you get the tool's context-menu item IF there's a Face in the Selection ?

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • jeff hammondJ Offline
                                          jeff hammond
                                          last edited by

                                          @tig said:

                                          To check that the toolbar WILL work somehow... can you please edit the file 'TIG-Smart_offset.rb' on your MAC with a plain text editor [BBedit???] and find the three lines starting at #117 reading:

                                          		cmd.set_validation_proc{
                                          > 			Sketchup.active_model.selection.grep(Sketchup;;Face)[0] ? MF_ENABLED ; MF_GRAYED
                                          > 		}
                                          

                                          and change them to read

                                          		#cmd.set_validation_proc{
                                          > 			#Sketchup.active_model.selection.grep(Sketchup;;Face)[0] ? MF_ENABLED ; MF_GRAYED
                                          > 		#}
                                          

                                          i.e. add a # in front of each of the three lines to disable them.

                                          that does the trick.. the toolbar is always active now and i'll just receive an error if i try to run the tool without an appropriate selection..

                                          [context menu works also.. but it worked prior to disabling the above lines]

                                          dotdotdot

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

                                            OK !
                                            The current tool [v1.3] works just fine for PCs... but it baulks on a MAC with some of the enable/grayed code for the toolbar button - which is weird... ๐Ÿ˜•

                                            The editing of the three lines of code in the script to disable them with a leading #... as indicated in the preceding posts... will fix it for MAC users...

                                            I'll see if I can get a version working properly for PC and MAC without this cludge ! ๐Ÿ˜ž

                                            In the meantime, please report any issues...

                                            Merry Xmas ๐Ÿ˜„
                                            Apocalypse averted! ๐Ÿ˜›
                                            Phew! ๐Ÿ˜‰

                                            TIG

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 8
                                            • 2 / 8
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement