• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

How to retrieve the version of the model

Scheduled Pinned Locked Moved Developers' Forum
2 Posts 2 Posters 810 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.
  • G Offline
    glro
    last edited by 6 Apr 2017, 20:49

    is there a way using ruby?
    i found the code to retrieve the version of sketchup

    sketchup_v = Sketchup.version_number.to_s

    but i don't see anything to do the same for the model itself

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 7 Apr 2017, 13:48

      You need to read in the first part of the binary file SKP and see what version it says...
      ໿SketchUp Model೿{17.0.18899}䖯挢べ仪躯蘚䆤寸ÿ...

      In Ruby try something like this:

      vv=File.open(skp_path, 'rb'){|f| f.read }.unpack('m*').pack('m').gsub(/SketchUpModel/,'').to_i.to_s;if vv[0].chr=='1';v=vv[0].chr+vv[1].chr;else;v=vv[0].chr;end
      

      skp_path is the full path to the SKP you are trying to find the version of.
      vv is the long version number, as a string [e.g. "17018899"]
      v is the short version number, as a string [e.g. "17"]
      If you want more details parse vv differently...

      TIG

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      1 / 1
      • First post
        1/2
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement