How to retrieve the version of the model
-
is there a way using ruby?
i found the code to retrieve the version of sketchupsketchup_v = Sketchup.version_number.to_s
but i don't see anything to do the same for the model itself
-
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 parsevv
differently...
Advertisement