本文整理汇总了C#中System.Line.SetDatabaseDefaults方法的典型用法代码示例。如果您正苦于以下问题:C# Line.SetDatabaseDefaults方法的具体用法?C# Line.SetDatabaseDefaults怎么用?C# Line.SetDatabaseDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Line
的用法示例。
在下文中一共展示了Line.SetDatabaseDefaults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testLine
public static void testLine ()
{
List<point> points = new List<point> ();
points.Add (new point (0, 0));
points.Add (new point (0, 10));
points.Add (new point (10, 10));
points.Add (new point (10, 0));
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.CurrentDocument;
Database acCurDb = acDoc.Database;
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction ()) {
// Отваряне на блок таблицата за четене
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;
// Отваряне на модела на блок таблицата за писсане
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
foreach (point _p in points) {
// Създаване на линия с координати
Line acLine = new Line(new Point3d(_p.x, _p.y, 0), new Point3d(0, 0, 0));
acLine.SetDatabaseDefaults();
// Добавяне на линията
acBlkTblRec.AppendEntity(acLine);
acTrans.AddNewlyCreatedDBObject(acLine, true);
}
// // Създаване на линия с координати
// Line acLine = new Line(new Point3d(5, 5, 0), new Point3d(12, 3, 0));
// acLine.SetDatabaseDefaults();
//
// // Добавяне на линията
// acBlkTblRec.AppendEntity(acLine);
// acTrans.AddNewlyCreatedDBObject(acLine, true);
// Запазване на прмените
acTrans.Commit();
}
}
示例2: Create
public static DBObject Create(this Grevit.Types.Line l, Transaction tr)
{
LayerTable lt = (LayerTable)tr.GetObject(Command.Database.LayerTableId, OpenMode.ForRead);
try
{
Line line = new Line(l.from.ToPoint3d(), l.to.ToPoint3d());
line.SetDatabaseDefaults(Command.Database);
BlockTable bt = (BlockTable)tr.GetObject(Command.Database.BlockTableId, OpenMode.ForRead);
BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
if (lt.Has(l.TypeOrLayer)) line.LayerId = lt[l.TypeOrLayer];
ms.AppendEntity(line);
tr.AddNewlyCreatedDBObject(line, true);
return line;
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
}
return null;
}
示例3: Create
public static void Create(Grevit.Types.Line l)
{
Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
Transaction tr = db.TransactionManager.StartTransaction();
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
try
{
Line line = new Line(GrevitPtoPoint3d(l.from), GrevitPtoPoint3d(l.to));
line.SetDatabaseDefaults(db);
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
AddXData(l, line);
if (lt.Has(l.TypeOrLayer)) line.LayerId = lt[l.TypeOrLayer];
ms.AppendEntity(line);
tr.AddNewlyCreatedDBObject(line, true);
writeProperties(line, l.parameters, tr);
storeID(l, line.Id);
tr.Commit();
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
ed.WriteMessage(e.Message);
tr.Abort();
}
finally
{
tr.Dispose();
}
}