Skip to content

Proposed fixes for #672 #673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mme1950
Copy link
Contributor

@mme1950 mme1950 commented May 15, 2025

see #672.

mme1950 added 3 commits May 9, 2025 18:57
-  setter of dimension Block adds new BlockRecord with unique name.
-  Block property writes handle.
@@ -280,5 +283,35 @@ protected override void tableOnRemove(object sender, CollectionChangedEventArgs
this._block = null;
}
}


private void addToBlockRecordsTable(BlockRecord block)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's a good practice to make changes to an object that is not managed by the library itself, I would suggest to keep the old method updateTable and add a guard that check that the block has the flag anonymous set.

If the naming of the block is an issue for any software, we can add a method that specifically changes the block name to a unique one for the current dimension, or a method in the CadDocument that updates the name for all anonymous blocks.

Copy link
Contributor Author

@mme1950 mme1950 May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the uniqueness of the name is essential for ACadSharp.
updateTable tries to find a BlockRecord with the same name and returns the existing one so that the new one is to be discarded. We have to ensure that the new one is kept - with a new name.

Example:
I cloned Dimension objects from various source DWGs to a new document. They accidenially had the same "*D..." names. Effectively I had more than one Dimension object that were completely different referencing the same BlockRecord.

@DomCR DomCR linked an issue May 15, 2025 that may be closed by this pull request
@DomCR DomCR added the bug Something isn't working label May 15, 2025
@DomCR DomCR mentioned this pull request May 15, 2025
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dimension Anonymous Block:
2 participants