question

Kari Payton avatar image
0 Likes"
Kari Payton asked Phil BoBo edited

Save object from a model where the source for the object is deleted.

Is there any way to save an object from a model where the source for the 3d file has been deleted?

FlexSim 17.2.2
3d shape
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

The applicationcommand “byteblocktofile” will export binary data from a node to a file. You can use this to export the packed media nodes to files.

Here is an example that exports all the packed media in a model to files:

for (int r = 1; r <= content(packedmedia(model())); r++) {
	treenode folder = rank(packedmedia(model()), r);
	for (int i = 1; i <= content(folder); i++) {
		treenode file = rank(folder, i);
		applicationcommand("byteblocktofile", file, concat(modeldir(), getname(file))); 
	}
}
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Kari Payton avatar image Kari Payton commented ·

do I need to tell it where to save or it saves in same folder as the model file?

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Kari Payton commented ·

That script is using modeldir() as the destination to put the files.

0 Likes 0 ·
Kari Payton avatar image Kari Payton Phil BoBo ♦♦ commented ·

Ok. I ran the script but didn't get any output files.

0 Likes 0 ·
Show more comments