Skip to content

Clone the proxy geometries of an entity only once - #1317

Merged
DomCR merged 2 commits into
DomCR:masterfrom
ilCosmico:fix/proxy-geometries-clone
Oct 19, 2026
Merged

DomCR merged 2 commits into
DomCR:masterfrom
ilCosmico:fix/proxy-geometries-clone

Conversation

@ilCosmico

Copy link
Copy Markdown
Contributor

Entity.Clone() creates the proxy geometry list of the clone as a copy of the original list and then adds a clone of each geometry to it. The cloned entity ends up with twice the geometries, and the first half are the same instances as the original, so a change to one of them shows up in both entities. Besides direct calls, this happens to every entity cloned through BlockRecord, Insert and Dimension.

The list now starts empty, with the original count as capacity, so it holds only the clones. On the DWG files with proxy graphics I tried, the cloned entities now have the same number of geometries as the originals, of the same types and in the same order, and none of them is shared with the original. The test suite passes.

@DomCR DomCR added bug Something isn't working minor Updates the minor version on merge. labels Oct 19, 2026
Comment thread src/ACadSharp/Entities/Entity.cs Outdated
@DomCR
DomCR merged commit fddbc55 into DomCR:master Oct 19, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working minor Updates the minor version on merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants