Change model name for the base model (active model), for FBX export

Trying to export FBX, but cannot change the root model’s name to be seen in the exported FBX file, its always “Model” (and node MeshN where N is some number, usually depending on how many components/groups are in the scene). = “YOLO” does nothing for the exported FBX mesh name, you can try.
Is it possible to change the main model’s name in the exported FBX?

If I understand you correctly you want to name the main hierarchy? If so, have you tried to group all the groups & components into a container group (‘yolo’) and tried exporting again?.

Lets just start with a simple mesh, no component instances or groups, a simple box in the main model (active model), I set the and when exported, in the FBX file, I do not find that name, but an automatic Model/Mesh1.
Try to make a simple rect, push it up to make a box, make a script which renames the active model before export and then export to FBX, the name is not preserved in the FBX.

Irrespective of the FBX file’s name, the ‘Model’ is always assigned be the reference to the enclosing model:
is expected for the ‘loose’ geometry of the mesh.

If you select the mesh and add it to a component [or group] in the model named ‘123Nekitu’ then the reference becomes:

It’s just the way FBX data is stored.
Loose geometry is shown as such when it’s in the model.
Other geometry inside a ‘container’ [group or component] is assigned a suitable reference using a prefix to name the container and an incrementing suffix if there are multiple instances…

Ok then, its just more logical to me that the main default model take the name to FBX ref too. Thanks for comfirmation, will try the group before export or something similar.

are string properties, mainly for internal use, as information to display in the template picklist(s).
Either the Template pane of the Welcome dialog, or the Template panel of the Preferences dialog.

Once a new file is created from a template, these two properties are erased.

Later, they can be set manually via Window > Model Info > File panel, (and I suppose used for the user’s personal use, or some use by extensions or plugins.)

I would hope that if the export file format has similar internal string attributes, that these internal SKP properties could be exported as such, but the documentation does not tell us if this is true (and for what external formats.)

So they have nothing to actually do with the model filename nor filepath.

The filename and filepath (respectively) are accessed via:

When I set = “TEST” I can see the name in the Model Info dialog. I would like that name to be used as source for the mesh in the fbx exported file, that’s all. It doesnt do that, it puts a “Model” :slight_smile:

So you want to use the API to export the entire model as an FBX, with no ‘loose’ geometry meshes.
So do these steps…

model = Sketchup.active_model
return if (path = model.path).empty? ### so we get a 'path'

Now start an operation…

model.start_operation('FBXexport', true)`

Make sure we are back in the model.entities context

model.close_active until model.active_entities == mode.entities

Now make a group of everything in the model.

name = File.basename(path, ".*")
group = model.active_entities.add_group(model.active_entities.to_a) = name

Do the export [here it is assumed we save it with the model without asking for a path]…

fbx = File.join(File.dirname(path), name+".fbx")
model.export(fbx, false)

At the end cancel the operation to undo the grouping etc…


The fbx file is now saved externally so it is not affected by the abort.
It should now have no ‘loose’ meshes - because everything is nested inside one group named after the model itself ???

Yup, thanks, that works ok, my problem was with the inconsistency of the FBX exporter, which does not take into account the main model’s name when exporting to the FBX mesh/model information.