.NET

Reply
Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 1 of 6 (307 Views)

Updating drawing/database after modifying it.

307 Views, 5 Replies
06-30-2012 04:35 AM

Hello Forum,

 

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?

 

Thank you.

 

 

Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 2 of 6 (280 Views)

Re: Updating drawing/database after modifying it.

07-01-2012 10:14 AM in reply to: Ertqwa

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:
http://through-the-interface.typepad.com/through_the_interface/2007/04/adding_a_new_an.html

2. Making AutoCAD objects annotative using .NET:
http://through-the-interface.typepad.com/through_the_interface/2007/04/making_autocad_.html

3. Deleting unused annotation scales in AutoCAD using .NET:
http://through-the-interface.typepad.com/through_the_interface/2008/05/deleting-unused.html

4. Delete "all but current" Annotation Scales on AutoCAD objects using .NET:
http://through-the-interface.typepad.com/through_the_interface/2011/10/delete-all-but-current-annota...

5. Using the .NET API to add a scale to a drawing:
http://adndevblog.typepad.com/autocad/2012/05/using-the-net-api-to-add-a-scale-to-a-drawing.html

6. Annotation scale being used in Model Space:
http://adndevblog.typepad.com/autocad/2012/05/annotation-scale-being-used-in-model-space.html

 

Art

Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 3 of 6 (255 Views)

Re: Updating drawing/database after modifying it.

07-03-2012 01:03 PM in reply to: Artvegas

Hi,

 

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.

Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 4 of 6 (239 Views)

Re: Updating drawing/database after modifying it.

07-04-2012 12:05 AM in reply to: Ertqwa
I'm not sure how you could refresh the database without programatically closing and reopening the drawing. If you post a sample drawing and code I'd be happy to take a closer look. Art
Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 5 of 6 (224 Views)

Re: Updating drawing/database after modifying it.

07-05-2012 12:08 PM in reply to: Artvegas

Hi,

 

try the following to simulate my problem:

 

Start a new drawing with annoscales: 1:1/1:2/1:4.

Remove everything from the layouts.

Goto modelspace.
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...


Distinguished Contributor
Artvegas
Posts: 104
Registered: ‎04-21-2011
Message 6 of 6 (196 Views)

Re: Updating drawing/database after modifying it.

07-09-2012 06:30 AM in reply to: Ertqwa

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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!