当前位置: 首页>>代码示例>>C#>>正文


C# Group.InsertAt方法代码示例

本文整理汇总了C#中Group.InsertAt方法的典型用法代码示例。如果您正苦于以下问题:C# Group.InsertAt方法的具体用法?C# Group.InsertAt怎么用?C# Group.InsertAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group.InsertAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addGroup

        /// <summary>
        /// <para>Add a group to the current autocad document</para>
        /// <para>Return: Group</para>
        /// </summary>
        /// <param name="name">Group name</param>
        /// <param name="DbObjs">Object Collection to associate with group</param>
        /// <param name="autorename"><para>if a group has already the specified name</para>
        /// <para>This let the function assign an unique generated name</para></param>
        /// <returns></returns>
        public ObjectId addGroup(string name, DBObjectCollection DbObjs, bool autorename)
        {
            Group grp = new Group(name, true);
            ObjectIdCollection ids = new ObjectIdCollection();

            start_Transaction();
            DBDictionary gd = openGroupDictionary(OpenMode.ForWrite);
            if (gd.Contains(name))
            {
                if (autorename)
                {
                    name = name + "_" + Guid.NewGuid().ToString();
                }
                else
                {
                    return ObjectId.Null;
                }
            }
            gd.SetAt(name, grp);
            AC_Tr.AddNewlyCreatedDBObject(grp, true);

            openBlockTables(OpenMode.ForRead, OpenMode.ForWrite);
            foreach (Entity ent in DbObjs)
            {
                ObjectId id = Commit(ent);
                ids.Add(id);
            }
            grp.InsertAt(0, ids);
            gd.Dispose();
            Dispose();

            return grp.ObjectId;
        }
开发者ID:darkimage,项目名称:autocad-arx,代码行数:42,代码来源:AC_Transations.cs

示例2: createGroup

 // Group objects
 // <param name="idCol"></param>
 // <param name="groupName"></param>
 // <returns>id of group object</returns>
 public static ObjectId createGroup(ObjectIdCollection idCol, String groupName)
 {
     ObjectId groupId;
     Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
     Database db = doc.Database;
     Editor ed = doc.Editor;
     Transaction tr = db.TransactionManager.StartTransaction();
     using (tr)
     {
         DBDictionary gd = (DBDictionary)tr.GetObject(db.GroupDictionaryId,
                             OpenMode.ForRead);
         Group group = new Group("my group", true);
         gd.UpgradeOpen();
         ObjectId grpId = gd.SetAt(groupName, group);
         tr.AddNewlyCreatedDBObject(group, true);
         BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
         btr.AssumeOwnershipOf(idCol);
         group.InsertAt(0, idCol);
         tr.Commit();
         tr.Dispose();
         groupId = grpId;
     }
     return groupId;
 }
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:28,代码来源:Utility.cs


注:本文中的Group.InsertAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。