Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
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
85
Star
320
Fork
249
InspireFunction
/
IFoxCAD
Code
Issues
25
Pull Requests
4
Wiki
Insights
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
DBDictionaryEx中的创建添加编组方法AddGroup增加默认参数:bool selectable = true、string description = ""
Backlog
#ID0DGS
wxynotes
Opened this issue
2025-09-28 15:04
### 该问题是怎么引起的? 原添加编组的方法调用的构造函数是没有参数的构造函数,也没有属性设置的委托,无法设置bool selectable、string description参数 ### 解决办法 Group有两个构造函数,一个没有参数,另一个构造函数有两个参数bool selectable、string description,其中bool selectable控制组内成员能否被一起选中,这参数比较常用。编组的常规用法基本就是为了方便全部选中,但是有些业务逻辑仅仅是用来关联图元对象的相对关系,不需要同时选中这个功能。 因为编组总共也就三个可以设置的属性,string Name、bool Selectable、String description,故也没有必要增加属性设置委托。 ### 修改后的代码 ``` /// <summary> /// 添加编组 /// </summary> /// <param name="dict">字典</param> /// <param name="name">组名</param> /// <param name="ids">实体Id集合</param> /// <param name="selectable">组内所有图元能否被一起选中</param> /// <param name="description">编组的描述</param> /// <returns>编组Id</returns> public static ObjectId AddGroup(this DBDictionary dict, string name, ObjectIdCollection ids, bool selectable = true, string description = "") { if (dict.Contains(name)) return ObjectId.Null; using (dict.ForWrite()) { var g = new Group(description,selectable); g.Append(ids); dict.SetAt(name, g); var tr = DBTrans.GetTopTransaction(dict.Database); tr.AddNewlyCreatedDBObject(g, true); return g.ObjectId; } } /// <summary> /// 添加编组 /// </summary> /// <param name="dict">字典</param> /// <param name="name">组名</param> /// <param name="ids">实体Id集合</param> /// <param name="selectable">组内所有图元能否被一起选中</param> /// <param name="description">编组的描述</param> /// <returns>编组Id</returns> public static ObjectId AddGroup(this DBDictionary dict, string name, IEnumerable<ObjectId> ids, bool selectable = true, string description = "") { if (dict.Contains(name)) return ObjectId.Null; using ObjectIdCollection idc = new(ids.ToArray()); //需要using吗? 暂无测试 return dict.AddGroup(name, idc, selectable, description); } ```
### 该问题是怎么引起的? 原添加编组的方法调用的构造函数是没有参数的构造函数,也没有属性设置的委托,无法设置bool selectable、string description参数 ### 解决办法 Group有两个构造函数,一个没有参数,另一个构造函数有两个参数bool selectable、string description,其中bool selectable控制组内成员能否被一起选中,这参数比较常用。编组的常规用法基本就是为了方便全部选中,但是有些业务逻辑仅仅是用来关联图元对象的相对关系,不需要同时选中这个功能。 因为编组总共也就三个可以设置的属性,string Name、bool Selectable、String description,故也没有必要增加属性设置委托。 ### 修改后的代码 ``` /// <summary> /// 添加编组 /// </summary> /// <param name="dict">字典</param> /// <param name="name">组名</param> /// <param name="ids">实体Id集合</param> /// <param name="selectable">组内所有图元能否被一起选中</param> /// <param name="description">编组的描述</param> /// <returns>编组Id</returns> public static ObjectId AddGroup(this DBDictionary dict, string name, ObjectIdCollection ids, bool selectable = true, string description = "") { if (dict.Contains(name)) return ObjectId.Null; using (dict.ForWrite()) { var g = new Group(description,selectable); g.Append(ids); dict.SetAt(name, g); var tr = DBTrans.GetTopTransaction(dict.Database); tr.AddNewlyCreatedDBObject(g, true); return g.ObjectId; } } /// <summary> /// 添加编组 /// </summary> /// <param name="dict">字典</param> /// <param name="name">组名</param> /// <param name="ids">实体Id集合</param> /// <param name="selectable">组内所有图元能否被一起选中</param> /// <param name="description">编组的描述</param> /// <returns>编组Id</returns> public static ObjectId AddGroup(this DBDictionary dict, string name, IEnumerable<ObjectId> ids, bool selectable = true, string description = "") { if (dict.Contains(name)) return ObjectId.Null; using ObjectIdCollection idc = new(ids.ToArray()); //需要using吗? 暂无测试 return dict.AddGroup(name, idc, selectable, description); } ```
Comments (
1
)
Sign in
to comment
Status
Backlog
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (7)
Tags (10)
v0.9
v0.7
jing
v1.0
develop
master
v0.6
v0.7.2
v0.7.1
v0.7.0
v0.6.1
v0.4.0
v0.3.3
v0.3.0
v0.2.0
v0.1.3
v0.1.2
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
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