import { MrxDbgUiPrPoint, MxFun, McEdGetPointWorldDrawObject, } from "mxdraw"
const drawCircleAtThreePoints = async () => {
const getPoint = new MrxDbgUiPrPoint();
const circle = new MxDbCircle();
let points = [] as unknown as [THREE.Vector3, THREE.Vector3, THREE.Vector3]
points.push(await getPoint.go())
getPoint.setUserDraw((currentPoint, pWorldDraw) => {
pWorldDraw.drawLine(points[0], currentPoint)
})
points.push(await getPoint.go())
getPoint.setUserDraw(
(
currentPoint: THREE.Vector3,
pWorldDraw: McEdGetPointWorldDrawObject
)=> {
circle.center = threePointsToDetermineTheCenterOfTheCircle([points[0], points[1], currentPoint])
circle.radius = circle.center.distanceTo(currentPoint)
pWorldDraw.drawCustomEntity(circle);
}
);
points.push(await getPoint.go())
circle.center = threePointsToDetermineTheCenterOfTheCircle(points);
circle.radius = circle.center.distanceTo(points[0]);
MxFun.getCurrentDraw().addMxEntity(circle);
}
drawCircleAtThreePoints()效果图如下:

文章插图

文章插图
Demo源码:
https://gitee.com/mxcadx/mxdraw-article/tree/master/mxdraw%E5%BA%93%E5%AE%9E%E7%8E%B0autocad%E4%B8%AD%E7%9A%84%E5%9C%86
推荐阅读
- 谷歌的Project IDX会扼杀其他应用程序开发框架吗?
- CPU眼里的:堆和栈
- 一个很强大,但用在接口参数和返回结果,会造成灾难性后果的C#语法
- 你每天用来打卡的钉钉,居然藏着「ChatGPT」「Midjourney」和「Notion」
- 每个程序员都应该了解的延迟指标
- 虚拟线程在SpringBoot中的应用
- JSX是Vue前端开发的未来吗?
- 什么是DNS域名劫持?
- 鸿蒙元服务开发实例:桌面卡片上的电动自行车助手E-Bike
- 2023 年值得考虑的10大 React 静态站点生成器!
