/usr/bin/gzprop is in gazebo9 9.0.0+dfsg5-3ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #!/usr/bin/env ruby
require 'rubygems'
require 'tmpdir'
begin
require 'zip'
rescue LoadError
puts "Requires the rubyzip gem. To install:"
puts " gem install rubyzip"
exit
end
#################################################
# Display help information
def help
puts "gzprop -- Create a model zip for upload to thepropshop.org\n"
puts "\n"
puts "'gzprop' <model_sdf_file>\n"
puts "\n"
puts "Package an existing model SDF, materials, and meshes\n"
puts "into a zip suitable for upload to thepropshop.org. A \n"
puts "working instanstance of Gazebo >4.0 is required.\n"
puts "\n"
puts "Example Usage:\n"
puts " $ gzprop ~/.gazebo/models/ground_plane/model.sdf\n"
puts "\n"
end
#################################################
# Main
# Make sure there are command line arguments.
if ARGV.empty?
help()
abort("")
end
# Get the model file name
modelFile = File.absolute_path(ARGV[0])
modelParts = modelFile.split('/')
modelDir = modelParts[0, modelParts.size() - 1].join('/')
# Make sure there is a model.sdf file in the model directory
abort("Missing model file [#{modelFile}]") unless File.exist?(modelFile)
# Get the name of the model (last part of the directory name)
modelName = modelParts[-2]
## Make a temporary directory
Dir.mktmpdir { |dir|
metaDir = File.join(dir, "meta")
# Copy the model information into a temp directory
FileUtils.cp_r Dir[modelDir + '/*'], dir
# Create the meta directory
Dir.mkdir(metaDir)
# Create a set of images
`gzserver -s libModelPropShop.so worlds/blank.world --propshop-save "#{metaDir}" --propshop-model "#{modelFile}"`
# Create a zip file for the model
zipFilename = File.join(Dir.pwd, modelName + '.zip')
if !File.exists?(zipFilename)
Zip::File.open(zipFilename, Zip::File::CREATE) { |zipfile|
Dir[File.join(dir, '**', '**')].each do |file|
zipfile.add(file.sub(dir + '/', ''), file)
end
}
else
puts "Error: #{zipFilename} already exists. Please move or rename."
exit
end
}
# Completion message
puts "Propshop model created.\n"
puts "Upload [#{modelName}.zip] to thepropshop.org"
|