Insert Textures and Objects 3D | SDK or Ruby API

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.

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.

1 Like

Class: Sketchup::DefinitionList — SketchUp Ruby API Documentation >=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.
Class: Sketchup::Materials — SketchUp Ruby API Documentation >=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…

1 Like