ILayer Interface Reference

An acad layer wrapper interface. More...

List of all members.

Properties

IDocument Document
 Document.
ILayersCollection Layers
 Layers collection, parent.
IElement Element
 Layer element, that is AcDbLayerTableRecord acad object wrapper.
string Name
 Layer name.


Detailed Description

An acad layer wrapper interface.

It wraps Autodesk.AutoCAD.Interop.Common.AcadLayer class. It has a key - ObjectId of its acad layer object. 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 layer.

---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 CustomLayerProperty
            {
                        public string s;
                        public int[] i =new int[]{0,1,2,3};
                        public static CustomLayerProperty DefaultValue
                        {
                                get
                                {
                                        return new CustomLayerProperty();
                                }
                        }
            }
---setting and getting the instance of the class as an acad layer property
            public class A
                {
                        [CommandMethodAttribute("ACMX_TESTS", "LRPROP", CommandFlags.Transparent)]
                        public static void Mmm()
                        {
                                IApplication iapp =ApplicationProvider.Instance.Get();
                                IDocument idoc =iapp.Documents.ActiveDocument;
                                ILayer ilr =idoc.Layers.LayerZero;
                                string PROP_NAME ="jjj";
                                CustomLayerProperty prop =new CustomLayerProperty();
                                prop.s ="xbz";
---setting a layer property in a transaction
                                using (Adb.Transaction ta = idoc.TransactionManager.StartTransaction())
                                {
                                        ilr.SetProperty(PROP_NAME, prop);
                                        ta.Commit();
                                }
---prop1 will be filled with the stored property or if any error with CustomLayerProperty.DefaultValue.
                                CustomLayerProperty prop1 = (CustomLayerProperty)ilr.GetProperty(PROP_NAME, CustomLayerProperty.DefaultValue);
                        }
            }


Property Documentation

IDocument Document [get]
 

Document.

ILayersCollection Layers [get]
 

Layers collection, parent.

IElement Element [get]
 

Layer element, that is AcDbLayerTableRecord acad object wrapper.

string Name [get]
 

Layer name.


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