I have written a command that replaces the given annotative scale of all objects in a drawing, with another annotative scale. Works great, except I can't remove the replaced annotative scale (with SCALELISTEDIT - DELETE button), unless I save the drawing and then open it again.
An annotative scale that is in use, can't be deleted. But since I can delete it after reopening the drawing, I am sure it is not in use anymore.
Is there a way to "refresh" the drawing/database, without reopening it?
Did you set the Database.Cannoscale property to one of your new scales? I would have thought you could then erase the unused scale.
Have you looked into any of the following posts? Numbers 3 and 4 might be helpful.
1. Adding a new annotation scale in AutoCAD using .NET:
2. Making AutoCAD objects annotative using .NET:
3. Deleting unused annotation scales in AutoCAD using .NET:
4. Delete "all but current" Annotation Scales on AutoCAD objects using .NET:
5. Using the .NET API to add a scale to a drawing:
6. Annotation scale being used in Model Space:
yes I am not trying to delete the current annotation scale.
I've looked at the links (very interesting ty), but haven't found anything yet to solve my problem. I've litterally copied the command from article 3 (Deleting unused annotation scales), and the same problem happens.
- I replace old scale with new scale.
- Command from article 3 can not remove old scale.
- Save and reopen.
- Command from article 3 can remove old scale.
This does not happen with all drawings and/or annotative scales. Some can be removed without saving and reopening.
Thank you for your response.
try the following to simulate my problem:
Start a new drawing with annoscales: 1:1/1:2/1:4.
Remove everything from the layouts.
Set annoscale to 1:2.
Draw a rectangle.
Fill rectangle with annotative hatch (1:2).
Create a NON-ANNOTATIVE block from the rectangle+hatch called test.
Set the current annotative scale to 1:4 (IMPORTANT).
Save and reopen the drawing. Now change the current annotative scale
to 1:1. The scale 1:4 is no longer in use by anything, so you should
be able to delete it, but you can't. At least, I can't (on 2 different systems with AutoCAD2009).
But If I set the current annotative scale to 1:1, save and reopen, I
suddenly can remove the 1:4...
I see what you mean. This appears to me to be an internal AutoCAD issue (perhaps even a bug) rather than an issue with the .NET API. Sorry I can't think of anything to help you with this one.