how to retrieve the version of the model  Topic is solved

how to retrieve the version of the model

Postby glro » Thu Apr 06, 2017 9:49 pm

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
0

glro 
 

Re: how to retrieve the version of the model  Topic is solved

Postby TIG » Fri Apr 07, 2017 2:48 pm

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:
Code: Select all
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...
1
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: scale1 and 3 guests

Visit our sponsors: