IDocument Interface Reference

A wrapper for acad document interface. More...

List of all members.

Public Member Functions

void SendCommand (string name)
 Sends an acad command to the document using Autodesk.AutoCAD.DatabaseServices.Document.SendStringToExecute().

Properties

IApplication Application
 Application, parent.
IElementsCollection Elements
 Elements collection.
Adb.TransactionManager TransactionManager
 TransactionManager of Autodesk.AutoCAD.DatabaseServices.Document.
ModifiedBufferingMode ModifiedBuffering
 Modified object buffering in the document mode.
ICollection< Adb.ObjectId > ModifiedQueue
 A reference to the document modifeied objects buffer.
ILayersCollection Layers
 Layers collection.
ILayoutsCollection Layouts
 Layouts collection.
event BufferModifiedHandler BufferModified
 An event indicating some changes in the document.


Detailed Description

A wrapper for acad document interface.

It wraps Autodesk.AutoCAD.Interop.AcadDocument and Autodesk.AutoCAD.DatabaseServices.Document classes. A reference to this interface related to some document is unique (i.e. can be cached by a client). It can be accessed from IApplication.Documents collection. It has a key - full name of the document file. It contains a collections of the layers, layouts and objects (elements) in it. It allows an arbitrary set of named persisent properties to be associated with it.

This example shows how to attach a named property to a document. Note: to get this example working in acad there should be an application loader defined as shown in ApplicationLoader usage comments.

---usings
            using Acmx.Acad.Connectivity.Public.Interfaces.ApplicationModel;
            using Acmx.Acad.Connectivity.Public.Classes.ApplicationModel;
            using Autodesk.AutoCAD.Runtime;
                using Adb = Autodesk.AutoCAD.DatabaseServices;
---declaring a serializable class
            [Serializable]
            public class CustomDocumentProperty
            {
                        public string s;
                        public int[] i =new int[]{0,1,2,3};
                        public static CustomDocumentProperty DefaultValue
                        {
                                get
                                {
                                        return new CustomDocumentProperty();
                                }
                        }
            }
---setting and getting the instance of the class as an acad document property
            public class A
                {
---command method declaration
                        [CommandMethodAttribute("ACMX_TESTS", "DOCPROP", CommandFlags.Transparent)]
                        public static void Mmm()
                        {
                                IApplication iapp =ApplicationProvider.Instance.Get();
                                IDocument idoc =iapp.Documents.ActiveDocument;
                                string PROP_NAME ="jjj";
                                CustomDocumentProperty prop =new CustomDocumentProperty();
                                prop.s ="xbz";
---setting a document property in a transaction
                                using (Adb.Transaction ta = idoc.TransactionManager.StartTransaction())
                                {
                                        idoc.SetProperty(PROP_NAME, prop);
                                        ta.Commit();
                                }
---prop1 will be filled with the stored property or if any error with CustomDocumentProperty.DefaultValue.
                                CustomDocumentProperty prop1 = (CustomDocumentProperty)idoc.GetProperty(PROP_NAME, CustomDocumentProperty.DefaultValue);
                        }
            }


Member Function Documentation

void SendCommand string  name  ) 
 

Sends an acad command to the document using Autodesk.AutoCAD.DatabaseServices.Document.SendStringToExecute().

Parameters:
name command


Property Documentation

IApplication Application [get]
 

Application, parent.

IElementsCollection Elements [get]
 

Elements collection.

Each its element is an acad object wrapper. Elements are accessed by the keys - their object ids. Elements are unique, i.e. it references can be cached by a client along a work session.

Adb.TransactionManager TransactionManager [get]
 

TransactionManager of Autodesk.AutoCAD.DatabaseServices.Document.

ModifiedBufferingMode ModifiedBuffering [get, set]
 

Modified object buffering in the document mode.

It can be set to one of ModifiedBufferingMode values and thus affects to the BufferModified event emit.

ICollection<Adb.ObjectId> ModifiedQueue [get]
 

A reference to the document modifeied objects buffer.

Generally it should be used in a BufferModified event handler. It contains object ids for the objects which are modified since the last BufferModified event emit.

ILayersCollection Layers [get]
 

Layers collection.

It contains all layer wrappers for the document.

ILayoutsCollection Layouts [get]
 

Layouts collection.

It contains all layout wrappers for the document.

event BufferModifiedHandler BufferModified
 

An event indicating some changes in the document.

It is emitted according to the document ModifiedBuffering mode.


Generated on Sun May 28 08:56:23 2006 for Acmx.AcadConnectivity documentation by  doxygen 1.4.5