Ejemplo n.º 1
0
        /// <summary>
        /// <para>open a Group in the current Autocad Document</para>
        /// <para>Warning: Remember to dispose the Trasanction with AC_Transaction.end_Transaction</para>
        /// <para>Return:</para> <para>Null (if nothing found)</para> <para>Group (if the group name was found)</para>
        /// </summary>
        /// <param name="groupId">Name of the group to search</param>
        /// <param name="mode"> Specific mode for open the group</param>
        /// <returns></returns>
        public Group openGroup(ObjectId groupId, OpenMode mode)
        {
            start_Transaction();
            DBDictionary gd = openGroupDictionary(OpenMode.ForWrite);

            if (gd.Contains(groupId))
            {
                return(AC_Tr.GetObject(groupId, mode) as Group);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// <para>This Function let you open a object with the mode u specify.</para>
 /// <para>Return:</para><para> Null (if nothing was found)</para> <para>Entity (if there is a successful found)</para>
 /// <para>Warning: Remember to dispose the transaction with AC_Transaction.Dispose()</para>
 /// </summary>
 /// <param name="ObjId">The id of the object to open</param>
 /// <param name="mode"> specify the openmode of the object</param>
 /// <returns>null if no object was found, Entity for a succefull found</returns>
 public Entity openObject(ObjectId ObjId, OpenMode mode)
 {
     start_Transaction();
     openBlockTables(OpenMode.ForRead, OpenMode.ForRead);
     foreach (ObjectId id in AC_blockTableRecord)
     {
         if (ObjId == id)
         {
             Entity ent = AC_Tr.GetObject(id, mode) as Entity;
             return(ent);
         }
     }
     Dispose();
     return(null);
 }
Ejemplo n.º 3
0
        public ObjectIdCollection getAllObjectsWithDic(string searchPath)
        {
            ObjectIdCollection objs = new ObjectIdCollection();

            start_Transaction();
            AC_Db = AC_Doc.Database;
            openBlockTables(OpenMode.ForRead, OpenMode.ForRead);
            foreach (ObjectId id in AC_blockTableRecord)
            {
                DBObject dbObj = AC_Tr.GetObject(id, OpenMode.ForRead) as DBObject;
                ObjectId dic   = dbObj.ExtensionDictionary;
                if (dic != ObjectId.Null)
                {
                    DBDictionary dbDic = (DBDictionary)AC_Tr.GetObject(dic, OpenMode.ForRead);
                    if (dbDic.Contains(searchPath))
                    {
                        objs.Add(id);
                    }
                }
            }
            AC_Tr.Dispose();
            return(objs);
        }
Ejemplo n.º 4
0
 public DBDictionary openGroupDictionary(OpenMode mode)
 {
     return(AC_GroupDictionary = (DBDictionary)AC_Tr.GetObject(AC_Db.GroupDictionaryId, mode));
 }