# Table Text Visibility Issue

## Introduction

These examples show that using the `wblockCloneObjects` method to copy dynamic block references, that reference a block that has multiple visiblity states and a table entity for each state, from one drawing to another, results in a drawing that when opened in AutoCAD can have issues rendering table text when switching between visibility states in some situations. The cause of this behavior is so far unknown, but these examples show reproductions of this issue happening that can be replicated.

## Environment

- ODA Kernel & Drawing SDK 2026.12 (lnxX64_14dll)
- GCC compiler
- Program built and ran on Ubuntu 24 in [WSL](https://learn.microsoft.com/en-us/windows/wsl/)
- Output drawings opened in AutoCAD 2026 from Windows 11

## Example 1

### Expected Result

Running the program `example1` with `dyn-table.dwg` in the current directory is expected to output a new drawing named `example1.dwg` that should contain copies of all the model space entities that are present in `dyn-table.dwg`, and copies of all the objects that any of those entities are dependent on. Opening the drawing in AutoCAD and switching the visibility state of any of the dynamic block references that were copied should show all the entities and text for that visibility state.

### Actual Result

Switching the first block reference's visibility state to state `B` does not show the text in table B.

### Example 1 Video Description

`example1.mp4` show the compiled version of the program `example1.cpp` being executed with the example drawing `dyn-table.dwg` in the current directory. The program creates a new drawing named `example1.dwg`. The drawing is then opened in AutoCAD 2026.

In AutoCAD, the first block reference (going from left to right) is selected. When the visibility state of this dynamic block reference is switched from state `A` to state `B`, the text within the table is not visible. Switching back to `A` shows the table text for table A, and switching back to `B` again still does not show the table B's text.

However, when the second block reference's visibility state is switched to `B` it does display the table's text. If the first reference's state is set to `A`, and the second reference's state is switched to `B` and table B's text is visible in that block reference, switching the first block reference's state to `B` will display the table's text correctly.

This result leads me to believe that AutoCAD is using a outdated or invalid cache to render table state `B` when the text is not visible, and switching the second block references visibility state to `B` for some reason fixes the cache for all the other block references for that block.

## Example 2

### Expected Result

Running the program `example2` with `dyn-table.dwg` in the current directory is expected to output a new drawing name `example2.dwg` that should contain a copy of just the first dynamic block references (going from left to right) that is present in the model space of `dyn-table.dwg`, and copies of all the objects that block reference is dependent on. Opening `example2.dwg` in AutoCAD and toggling the visibility state from `A` to `B` should result in table A being hidden and table B being shown, including the text in the table.

### Actual Result

Switching the visibility state from `A` to `B` does not show the text in table B.

### Example 2 Video Description

`example2.mp4` shows the compiled version of the program `example2.cpp` being executed with the example drawing `dyn-table.dwg` in the current directory. The program creates a new drawing named `example2.dwg`. The drawing is then opened in AutoCAD 2026.

Opening `example2.dwg` in AutoCAD shows that only the first block reference (going from left to right) was copied from the template drawing. Switching the block reference's visibility state from `A` to `B` shows a table B with missing text, just like example 1.

Switching the block references visibility state back to `A`, inserting a new block reference to the same block (`DYN001`), then switching the new block reference's visibility state to `B` displays table B correctly. Then, switching the first block reference's visibility state to `B` will display the table text.

This result is consistent with example 1, and also leads me to believe that AutoCAD is using an outdated or invalid cache to render table B when its text is not visible. It seems like adding a new block reference and switching it to visibility state `B` fixes the cache so that the first block reference can render correctly when its visibility state is switched to `B`.