[SOLVED] Error - Cannot make de.grogra.turtle.RH persistent

Hi! I encountered an error:
FatalPersistenceException: Cannot make de.grogra.turtle.RH[id=-1]@39a6bb45 persistent: there already exists the object de.grogra.imp3d. objects.MeshNode[id=12892]@56651ab8 with id 12892

This error prevents me from opening the gsz file. When I create a new gsz file and input the same code it works. But after I close the file I can’t open it again. Does anyone know what is causing this? It seems that this error always appears after I make a copy of the file, but I’m not sure if that’s the cause.
Thank you for your help!

1 Like

Hi Peige,
could have something to do with object serialization in XML, but without further context this is just speculation. Could you please provide the code or at least an extract?
Best regards
Gerhard

1 Like

Dear Gerhard,

Here is the code. I am not sure where the problem is so I uploaded the whole code. Thank you!

error-Groimp/Sensitivity_analysis.gsz at main · Pikapiu77566/error-Groimp (github.com)

Best,
Peige

Hello Peige,

The error comes from how GroIMP serialize and deserialize the graph XML of the project. Without going into the details you cant prevent this error by not instantiating Nodes in a module definition.

In your project in Model.rgg, when you define the module LeafTemplate, you should not create a instance of a MeshNode.
Instead, leave the MeshNode mesh null and create a global static MeshNode for the default value:

e.g.

static MeshNode defaultMesh = new MeshNode(POLYLEAFM_9[0]);

module LeafTemplate extends Organ(petmovelength)
{
	...
	MeshNode mesh;
} ==> 	... 
		if (mesh==null) (defaultMesh) else (mesh);

Additionally, note that if a groimp project that run, fail to open after being saved and reopened, you can delete the graph.xml file content (the file is still required, even empty). Then, groimp will create a new graph for your project. This will delete the saved graph (equivalent to recompile the project) but the project will open.

I hope this solve your issue,

Best,
Gaetan

1 Like

It works! Thank you very much!

Best,
Peige

1 Like