commit 5bc65d33ad9d2dab819df6936e42ba2abfdaf107 Author: 230238001 <15151850021@126.com> Date: Sat May 2 10:18:00 2026 +0800 Initial working version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac5c433 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Build results + +bin/ +obj/ + +# Visual Studio +.vs/ +*.suo +*.user +*.userosscache +*.sln.docstates + +# Rider +.idea/ + +# VS Code +.code/ + +# Rhino plugin output (should be .rhp, not tracked) +*.rhp +*.dll + +# OS +Thumbs.db +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d3ac87d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,27 @@ +# 更新日志 + +所有重要版本更新会记录在此文件。 + +## [0.1.0] - 2026-05-01 + +### 新增 +- 项目骨架创建(插件主类、命令入口) +- XML 配置文件解析器 +- 动态表单 UI:根据 XML 生成 TextBox / ComboBox 控件 +- 支持 string 类型字段(TextBox) +- 支持 list 类型字段(ComboBox 下拉选择) +- 多 XML 模板支持:可同时加载多个 XML 文件 +- 四种导入合并模式:追加、替代、合并更新、智能合并 +- `XmlImportDialog`:导入时弹出模式选择对话框 +- 模板持久化:Rhino 重启后自动恢复已加载的模板 +- `TemplateManager`:管理模板生命周期和 index 文件 +- 默认 XML 模板内嵌在 DLL 中,首次启动自动提取 +- 命令名:`UserstringProperty` + +### 功能 +- 选择 Block 后弹出属性编辑窗口 +- 属性保存到 Rhino Block 的 UserString(键值对存储) +- 分隔标题自动识别(属性名含 `---` 时显示为分组标题) + +### 文档 +- README、LICENSE、.gitignore、CONTRIBUTING、CHANGELOG \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..95c8394 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,17 @@ +> 本文件仅保留高优先级、易混淆、跨会话必须一致的约束。 +> 本文件必须极精简,占用大模型注意力视为失效。 + +## 项目一句话 + +Rhino 8 C# 插件(.rhp),管理 Block 的 UserString 属性,支持 XML 模板导入。 + +## 自动化约定 + +- 禁止自行 commit / push git,用户下达指令再执行 +- 完成任务后清理临时文件 + +## 文档入口 + +- PLAN.md:待办事项 +- CHANGELOG.md:版本记录 +- CLAUDE.md:仅包含本文件(不要混入项目说明) \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8c29a26 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# 贡献指南 + +欢迎提交 Issue 和 Pull Request! + +## 如何贡献 + +### 报告问题 + +发现 Bug 或有新功能想法?请先搜索 [Issues](https://gitea.com/user/project/issues) 确保不是重复提交,然后按以下格式描述: + +- **问题描述**:清晰说明问题或建议 +- **复现步骤**:如果是 Bug,列出具体步骤 +- **环境信息**:Rhino 版本、操作系统、.NET SDK 版本 + +### 提交代码 + +1. Fork 本项目 +2. 创建分支 (`git checkout -b feature/your-feature`) +3. 确保代码符合项目风格,编译通过 +4. 提交时请写清楚改动内容和原因 +5. Push 到你的 Fork,发起 Pull Request + +### 代码规范 + +- C# 代码遵循 [C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions) +- 公共方法需有 XML 注释 +- 新功能请附带测试或更新文档 + +## 问题解答 + +如有问题可以在 [Discussions](https://gitea.com/user/project/discussions) 中讨论。 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9d6dd3b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..97c0004 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# UserStringProperty + +Rhino 插件,根据用户自定义 XML 配置,给 Block 实例附加属性(UserString)。 + +## 功能 + +- 根据 XML 配置文件动态生成属性编辑界面 +- 支持 `string` 类型字段(TextBox)和 `list` 类型字段(ComboBox) +- 自动保存到 Rhino Block 的 UserString +- 支持多个 XML 模板同时加载、合并 +- 模板自动持久化,Rhino 重启后自动恢复 +- 导入时检测属性集冲突,覆盖或新增 + +## 安装 + +### 编译 + +```bash +cd UserStringProperty +dotnet build +``` + +输出:`UserStringProperty/bin/UserStringProperty.dll` + +### 加载到 Rhino + +1. 将 `bin/UserStringProperty.dll` 重命名为 `UserStringProperty.rhp` +2. Rhino → `Options` → `Plug-ins` → `Install` → 选择 `.rhp` 文件 + +### 使用 + +1. 在 Rhino 中输入命令:`UserstringProperty` +2. 选择要编辑的 Block 实例 +3. 默认模板首次启动自动加载;点 **加载XML** 导入自定义模板 +4. 在弹出的对话框中选择 cmig 和属性集,若同名已存在则需确认覆盖 +5. 在下拉框中选择属性集,编辑各字段值 +6. 点击 **写入属性** + +## 模板导入 + +加载 XML 时,会弹出对话框让选择 cmig 和属性集,检测同名冲突: + +- **同名属性集不存在** → 直接保存为新模板 +- **同名属性集已存在** → 需确认是否覆盖 + +## XML 配置格式 + +插件根据 XML 动态生成 UI。示例 XML 格式如下: + +```xml + + + + + + + + + + + + + + + + + +``` + +### 字段类型 + +| type | 控件 | 说明 | +|------|------|------| +| `string` | TextBox | 自由文本输入 | +| `list` | ComboBox | 下拉选项(通过 `