sketchucation logo sketchucation
    • Login
    1. Home
    2. KevinKarney
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 7
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Forcing a Screen Update during a Ruby script

      Dear Dan
      Many thanks for troubling to reply. But I am still stuck! The Inspector just updates when the loop is finished.

      require 'sketchup'
      UI.menu("PlugIns").add_item("Change Date") { change_date_loop }

      def change_date_by_one_day
      Sketchup.active_model.shadow_info["ShadowTime_time_t"] =
      Sketchup.active_model.shadow_info["ShadowTime_time_t"] + 606024
      shadowinfo = Sketchup.active_model.shadow_info
      UI.refresh_inspectors()
      refreshed_view = Sketchup.active_model.active_view.refresh
      end

      def change_date_loop
      for the_step in 1..365
      sleep(0.025)
      change_date_by_one_day
      end
      end

      posted in Developers' Forum
      K
      KevinKarney
    • Forcing a Screen Update during a Ruby script

      I am running a shadow modelling study covering a year . I use a simple plug-in script that increments the date by a day at a time. That all runs fine - the shadows move as expected.

      But while the script runs, I want to see the Shadows Info dialog refresh as the date changes. Presently the Shadows Info dialog only visibly updates when the script has completed.

      Anyone know of a way to force a screen refresh while a script is running ??

      Any help greatly appreciated... I have wasted too much time with this already!

      Best wishes
      Kevin Karney

      posted in Developers' Forum
      K
      KevinKarney
    • RE: Transforming an object with SketchUp Ruby

      Aerilius
      You are a star !
      Thanks a million
      Kevin

      posted in Developers' Forum
      K
      KevinKarney
    • Transforming an object with SketchUp Ruby

      I am struggling a bit with Ruby and would really appreciate some help...

      I just want to add some 3D text to my model (which I can do)
      model = Sketchup.active_model entities = model.entities mytext = entities.add_3d_text('test', TextAlignCenter, "Arial", true, false, 2.0, 0.0, 0.0, true, 0)

      I then want to rotate the text about the z-axis with a transformation, such as
      tr1 = Geom::Transformation.rotation(ORIGIN, Z_AXIS, 45.degrees)

      I then want to translate the text with a transformation, such as
      tr2 = Geom::Transformation.translation Geom::Vector3d.new (0,1,0)

      I just cannot work out how to apply tr1, then tr2 to mytext. It's got to be simple, but everything I have tried produces an error.

      Thanks in advance from Wales
      Kevin

      posted in Developers' Forum
      K
      KevinKarney
    • RE: [Plugin] Put shadow on current day and hour

      Hi All
      To correctly display the shadow of an object, one needs the
      "Local Apparent Solar Time" - which is a function of the Sun's altitude and azimuth in the sky at your particular location. The local apparent solar time is 12:00 when the Sun is due South (or North in the Southern Hemisphere).

      Your watch and your computer indicate Civil Mean Time which is related to "UTC (Universal Time Coordinated)" - which is Atomic Time (and within a hair's breadth is the same as the out-of-date Greenwich Mean Time). Atomic Time is maintained by the Bureau International des Poids et Meseurs, which is a UN Agency. It averages out the time from a large number of atomic Cesium clocks around the world

      Civil Mean Time = UTC + Time Zone + Daylight Saving Hours

      Local Mean Time = Civil Mean Time +/- (the Longitude difference between your time zone longitude and your local Longitude) * 4 minutes

      Local Apparent Solar Time = Local Mean Time + "The Equation of Time"

      The Equation of Time is the difference between mean and apparent time. There is a difference between the two, since the Mean Sun (by definition!) is a virtual object that goes around the equator at a uniform speed, while the True Sun moves around the Ecliptic (23 deg to the Equator) at a non-uniform speed (in a ellipse). I attach a graph of the Equation of Time.

      Confused.... But Sketchup has all this technology built in! It's shadows are spot-on for local apparent solar time.

      Check this out 1) set June 14th when the equation of time is zero. 2) set your local Latitude and Longitude. 3) Draw a vertical stick. 4) Select the time around midday when the shadow is due North or South. The time you get +/- 12 will be the difference in longitude between your time zone longitude and your local longitude * 4.


      Equation of Time

      posted in Plugins
      K
      KevinKarney
    • RE: Setting the Date and Time for a Shadows study

      Chris, Mat, Jim
      Many thanks - each of your responses added that extra bit to my knowledge. I think I have all I need for the next step of my journey. I am trying to build a virtual sundial correct for any Latitude and Longitude - which may seem a bit of a strange task. But Stetchup has rather a good model of the Earth's movement around the Sun. It correctly distinguishes between solar time - as seen on a sundial - from civil time - as read from your watch. So, with its ability to cast shadows correctly, a sundial simulator should not be too difficult.

      I'll keep you posted !

      posted in Developers' Forum
      K
      KevinKarney
    • Setting the Date and Time for a Shadows study

      I am just starting on Ruby scripting, so there is probably an obvious answer to this...
      I need to be able to change the date and time from within a script and can find nothing in the documentation of how to do this.
      Any help would be most appreciated

      posted in Developers' Forum
      K
      KevinKarney
    • 1 / 1