So we built this aacprocessors library. Intention was to read and manipulate any AAC software. Its not ideal but just made a new method just for the grid right now.
def replace_cell_with_xml(
self,
gridset_path: str,
target_caption: Optional[str],
target_action: Optional[str],
new_content_xml: str,
output_path: str,
) -> None:
"""Replace a cell's content with a new XML fragment across the gridset.
Args:
gridset_path (str): Path to the original gridset file.
target_caption (Optional[str]): Caption of the button to replace.
target_action (Optional[str]): Action command of the button to replace.
new_content_xml (str): New XML content for the cell.
output_path (str): Path to save the modified gridset.
"""
So search for a action or a cell label and it will replace all buttons tin the gridset with the xml of the button you replace it with.
For a demo see https://gist.github.com/willwade/26a1327c4e130b6afa36977fc129e09b
Really this needs more thought and a way of mking this across all AAC file types. I’m thinking a ‘replace_cell_with_raw’ method for sql or filebased systems. Its quite a bit different for sqlite systems though as they abstract the button logic from the content. Needs more thought