IElement Interface Reference

An element interface. More...

List of all members.

Public Member Functions

DBObject GetObject (OpenMode mode)
 Returns an opened acad object.


IApplication Application
IDocument Document
bool IsAccessible
 Returns true if the related acad ObjectId is not null, not erased and valid in the terms of ObjectId.isValid() method.

Detailed Description

An element interface.

Element is an arbitrary acad object wrapper. It has a key - ObjectId of its acad object. Elements are accessible from IDocument.Elements collection. A reference to the element related to some acad object is unique (i.e. can be cached by a client). It allows an arbitrary set of named persisent properties to be associated with it.

This example shows how to attach a named property to an element.

            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
            public class CustomElementProperty
                        public string s;
                        public int[] i =new int[]{0,1,2,3};
                        public static CustomElementProperty DefaultValue
                                        return new CustomElementProperty();
---setting and getting the instance of the class as an acad object property
            public class A
---command method declaration
                        [CommandMethodAttribute("ACMX_TESTS", "ELPROP", CommandFlags.Transparent)]
                        public static void Mmm()
                                IApplication iapp =ApplicationProvider.Instance.Get();
                                IDocument idoc =iapp.Documents.ActiveDocument;
                                object aent;
                                object ppoint;
                                idoc.Adaptee.Utility.GetEntity(out aent, out ppoint, "pick object:");
                                IElement ielt =idoc.Elements.Get(new Adb.ObjectId(((IAcadObject)aent).ObjectID));               
                                string PROP_NAME ="jjj";
                                CustomElementProperty prop =new CustomElementProperty();
                                prop.s ="xbz";
---setting an element property in a transaction
                                using (Adb.Transaction ta = idoc.TransactionManager.StartTransaction())
                                        ielt.SetProperty(PROP_NAME, prop);
---prop1 will be filled with the stored property or if any error with CustomElementProperty.DefaultValue.
                                CustomElementProperty prop1 = (CustomElementProperty)ielt.GetProperty(PROP_NAME, CustomElementProperty.DefaultValue);

Member Function Documentation

DBObject GetObject OpenMode  mode  ) 

Returns an opened acad object.

This call should be used in 'using' block.


Property Documentation

IApplication Application [get]


IDocument Document [get]


bool IsAccessible [get]

Returns true if the related acad ObjectId is not null, not erased and valid in the terms of ObjectId.isValid() method.

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