本文整理汇总了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;
}
示例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;
}