.NET

Reply
Active Member
MiDu75
Posts: 7
Registered: ‎11-12-2012
Message 1 of 6 (244 Views)
Accepted Solution

Getting Saving Settings.

244 Views, 5 Replies
02-21-2013 05:15 AM

Hi there,

@The moment i am trying to get the saveAs settings that were used when the user hits the save/saveAs button in autocad.

My addin needs to store the current document with these settings. i dont want to use some pop-up dialog.

The .currentVersion property saves the document with the applicationversions standard saveprofile.

I need some kind of property that reflects the users saveAs settings.

Is there any way getting those information via the .net api without doing the interop stuff?

 

thank you

Moderator
Alexander.Rivilis
Posts: 1,388
Registered: ‎04-09-2008
Message 2 of 6 (224 Views)

Re: Getting Saving Settings.

02-21-2013 07:09 AM in reply to: MiDu75

If you mean the current format for save, then, for example:

[CommandMethod("DefForSave")]
public static void DefForSave()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Editor ed = doc.Editor;
  object acadObject = Application.AcadApplication;
  object preferences  = acadObject.GetType().InvokeMember("Preferences", 
    BindingFlags.GetProperty, null, acadObject, null);
  object prefOpenSave = preferences.GetType().InvokeMember("OpenSave", 
    BindingFlags.GetProperty, null, preferences, null);
  object dwgversion = prefOpenSave.GetType().InvokeMember("SaveAsType", 
    BindingFlags.GetProperty, null, prefOpenSave, null);
  ed.WriteMessage("\nDefault Format For Save= {0}", dwgversion);
}

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
MiDu75
Posts: 7
Registered: ‎11-12-2012
Message 3 of 6 (216 Views)

Re: Getting Saving Settings.

02-21-2013 07:50 AM in reply to: Alexander.Rivilis

Thank you very much for your quick answer Alexander,

i am getting an integer value.

unfortuntley i cannot just use this value within the saveAs method of my document.

 

i get the following values

DWG2010: 48

DWG2007: 36

DWG2000: 12

 

is there any mapping-Table ? do i have to map it myself?

Moderator
Alexander.Rivilis
Posts: 1,388
Registered: ‎04-09-2008
Message 4 of 6 (214 Views)

Re: Getting Saving Settings.

02-21-2013 07:52 AM in reply to: MiDu75

MiDu75 wrote:

Thank you very much for your quick answer Alexander,

i am getting an integer value.

unfortuntley i cannot just use this value within the saveAs method of my document.

 

i get the following values

DWG2010: 48

DWG2007: 36

DWG2000: 12

 

is there any mapping-Table ? do i have to map it myself?


But you can use this value with AcadDocument.SaveAs method:

object adoc = doc.AcadDocument;
object [] parms = new object[2];
parms[0] = doc.Name; parms[1] = dwgversion;
adoc.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod, null, adoc, parms);

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
MiDu75
Posts: 7
Registered: ‎11-12-2012
Message 5 of 6 (189 Views)

Re: Getting Saving Settings.

02-21-2013 11:53 PM in reply to: Alexander.Rivilis

Good morning Alexander.

 

Your suggestions where just perfect. Exactly what i was looking for. Thank you very much.

Is there any documentation about the invokemembers and its parameters for ACAD2012/13?

 

For the rest of this thread it can be closed. 5-Stars-Rating. :smileyvery-happy:

Moderator
Alexander.Rivilis
Posts: 1,388
Registered: ‎04-09-2008
Message 6 of 6 (181 Views)

Re: Getting Saving Settings.

02-22-2013 02:12 AM in reply to: MiDu75

InvokeMember is a method of type System.Type (part of Reflection)

AcadDocument, AcadPreferences, etc. are classes from AutoCAD ActiveX API

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community