Public Member Functions | |
DBObject | GetObject (OpenMode mode) |
Returns an opened acad object. | |
Properties | |
IApplication | Application |
Application. | |
IDocument | Document |
Document. | |
bool | IsAccessible |
Returns true if the related acad ObjectId is not null, not erased and valid in the terms of ObjectId.isValid() method. |
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.
---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 CustomElementProperty { public string s; public int[] i =new int[]{0,1,2,3}; public static CustomElementProperty DefaultValue { get { 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); ta.Commit(); } ---prop1 will be filled with the stored property or if any error with CustomElementProperty.DefaultValue. CustomElementProperty prop1 = (CustomElementProperty)ielt.GetProperty(PROP_NAME, CustomElementProperty.DefaultValue); } }
|
Returns an opened acad object. This call should be used in 'using' block.
|
|
Application.
|
|
Document.
|
|
Returns true if the related acad ObjectId is not null, not erased and valid in the terms of ObjectId.isValid() method.
|