本文整理汇总了C#中Circle.SetDatabaseDefaults方法的典型用法代码示例。如果您正苦于以下问题:C# Circle.SetDatabaseDefaults方法的具体用法?C# Circle.SetDatabaseDefaults怎么用?C# Circle.SetDatabaseDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Circle
的用法示例。
在下文中一共展示了Circle.SetDatabaseDefaults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCircle
public static void AddCircle()
{
// Получение текущего документа и базы данных
Document acDoc = Application.DocumentManager.MdiActiveDocument;
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;
// Создание круга в точке 2,3 с радиусм 4.25
Circle acCirc = new Circle();
acCirc.SetDatabaseDefaults();
acCirc.Center = new Point3d(2, 3, 0);
acCirc.Radius = 4.25;
// Добавление нового объекта в запись аблицы блоков и в транзакцию
acBlkTblRec.AppendEntity(acCirc);
acTrans.AddNewlyCreatedDBObject(acCirc, true);
// Сохранение нового объекта в базе данных
acTrans.Commit();
}
}
示例2: CreateCircle
/// <summary>
/// Create a circle based on the center-point and color provided. We're
/// also going to require a count. This count represents the number of
/// circles that have already been created. With this, we can scale the
/// circle accordingly such that each circle is smaller than the previous.
/// </summary>
/// <param name="count">Number of circles already created</param>
/// <param name="center">Center-Point for circle</param>
/// <param name="color">Color of the circle</param>
/// <returns>Created circle to store in DB</returns>
private static Circle CreateCircle(int count, Point3d center, Color color)
{
var circle = new Circle();
circle.SetDatabaseDefaults();
circle.Center = center;
circle.Radius = (1 - (count * REDUCTION_RATIO)) * INITIAL_RADIUS;
circle.Color = color;
return circle;
}
示例3: GetConcentricCircles
/// <summary>
/// Generates a <see cref="IEnumerable{T}"/> of <see cref="Circle"/>
/// </summary>
/// <returns><see cref="IEnumerable{T}"/></returns>
private static IEnumerable<Circle> GetConcentricCircles(int numberOfCircles, Database database)
{
var centerForCircles = new Point3d(0.0, 0.0, 0.0);
var normal = new Vector3d(0.0, 0.0, 1.0);
for (var i = 0; i < numberOfCircles; i++)
{
var circle = new Circle(centerForCircles, normal, 2.0*(i + 1));
circle.SetDatabaseDefaults(database); // not 100% necessary but better safe than sorry
var color = GetColorFromUser();
// Check if user hit cancel on the color dialog box, set a default if so
circle.Color = color ?? Color.FromRgb(255, 255, 255);
yield return circle;
}
}