Save an array with skp file


#1

Is there possibility to save an array (with data) with skp file?
And after reopen skp restore data from array?


#2

Have a look at AttributeDictionary


#3

First set up your array:

an_array=['a', 'b', 1, 2, 3.0123, true, false, another_array]

Now…

model=Sketchup,active_model
model.set_attribute("mamjankowski", "some_array_data", an_array)

Then later on

model=Sketchup,active_model
array = model.get_attribute(“mamjankowski”, “some_array_data”, [])

Provided that the array’s data is in the same order it’s easily extracted…


#4

Thanks, it works.
I thought that in model attributes is not allowed to store an array.
I was wrong.


#5

Most ‘objects’ in Sketchup can be given attributes [which can then be ‘retrieved’] - typically you might think of ‘containers’ like groups and component-instances, and of course raw geometry like edges and faces, but it can include the model-itself, and then its layers, definitions, materials, scenes etc, or their sub-parts like a definition etc…