open drawing, zoom all, save drawing with new name.

open drawing, zoom all, save drawing with new name.

ynapeu
Advocate Advocate
801 Views
5 Replies
Message 1 of 6

open drawing, zoom all, save drawing with new name.

ynapeu
Advocate
Advocate

i have a lot of drawings.

i will open the drawing, i will make a zoom all and save it with a new name.

i have written a small example, but it doesn't work.

0 Likes
Accepted solutions (1)
802 Views
5 Replies
Replies (5)
Message 2 of 6

ActivistInvestor
Mentor
Mentor

This post and the file attached to it show one way to do batch processing of drawing files. The included example code opens each file, switches to the model tab, zooms to the extents, and then saves the file. 

0 Likes
Message 3 of 6

ynapeu
Advocate
Advocate
You mean these lines, unfortunately, 'Foreach' does not exist.
error CS1061: "DocumentCollection"has no Foreach......

Application.DocumentManager.ForEach(ofd.FileNames, delegate(Document doc) { doc.Editor.Command("._TILEMODE", "1"); doc.Editor.Command("._ZOOM", "_E"); doc.Save(); } );
0 Likes
Message 4 of 6

ActivistInvestor
Mentor
Mentor

ForEach is an extension method that is added by the code that is attached to that post. To use it you must add the code file attached to that post to your project. 

0 Likes
Message 5 of 6

ynapeu
Advocate
Advocate
Accepted solution

If one would read the documentation, it would be half as difficult. The center point, height, and width must be specified in DCS coordinates.

0 Likes
Message 6 of 6

ActivistInvestor
Mentor
Mentor

@ynapeu wrote:

If one would read the documentation, it would be half as difficult. The center point, height, and width must be specified in DCS coordinates.


I'm not sure what that has to do with not bothering to read the post I linked to, where it clearly states that the source code needed for the example code in the post was in an attached file.

0 Likes