Hi,
I am trying to attribute different visible layers to different organs so that i can export them separately. How can I do that? At the moment they are all under the same layer
Hi Michele,
each node has a setLayer(int x) function, so you could either use a query e.g. (*Leaflet*).setLayer(3);
Or directly in the construction of your module:
module A(float len) extends Sphere(0.1)
{
{
setShader(GREEN);
setLayer(2);
}
}
The second one is most likely more helpful for your approach.
To export to different files afterwards you need to call the 3D export from rgg code, with the export3DScene function. In this function the third argument defines if only visible layer should be exported (false= everything is exported, true= only visible layers).
public void test(){
export3DScene("/home/tim/testAll.obj","obj",false);
View3D view3d = View3D.getDefaultView(workbench());
//set Layer 0 to false to hide all F
view3d.setVisibleLayers(new boolean[]{false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true});
export3DScene("/home/tim/testA.obj","obj",true);
//set Layer 2 to flase to hide all A
view3d.setVisibleLayers(new boolean[]{true,true,false,true,true,true,true,true,true,true,true,true,true,true,true,true});
export3DScene("/home/tim/testF.obj","obj",true);
// make everything visible again
view3d.setVisibleLayers(new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true});
}
Sadly the setVisibleLayers function of view3d does not link well with the GUI menu in view. Therefore it can happen that the layer-checkbox in the menu is checked even so the layer is not visible. Just uncheck and check it again ![]()
Tim



