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

    Georeferencing

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 857 Views 2 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.
    • J Offline
      jwelin
      last edited by

      Has anyone found a Ruby method to enable the "Use georeferencing" checkbox in Model info:location?
      I've scanned the API but no luck.

      John Welin
      architectural model maker
      Chicago, USA

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

        Hi John,

        I did some playing around... found that a new attribute_dictionary is created when you turn on Georeferencing the fist time - the AD is named "GeoReference"

        The dictionary stays when the Georeferencing option is then disabled, but there is a flag in the attribute dictionary itself called "UsesGeoReferencing".

        
        ad = Sketchup.active_model.attribute_dictionary("GeoReference")
        #<Sketchup;;AttributeDictionary;0x7524320>
        ad.to_a
        [["Latitude", 40.017], ["LocationSource", "Manual"], ["Longitude", -105.283], ["ModelTranslationX", -18734219.6437523], ["ModelTranslationY", -174396944.990963], ["ModelTranslationZ", 0.0], ["UsesGeoReferencing", false], ["ZValueCentered", 0.0]]
        
        

        Hi

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

          Thanks, Jim.
          Working off your observation, I opened a new drawing, and as you said, the attribute dictionary "Georeference" is empty. All the default geodata is in the shadow_info object (or hash, I'm not sure of the proper term). I listed it like this:

              
          am = Sketchup.active_model
          #<Sketchup;;Model;0x63be010>
          am.shadow_info.each{|k,v| puts "#{k} #{v}"}
          City Boulder (CO)
          Country USA
          Dark 45
          DayOfYear 312
          DaylightSavings false
          DisplayNorth false
          DisplayOnAllFaces true
          DisplayOnGroundPlane true
          DisplayShadows false
          EdgesCastShadows false
          Latitude 40.017
          Light 80
          Longitude -105.283
          NorthAngle 0.0
          ShadowTime Fri Nov 08 07;30;00 Central Standard Time 2002
          ShadowTime_time_t 1036762200
          SunDirection (-0.423824071310226, -0.772439983723215, 0.472979521886207)
          SunRise Fri Nov 08 00;43;14 Central Standard Time 2002
          SunRise_time_t 1036737794
          SunSet Fri Nov 08 10;46;34 Central Standard Time 2002
          SunSet_time_t 1036773994
          TZOffset -7.0
          UseSunForAllShading false
          nil
          

          Checking the "Use Georeference" box creates the attribute dictionary and probably uses the shadow_info coordinates to set the lat and long.

          I want to programatically check the "Use Georeference" box on a batch of files. I can't assume it exists so I'll need to create the attribute dictionary "Georeference" exactly. I suppose I should make the shadow lat/long and the georeference lat/long match to avoid future confusion.
          I this the way to go?

          John Welin
          architectural model maker
          Chicago, USA

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

            Hi John,

            That seems reasonable to me. It does look like the Lat/Lon are taken from the Shadow_Info, but I have no idea what the other attributes in GeoReference mean. I think you'll just have to experiment until you figure it out.

            Hi

            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