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


C# Line.SetDatabaseDefaults方法代码示例

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

		}
开发者ID:vhitrov,项目名称:Primeri.CSharp.Interop-1,代码行数:49,代码来源:MyClass.cs

示例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;

        }
开发者ID:samuto,项目名称:Grevit,代码行数:28,代码来源:CreateExtension.cs

示例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();
            }
        }
开发者ID:bbrangeo,项目名称:Grevit,代码行数:38,代码来源:CreateExtension.cs


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