当前位置:网站首页>2021-07-17c /cad secondary development creation circle (5)
2021-07-17c /cad secondary development creation circle (5)
2022-07-02 06:59:00 【Xu Jirong】
Circle c1 = new Circle();
c1.Center = new Point3d(50, 50, 0);
c1.Radius = 50;
Circle c2 = new Circle(new Point3d(100, 100, 0), new Vector3d(0, 0, 1), 50);
Create a class of circles Circle There are two methods above :
Through the first Circle Create an object , Then give him the center 、 Radius assignment
Or assign values directly when creating .
Drawing a circle is the same as an arc , Package to AddEnityTool.ca The code is as follows
/// <summary>
/// Draw the circle
/// </summary>
/// <param name="db"> Graphic database </param>
/// <param name="center"> center of a circle </param>
/// <param name="radius"> radius </param>
/// <returns></returns>
public static ObjectId AddCircleModelSpace(Database db, Point3d center, double radius)
{
return AddEnityTool.AddEnityToModelSpace(db, new Circle(center, new Vector3d(0, 0, 1), radius));
}
/// <summary>
/// Draw a circle at two points
/// </summary>
/// <param name="db"> Graphic database </param>
/// <param name="point1"> The first point </param>
/// <param name="point2"> Second points </param>
/// <returns>ObjectId</returns>
public static ObjectId AddCircleModelSpace(Database db, Point3d point1, Point3d point2)
{
// Get the center point
Point3d center = BaseTool.GetCenterPointBetweenTwoPoint(point1, point2);
// Get the radius
double radius = BaseTool.GetDistanceBetweenTwoPoint(point1, center);
return AddEnityTool.AddCircleModelSpace(db, center, radius);
}
/// <summary>
/// Three point drawing circle
/// </summary>
/// <param name="db"> Graphic database </param>
/// <param name="point1"> The first point </param>
/// <param name="point2"> Second points </param>
/// <param name="point3"> The third point </param>
/// <returns>ObjectId</returns>
public static ObjectId AddCircleModelSpace(Database db, Point3d point1, Point3d point2, Point3d point3)
{
// First judge whether the three points are on the same straight line
if (BaseTool.IsOnOneLine(point1, point2, point3))
{
return ObjectId.Null;
}
// Declare the geometry class CircularArc3d object
CircularArc3d cArc = new CircularArc3d(point1, point2, point3);
return AddEnityTool.AddCircleModelSpace(db, cArc.Center, cArc.Radius);
}
}
}
边栏推荐
- AWD learning
- JS to determine whether there is a value in the object in the array
- Implement strstr() II
- table 组件指定列合并行方法
- Differences between ts and JS
- Eslint configuration code auto format
- 2021-07-17C#/CAD二次开发创建圆(5)
- Win10: add or delete boot items, and add user-defined boot files to boot items
- Redis -- cache breakdown, penetration, avalanche
- 如何调试微信内置浏览器应用(企业号、公众号、订阅号)
猜你喜欢

IDEA2020中PySpark的两表关联(字段名相同)

Apt command reports certificate error certificate verification failed: the certificate is not trusted

Solve the problem of bindchange event jitter of swiper component of wechat applet

Go package name

Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved

table 组件指定列合并行方法

PgSQL learning notes

Vscode installation, latex environment, parameter configuration, common problem solving

Latex error: the font size command \normalsize is not defined problem solved

SQL注入闭合判断
随机推荐
PHP Session原理简析
搭建frp进行内网穿透
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
Promise中有resolve和无resolve的代码执行顺序
Atcoder beginer contest 253 F - operations on a matrix / / tree array
JS judge whether the object is empty
A preliminary study on ant group G6
Sqli-labs customs clearance (less15-less17)
js的防抖和节流
JS to determine whether there is a value in the object in the array
SQLI-LABS通关(less6-less14)
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
Win10: add or delete boot items, and add user-defined boot files to boot items
MySQL index
JS divides an array into groups of three
Flask migrate cannot detect db String() equal length change
The use of regular expressions in JS
Usage of map and foreach in JS
php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
Common function writing method and set get writing method for calculating attributes