Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
Development Lib
>
Common Toolkit
&&
Industrial
>
CAD
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
86
Star
326
Fork
253
InspireFunction
/
IFoxCAD
Code
Issues
25
Pull Requests
7
Wiki
Insights
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
75
完善错误信息提示,增加两点定距等分、点集转直线端点集合ReSetCmds等方法和引用类型以及相关枚举
Closed
云傲崖-忘霄:v0.7
InspireFunction:v0.7
云傲崖-忘霄
create on 2023-08-09 11:05
Clone/Download
HTTPS
SSH
Copy
Email Patch
Diff file
### 相关的Issue ### 原因(目的、解决的问题等) ### 描述(做了什么,变更了什么) 完善错误信息提示, 增加两点定距等分、点集转直线端点集合等方法和引用类型以及枚举 在Tools类里面增加 class UtilToolsEx和ReSetCmds方法 ### 测试用例(新增、改动、可能影响的功能) ``` [CommandMethod(nameof(DivNum))] public void DivNum() => CurveTools.Tools_NumberDivide(true); [CommandMethod(nameof(DivDis))] public void DivDis() => CurveTools.Tools_DistanceDivide(true); /// <summary> /// 指定两点定数等分(含绘制线段) /// </summary> /// <param name="isDrawLine">是否绘制线段</param> public static DivideInfo Tools_NumberDivide(bool isDrawLine = false) { try { using var dloc = Env.Document.LockDocument(); var sppr = Env.Editor.GetPoint("\n拾取【定数等分】起始点"); if (sppr.Status != PromptStatus.OK) return null; var spt = sppr.Value; var ppo = new PromptPointOptions("\n拾取【定数等分】结束点") { AllowNone = true, UseBasePoint = true, BasePoint = spt }; var eppr = Env.Editor.GetPoint(ppo); if (eppr.Status != PromptStatus.OK) return null; var ept = eppr.Value; var pio = new PromptIntegerOptions("\n指定【定数等分】的数量") { AllowNone = true }; var pir = Env.Editor.GetInteger(pio); if (pir.Status != PromptStatus.OK) return null; var num = pir.Value; var divResult = spt.GetNumberDivideTo(ept, num, true); if (isDrawLine) divResult.Points.DrawLines(true, isDifferentColor: true); return divResult; } catch (AcException acex) { acex.AcErrorInfo(); } catch (Exception) { throw; } return null; } /// <summary> /// 指定两点定距等分(含绘制线段) /// </summary> /// <param name="isDrawLine">是否绘制线段</param> public static DivideInfo Tools_DistanceDivide(bool isDrawLine = false) { try { using var dloc = Env.Document.LockDocument(); var sppr = Env.Editor.GetPoint("\n拾取【定距等分】起始点"); if (sppr.Status != PromptStatus.OK) return null; var spt = sppr.Value; var ppo = new PromptPointOptions("\n拾取【定距等分】结束点") { AllowNone = true, UseBasePoint = true, BasePoint = spt }; var eppr = Env.Editor.GetPoint(ppo); if (eppr.Status != PromptStatus.OK) return null; var ept = eppr.Value; var pdo = new PromptDoubleOptions("\n指定【定距等分】的距离") { AllowNone = true }; var pdr = Env.Editor.GetDouble(pdo); if (pdr.Status != PromptStatus.OK) return null; var dis = pdr.Value; var divResult = spt.GetDistanceDivideTo(ept, dis, true); if (isDrawLine) divResult.Points.DrawLines(true, isDifferentColor: true); return divResult; } catch (AcException acex) { acex.AcErrorInfo(); } catch (Exception) { throw; } return null; } /// <summary> /// 点集合绘制直线 /// </summary> /// <param name="points">点集合</param> /// <param name="isEndToEnd">是否是首尾相连,默认为:<see langword="false"/>首尾不相连</param> /// <param name="isClose">首尾相连时,是否闭合,默认为:<see langword="false"/>不闭合</param> /// <param name="colorIndex">直线颜色索引值,默认为:256随层</param> /// <param name="isDifferentColor">直线是否设置不同的颜色,默认为:<see langword="false"/>不设置</param> public static void DrawLines(this IEnumerable<Point3d> points, bool isEndToEnd = false, bool isClose = false, int colorIndex = 256, bool isDifferentColor = false) { var linePoints = points.GetLine2PointList(isEndToEnd, isClose); if (isDifferentColor) colorIndex = 1; linePoints.ForEach(l2p => { var line = new Line(l2p.StatrPoint, l2p.EndPoint) { ColorIndex = isDifferentColor ? colorIndex++ : colorIndex }; Env.Database.AddEntityToModelSpace(line); if (isDifferentColor && colorIndex > 255) colorIndex = 1; }); } /// <summary> /// 将图形对象添加到图形文件中 /// </summary> /// <param name="database">图形数据库</param> /// <param name="entity">图形对象</param> /// <returns>图形的ObjectId</returns> public static ObjectId AddEntityToModelSpace(this Database database, Entity entity) { // 开启事务处理 using var trans = database.TransactionManager.StartTransaction(); // 打开块表记录 var btr = trans.GetObject(database.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; // 添加图形到块表记录 var entId = btr.AppendEntity(entity); // 更新数据信息 trans.AddNewlyCreatedDBObject(entity, true); // 提交事务 trans.Commit(); return entId; } ```
This pull request needs to pass some approval items
Type
Assign personnel
Status
Reviewer
vicwjb
In progress
(0/1 )
Tester
vicwjb
In progress
(0/1 )
How to merge Pull Request
git checkout v0.7
git pull https://gitee.com/fangmin723/ifoxcad.git v0.7
git push origin v0.7
Comments
4
Commits
1
Files
6
Checks
Code problems
0
Bulk operation
Expand
Collapse
Reviewer
Code Owner
Reviewer
vicwjb
vicwjb
liuqihong
JJbox
DYH
d1742647821
No Setting
Min number
1
Tester
vicwjb
vicwjb
liuqihong
JJbox
DYH
d1742647821
No Setting
Min number
1
Priority
Not specified
Serious
Main
Secondary
Unimportant
Label
Label settings
No Setting
Link Issue
No link issue
Successfully merged pull requests will close issues
Milestone
No related milestones
Participators
(2)
C#
1
https://gitee.com/inspirefunction/ifoxcad.git
git@gitee.com:inspirefunction/ifoxcad.git
inspirefunction
ifoxcad
IFoxCAD
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register