sketchucation logo sketchucation
    • Login
    1. Home
    2. pvbuero
    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!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 29
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Sun elevation and azimut

      Hello Thomas,

      that's great. What would I do without your help ...
      I guess there's no function for the azimut- and the elevation-angle ?
      ... because it can be calculated with some pythagoras and the SunDirection.
      Another question:

      Is there a way to find out whether a face is shaded or in the sun ?

      Best Matthias

      posted in Developers' Forum
      P
      pvbuero
    • Sun elevation and azimut

      Hello,

      recently I found out, that there are some ways to figure out the current direction of a vector pointing to the sun, the sun elevation and the azimut angle of the sun in a sketchup model using dynamic components.
      Now my question is if there are methods to retrieve those values in a rubyscript. I couldn't find anything like this in the shadowinfo class... Is there another class which I didn't find yet ?

      As always ... thanks for your help.
      MD

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      Hello,

      thanks to Dans suggestion πŸ‘ I solved the problem. There was a second testing script which obviously overwrote the script I was working on. I deleted it and everything worked as I intended.

      Thanks to all of you for your help.
      MD

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      Thanks a lot. You're answers are a great help for me as an absolute beginner... πŸ’­
      ... I'll try your suggestions this evening and give you a feedback.

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      @dan rathbun said:

      Jim's version is still being loaded, probably AFTER your version, so your's gets redefined by his version.
      Also it's best to restart Sketchup for testing. (Otherwise you have to detatch the old observer instance, redefine the variable to point to a new instance of your new observer class, and attach the new observer instance.)

      Hello Dan,

      I have restarted sketchup and I've no idea where Jim's version should come from ? I deleted it and replaced it by my code...

      Thanks MD

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      I'm still having trouble with this observer.
      Now the event is fired whenever I change the shadowinfo settings and I see a messagebox (see below). That's fine so far.
      Observer.png

      But I'm not able to overwrite this messagebox-method with my own method.
      I wrote the following:

      class SO < Sketchup;;ShadowInfoObserver
          def onShadowInfoChanged(info, type)
              UI.messagebox("test the observer")
          end
      end
      

      ...but still the same message as shown above appears..
      What have I done wrong ?

      Thanks for your help...
      MD

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      @unknownuser said:

      This works for me:

      This works for me too. Perfect. Thanks a lot.

      I thought I was doing something basically wrong because the code above was't "my code". It was from the API documentation... strange πŸ˜’

      posted in Developers' Forum
      P
      pvbuero
    • RE: How observers work ?

      @tig said:

      If you have $5 this is a good tool that does what you want... http://www.smustard.com/script/Time

      Thank's a lot. I already found the time.rb script and bought it. It works quite good, but nevertheless I'm still interested how those observerclasses work and I still wasn't able to figure out how to use them. The time script - by the way - does not use an observer to trigger a new note to display the shadow_info["ShadowTime"]. It just uses a timer which frequently retrieves the ShodowTime an draws it on the screen.
      My goal is to get a trigger whenever the shadowtime changes and that trigger should start a little method to display the new time on the screen. It should work when you change the time manually and it should also work when you start an animation which changes the shadowtime automatically... Is that possible ?

      I managed to define the class, I managed to add the observerclass without an errormessage but then nothing happens 😞 ...
      Therefore my question is: Are there any examples on the web on how those classes are being used ?

      Thanks a lot for your help
      MD

      posted in Developers' Forum
      P
      pvbuero
    • How observers work ?

      Hello,

      I'm new to ruby and I try to make a little script that creates a bunch of scenes (pages) of a model that shows different shading situations of my sketchup-model during a day.
      So far everything worked just fine but now I'd like to have a text object which shows the actual time for each scene and that text should be changed when the scene changes.(manually and automatically when creating an animation) I know something like events from VBA (visual basic) where I've a little programming experience and I figured out that in ruby it might be done with observers ?. But unfortunately I was'n t able to find a tutorial on how those observers are being used.
      I tried this:

      @unknownuser said:

      This is an example of an observer that watches the selection for

       # changes.
       class MyShadowInfoObserver < Sketchup::ShadowInfoObserver
         def onShadowInfoChanged(shadow_info, type)
           UI.messagebox("onShadowInfoChanged: " + type.to_s)
         end
       end
      
       # Attach the observer.
       Sketchup.active_model.shadow_info.add_observer(MyShadowInfoObserver.new)
      

      in my script and hoped the messagebox would be fired when I changed the shading settings, but nothing happened not even an error message...
      So I would be greatful for any helping hint...

      MD

      posted in Developers' Forum
      P
      pvbuero
    • 1 / 1