sketchucation logo sketchucation
    • Login
    1. Home
    2. RickW
    3. Posts
    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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 36
    • Posts 779
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [Request] Addition to Flightpath script

      Meanwhile, can't you just create a couple of scenes along with CameraControls? Set the first scene, then use the Pan tool in CameraControls to get the next view set up, then add the second scene. If needed, you can also use the Transition Time editor in PageUtilities to set the transition time between scenes.

      posted in Plugins
      R
      RickW
    • RE: [Request] Addition to Flightpath script

      I think that can be done. Thanks for the suggestion

      posted in Plugins
      R
      RickW
    • RE: Dialog with Webdialog

      @martinrinehart said:

      On topic, is it your contention that the existing JS/Ruby communication is as simple as possible? Lots of software is produced with the management directive "We've got to ship something, even if it's ugly." Engineer says (to self) "This is crap but it'll work." and (to boss) "OK, I'll go with what we got."

      It's really not too bad. If you give all your form fields an ID, you can reference them in ruby without relying on the info passed in the callback. In fact, there are times I don't pass any data in the callback itself, instead using

      dialog.get_element_value("myfield")
      

      to access the information I need. I only pass the info through the callback if the info is limited to one data set, and then only occasionally.

      posted in Developers' Forum
      R
      RickW
    • RE: [How to?] Observer to web dialog A,A&I

      @chrisglasier said:

      I thought I had it all figured out, but obviously I have done something to scupper it.

      Here is the top part with my comments marked #CG#:

      require 'sketchup.rb'
      > 
      > class MySelectionObserver < Sketchup;;SelectionObserver
      >  def onSelectionBulkChange(selection)
      >   model = Sketchup.active_model
      >   selection = model.selection
      >   $chrisglasierScenes.selected = selection[0].name  #CG# does this need to be global - only used here #RW# Yes, it references $chrisglasierScenes, which is set in your next code block - it is used to create a single instance of your class.
      >   puts $chrisglasierScenes.selected
      >   cmd = "sceneTest('#{selected}');"
      >   $chrisglasierScenes.dlg.execute_script(cmd)	#CG#don't really understand why this can be attached to a global! #RW# the global references an instance of your class.  Conceptually, it's really no different than "model = Sketchup.active_model".  Perhaps the confusing part is that the global is defined near the end of the code, but referenced earlier in code blocks.  It has to be set at the end; otherwise, it will return an error because the class it wants to be an instance of is not yet undefined.
      >  end  # def
      > end  # class
      > 
      > 
      > class ChrisGlasierScenes # CREATE A NEW CLASS
      > 
      >  attr_accessor ;dialog, ;selection # PROVIDES ACCESS TO THESE VARIABLES FROM OUTSIDE THE INSTANCE
      >  @@observer_added = false # A CLASS VARIABLE
      > 
      >  def initialize # THE AUTOMATIC METHOD CALLED WHEN A NEW INSTANCE OF THE CLASS IS CREATED
      >   @model = Sketchup.active_model
      >   unless @@observer_added # IF THIS IS 'FALSE', THEN YOUR OBSERVER HAS NOT BEEN ADDED YET
      >    Sketchup.active_model.selection.add_observer(MySelectionObserver.new)
      >    @@observer_added = true # SET TO 'TRUE' SO NO ADDITIONAL OBSERVERS ARE ADDED  
      >   end
      >  end	#cg# I ended initialize here - is that correct? #RW# yes
      > 
      > ###def ChrisGlasierScenes.cgScenes #CG# I added this - is it correct? #RW# it depends.  If you want to call the method without an instance, yes.  Since $chrisglasierScenes is created as an instance, it is not necessary - you can use "def cgScenes"
      > 
      >  def cgScenes
      >   Sketchup.send_action "selectSelectionTool;"
      >   @dlg = UI;;WebDialog.new("cgScenes02", true, "Scene machine", 300, 205, 0, 0, true)
      >   subDir = "chrisGlasierScenes02PC/"
      >   fileName = "scene machine.htm"
      >   @dlg.set_file File.join(File.dirname(__FILE__), subDir+fileName)
      > 
      

      after that there is a bunch of @dlg.add_action_callbacks and then:

      
      > 
      >   @dlg.show()
      >  end #cgScenes
      > end #class ChrisGlasierScenes
      > 
      > $chrisglasierScenes = $chrisglasierScenes || ChrisGlasierScenes.new # SETS THE GLOBAL TO A NEW INSTANCE OF YOUR CLASS, UNLESS IT HAS ALREADY BEEN SET - SAVES OVERHEAD WHEN RELOADING THE .RB FILE
      > #CG# changed different spellings and capitalisation in mock up
      > 
      > unless file_loaded?("chrisglasierScenes02PC.rb")
      >   file_loaded("chrisglasierScenes02PC.rb")
      >   ($submenu) ? (submenu = $submenu) ; (submenu = UI.menu("Plugins"))
      >   submenu.add_item("cgScenes02" ){ $chrisglasierScenes.cgScenes }
      > end #RW# edited to be compatible with Organizer ;) and to not repeat the "file_loaded" call when reloading.
      > 
      

      If Rick you or anyone else could spot my error(s) I would be most grateful.

      Thanks

      Chris

      Here you go, with added comments tagged with #RW#.

      posted in Developers' Forum
      R
      RickW
    • RE: [Request] Script to produce window openings in walls

      Windowizer4 will cut the opening in the wall and create any storefront-type glazing for you. You can then quickly add the surrounds using a component or a Dynamic Component. You can also replace the window & frames with a pre-built component, if you want.

      posted in Plugins
      R
      RickW
    • RE: [How to?] Observer to web dialog A,A&amp;I

      Some (hopefully) constructive comments:

      1. The "@" symbol indicates a class instance variable, but you haven't defined a class for your def when you introduce "@def". I'd suggest a new class "ChrisGlasierScenes".
      2. You add an observer every time "chrisglasierScenes" is run. This will add a lot of overhead. Adding the observer should take place outside any defined methods.
      3. Globals are generally frowned upon, unless you make sure you have a unique name for them. $dlg is pretty generic, and it's possible someone else could come up with $dlg, and then you (or they) are SOL. That said, after you create the class, you can save an instance of it in a specially-named global variable, like
      $chrisglasierScenes = ChrisGlasierScenes.new
      

      You can then access the global when you want the dialog to do something

      $chrisglasierScenes.dlg.execute_script(cmd)
      

      Here's a mockup bit of code incorporating my suggestions:

      class MySelectionObserver < Sketchup;;SelectionObserver
       def onSelectionBulkChange(selection)
        model = Sketchup.active_model
        selection = model.selection
        $ChrisGlasierScenes.selected = selection[0].name  #includes js array index
        puts $ChrisGlasierScenes.selected
        cmd = "sceneSelected('#{selected}');"
        $ChrisGlasierScenes.dlg.execute_script(cmd)
       end  # def
      end  # class
      
      
      class ChrisGlasierScenes # CREATE A NEW CLASS
      
       @@observer_added = false # A CLASS VARIABLE
       attr_accessor ;dialog, ;selected # PROVIDES ACCESS TO THESE VARIABLES FROM OUTSIDE THE INSTANCE
      
       def initialize # THE AUTOMATIC METHOD CALLED WHEN A NEW INSTANCE OF THE CLASS IS CREATED
        unless @@observer_added # IF THIS IS 'FALSE', THEN YOUR OBSERVER HAS NOT BEEN ADDED YET
         Sketchup.active_model.selection.add_observer(MySelectionObserver.new)
         @@observer_added = true # SET TO 'TRUE' SO NO ADDITIONAL OBSERVERS ARE ADDED
        end
        @dlg = UI;;WebDialog.new("cgScenes", true, "Scene machine", .... && on and on)
       end #initialize
      end #class ChrisGlasierScenes
      
      $ChrisGlasiserScenes = $ChrisGlasierScenes || ChrisGlaserScenes.new # SETS THE GLOBAL TO A NEW INSTANCE OF YOUR CLASS, UNLESS IT HAS ALREADY BEEN SET - SAVES OVERHEAD WHEN RELOADING THE .RB FILE
      
      

      I've used observers combined with dialogs on several of my presentation tools (NightSky was the first ever, then SelectAtStartup, PageUtilities2, SceneExporterPro, CameraControls, and a few others). It's a powerful combination!

      posted in Developers' Forum
      R
      RickW
    • RE: [Plugin] CameraControls

      There are some challenges there with JavaScript/HTML in where I allow selection. I'll try to clean that up if possible.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      Pixero: Not sure when you downloaded, but the current download has the corrected script (though I see you did get yours fixed).

      John: Yes, I was using more "conventional" (as far as I could find) terminology for camera motion, rather than corresponding SU terminology. Also, I added text entry so you don't have to rely solely on slider accuracy - if you get it close and find the approximate angle, you can type the one you want.

      All: I can add a preset size for the window to get it a bit smaller at startup, though as noted above, it can be resized and should remember that size in the future. Also, I'm noting the requests, and will see what can be added.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      John,

      The 90-degree issue is (I think) an internal SU thing due to the desire of the camera to not look straight down - you can see this when manually orbiting, and I suspect it carries over to dynamically moving the camera in Ruby. Either that, or it's a by-product of my (necessary) assumption that when looking straight down, the positive y-axis is zero roll. Not sure.

      As for the second issue you described in your model, I don't quite understand the issue - I didn't have any problem getting 90 degrees for the magenta(?) and green boxes. I'll try to get with you later to get more input.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      @khai said:

      actually it wasn't an ad removal problem at all.. (btw the Firefox version is 3.5.2 the latest)

      it's Videolan, my video player. it's having a problem with the embedded video on that page.. working on it..

      Ah, sorry about that. I'll see about embedding a YouTube video instead.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      Thanks for the suggestions. I'll see what might work.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      @khai said:

      erm there's something on the camera controls page that kills my Firefox. something about a C library not loading correctly.

      Which page? The Smustard page or the webDialog?

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      @jim said:

      Did you write the Javascript slider?

      Yep. Thought about an out-of-the-box thing, but decided to go custom.

      posted in Plugins
      R
      RickW
    • RE: [Plugin] CameraControls

      TIG: Thanks for the note - I forgot about parallel projection 😳
      I'll also add Math::atan to (hopefully) fix Chris's problem.

      [EDIT] New version uploaded to Smustard

      posted in Plugins
      R
      RickW
    • [Plugin] CameraControls

      Announcing CameraControls! (PC only for now - working on the Mac version)

      CameraControls provides tighter user control over camera positioning by providing sliders and direct numeric entry for pan, tilt, and roll, through a webDialog.

      The dialog also responds real-time to changes in the view (activating a scene tab or using the SketchUp-native camera manipulation tools).

      To use CameraControls, select Camera Controls from the Camera menu in SketchUp. CameraControls is also compatible with Organizer.

      posted in Plugins
      R
      RickW
    • RE: Does anyone know of a Ruby that saves your shortcuts

      If you rename the .dat file from the default name to something like "shortcuts.dat", you have better success in importing shortcuts and overwriting the SU defaults, at least in my past experience. That could be related to the SU6 bugs that reportedly got fixed in SU7. I'll see if I can do a test on that here sometime soon...

      posted in Developers' Forum
      R
      RickW
    • RE: Startup doesn't startup

      I have also noticed a problem with SelectAtStartup when launching SU - it works, but is apparently overwritten by something either internal to SU or another ruby (haven't tested it yet). However, it still works when opening a file or starting a new model.

      posted in Developers' Forum
      R
      RickW
    • RE: Max number of plugins?

      There is an upper limit to the number of menu items that Windows can display (cumulative across all open apps). I've seen this happen - too many open apps, and my Plugins menu starts getting sparse. After closing an app or two, the menu items reappear.

      It is possible that you really might have too many plugins, though it seems more likely a problem with too many open apps.

      posted in Developers' Forum
      R
      RickW
    • RE: Need good Ruby scripter

      Have you tried SceneExporterPro for exporting your image files?

      posted in Developers' Forum
      R
      RickW
    • RE: [REQUEST] Multi-weld

      I'll try to find some time to look into this.

      posted in Plugins
      R
      RickW
    • 1 / 1