当前位置:网站首页>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);
}
}
}
边栏推荐
- php中树形结构转数组(拉平树结构,保留上下级排序)
- PIP install
- Anti shake and throttling of JS
- SQLI-LABS通关(less15-less17)
- uniapp引入本地字体
- 搭建frp进行内网穿透
- CAD二次开发 对象
- JS to determine whether there is a value in the object in the array
- Record RDS troubleshooting once -- RDS capacity increases dramatically
- No process runs when querying GPU, but the video memory is occupied
猜你喜欢

Sublime text configuring PHP compilation environment

In depth study of JVM bottom layer (IV): class file structure

AWD learning

SQLI-LABS通关(less6-less14)

Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence

sqli-labs通关汇总-page4

Sentry construction and use

Sentry搭建和使用

Basic knowledge of software testing

The use of regular expressions in JS
随机推荐
uniapp引入本地字体
sqli-labs通关汇总-page3
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
js判断对象是否为空
Self study table Au
SQLI-LABS通关(less15-less17)
CVE-2015-1635(MS15-034 )遠程代碼執行漏洞複現
Flask migrate cannot detect db String() equal length change
Browser scrolling for more implementations
php中时间戳转换为毫秒以及格式化时间
CTF web practice competition
SQLI-LABS通關(less6-less14)
VSCODE 安装LATEX环境,参数配置,常见问题解决
How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
sqli-labs通關匯總-page2
pm2简单使用和守护进程
JS delete the last bit of the string
In depth study of JVM bottom layer (V): class loading mechanism
php中计算两个日期之前相差多少天、月、年
JS judge whether the object is empty