Insert Textures and Objects 3D | SDK or Ruby API


#1

Hello everyone! I am starting a project where I will have a database with 3D objects, textures, products of companies that sell products aimed at interior design / architects. I want designers who use sketchup to use these items during their creations, as if they have at their disposal a catalog of products available by these companies. These items will be displayed over the internet. The question is, do I use the Ruby API or the SDK to develop these functionalities for sketchup.


#2

The C SDK is not yet a “live” API. (Meaning for use within SketchUp on loaded models.)
It is meant (at the present time) for use in 3rd party applications to create importers from SKP format and exports to SKP format, from within these 3rd party modeling applications.


#3

http://ruby.sketchup.com/Sketchup/DefinitionList.html#load_from_url-instance_method >=v7
Loads a specified SKP file from a URL into the model’s definitions list.
For the textures you either need to download the image file and apply it as a texture to a material OR have a premade SKM file to download and then load.
http://ruby.sketchup.com/Sketchup/Materials.html#load-instance_method >=v2017
There are various Ruby methods to download files from the internet… e,g,

...
 #get the url
...
require('uri')
url = URI.escape( url )
...
require('open-uri')
download = open( url )
...
IO.copy_stream(download, file)
....

Obviously this is not usable code BUT it should point you in some directions…