I tired to save ball and wall objects into the PFC3D save file but failed
get_ipython().magic('reset -sf') #command to initialize iPython environment
import itasca as it
it.command("python-reset-state false") #the model new command will not affect python environment
it.command("""
model new
model domain extent -0.1 0.1
ball create id 1 position (0,0,0) radius 0.01
wall generate id 1 name 'test' polygon (-0.1, -0.1, -0.05), (0.1, -0.1, -0.05), (0.1, 0.1, -0.05), (-0.1, 0.1, -0.05)
""")
wall_id_1 = it.wall.find(1)
ball_id_1 = it.ball.find(1)
it.add_save_variable("wall_id_1")
it.add_save_variable("ball_id_1")
it.get_save_variables()
it.command(f"""
model save 'test_220529.sav'
""")
The error message is
ValueError: Error while trying to save the Python object: wall_id_1. Either this object itself or something contained in the object cannot be serialized. Itasca uses the dill Python module for serialization. A description of what can and cannot be serialized can be found here: https://pypi.python.org/pypi/dill The error message follows:
Internal error while calling Python function pickle_dump from module _itasca_internal. The error message was "<class 'TypeError'>"
"can't pickle itasca.wall.Wall objects"
File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\_itasca_internal.py", line 28, in pickle_dump
_pickler.dump(obj)
File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\pickle.py", line 409, in dump
self.save(obj)
File "C:\Program Files\Itasca\PFC700\exe64\python36\lib\pickle.py", line 496, in save
rv = reduce(self.proto)
While processing line 0 of source Python interpreter.
How can I save it?