当前位置:网站首页>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中删除指定文件夹下的内容
- sqli-labs通关汇总-page4
- Uniapp introduces local fonts
- js数组的常用的原型方法
- Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
- CTF web practice competition
- ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
- Promise中有resolve和无resolve的代码执行顺序
- In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
- UEditor .Net版本任意文件上传漏洞复现
猜你喜欢
Uniapp introduces local fonts
In depth study of JVM bottom layer (V): class loading mechanism
sqli-labs通關匯總-page2
Recursion (maze problem, Queen 8 problem)
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
SQLI-LABS通关(less2-less5)
Implement strstr() II
Flex Jiugongge layout
解决微信小程序swiper组件bindchange事件抖动问题
There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
随机推荐
SQLI-LABS通关(less6-less14)
SQLI-LABS通关(less15-less17)
sqli-labs通关汇总-page2
Tool grass welfare post
Sqli-labs customs clearance (less15-less17)
ts和js区别
Automation - when Jenkins pipline executes the nodejs command, it prompts node: command not found
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
Flex Jiugongge layout
PgSQL learning notes
JS judge whether the object is empty
PXC high availability cluster summary
在php的开发环境中如何调取WebService?
Sublime text configuring PHP compilation environment
sqli-labs通關匯總-page2
php中生成随机的6位邀请码
In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy
JS countdown case
Use of interrupt()
2021-07-19C#CAD二次开发创建多线段