# Revision history [back]

### From Mesh, into MeshManager, via SDF to a model in a world: how?

Howdy folks,

I am trying to get to the bottom of how exactly a mesh is loaded in Gazebo.

I am working on a Gazebo Plugin that generates trees procedurally such that I can create a forest where each tree's geometry/shape is unique (more or less).

I have figured out how to convert a procedurally generated tree to a Mesh, and then add this Mesh to MeshManager:

gazebo::common::Mesh * treeMesh = procTreeFunction();
treeMesh->SetName("Tree_1234");


But what I am currently struggling with what to do next in order to see this tree in my Gazebo world, and what follows is questionable and is what I need some help with.

So next I am creating an SDF model string:

modelStr << "<sdf version='" << SDF_VERSION << "'>"
"<model name='" Tree_1234 "'>"
"<pose>" << pose << "</pose>"
"<velocity_decay>"
"<linear>0.01</linear>"
"<angular>0.01</angular>"
"</velocity_decay>"
"<inertial><mass>" << _mass << "</mass>"
"<inertia>"
"<ixx>" << Ixx << "</ixx>"
"<iyy>" << Iyy << "</iyy>"
"<izz>" << Izz << "</izz>"
"<ixy>" << 0.0 << "</ixy>"
"<ixz>" << 0.0 << "</ixz>"
"<iyz>" << 0.0 << "</iyz>"
"</inertia>"
"</inertial>"
"<collision name='collision'>"
"<geometry>"
"<mesh>"
"<uri>" Tree_1234 "</uri>"
"</mesh>"
"</geometry>"
"</collision>"
"<visual name='visual'>"
"<geometry>"
"<mesh>"
"<uri>" Tree_1234 "</uri>"
"</mesh>"
"</geometry>"
"<material>"
"<ambient>"  << _materialAmbient[0]  << " " << _materialAmbient[1]  << " " << _materialAmbient[2]  << " " << _materialAmbient[3] <<"</ambient>"
"<diffuse>"  << _materialDiffuse[0]  << " " << _materialDiffuse[1]  << " " << _materialDiffuse[2]  << " " << _materialDiffuse[3] <<"</diffuse>"
"<specular>" << _materialSpecular[0] << " " << _materialSpecular[1] << " " << _materialSpecular[2] << " " << _materialSpecular[3] <<"</specular>"
"<emissive>"  << _materialEmissive[0] << " " << _materialEmissive[1] << " " << _materialEmissive[2] << " " << _materialEmissive[3] <<"</emissive>"
"</material>"
"</visual>"
"</model>"
"</sdf>";


And then I add the model to my world

sdf::SDF sdfDescription.SetFromString(modelStr.str());
_parent->InsertModelSDF(sdfDescription);


However, instead of seeing a tree, I am seeing a cube (that appears to be a unit cube of 1 m^3). The cuboid is rendered in the correct material settings and at the right location. It's just not a tree :)

Does anyone have an idea what I might be doing wrong?