diff --git a/.specstory/history/2025-09-11_07-06Z-使用模板写入dxf文件数据.md b/.specstory/history/2025-09-11_07-06Z-使用模板写入dxf文件数据.md new file mode 100644 index 0000000..5dca947 --- /dev/null +++ b/.specstory/history/2025-09-11_07-06Z-使用模板写入dxf文件数据.md @@ -0,0 +1,464 @@ + + +# 使用模板写入DXF文件数据 (2025-09-11 07:06Z) + +_**User (2025-09-11 06:45Z)**_ + +使用drawing功能,写入到 "C:\Users\83500\久翌\CAD编辑同步excel\测试文件区\04_Test_Files\塔器.dxf"的 布局1 的 500 600 +数据和模板: +C:\Users\83500\久翌\CAD编辑同步excel\测试文件区\03_Python_OpenSource_DXF\模板\一级料表模板 + +--- + +_**Assistant**_ + +
Thought Process**Defining the DXF Table** + +I'm currently focusing on drawing a table within a DXF file. I've identified the target file and layout. Now, I need to figure out how to represent the table data – its structure, cell contents, and positioning – within the DXF format. Coordinates are being considered. + + +**Locating Relevant Files** + +I'm now digging into the "一级料表模板" directory to determine which files serve as the header and column templates, along with the data JSON. I'm also assessing if "布局1" is compatible with the `draw_table_from_template.py` script, given its focus on the model. The relative path is now understood, which simplifies file referencing. + + +**Examining File Contents** + +I'm now delving into the template directory files to identify the header template, column template, and data JSON files. I've also noted the script's reliance on model space, so I must determine how to handle the specified layout "布局1". I plan to list the files to proceed. + + +
+ +--- + +好的,我将使用 `draw_table_from_template.py` 脚本将表格数据写入到您指定的 DXF 文件中。 + +首先,我需要确认模板文件夹中的具体文件名,以便正确调用脚本。我将列出 `03_Python_OpenSource_DXF\模板\一级料表模板` 目录下的文件。 + +--- + +
+ Listed directory undefined • **0** results + +No results found +
+ +--- + +
Thought Process**Defining Template Structure** + +I'm currently examining the structure of the template directory. I've identified several JSON files within `03_Python_OpenSource_ DXF\模板\一级料表模板`, specifically those for columns, drawing data, and headers. These files seem to define the format of the data required by a function, which is promising. + + +**Confirming File Correspondence** + +I've confirmed that the JSON files perfectly align with the inputs of `draw_table_from_template.py`. Specifically, `header_template.json`, `columns_template.json`, and `drawing1_data.json` directly correspond to the header, column, and data arguments respectively. Now, I am investigating `draw_table_from_template.py` and layout support. + + +
+ +--- + +Okay, I see the `draw_table_from_template.py` script requires `header_template.json`, `columns_template.json`, and `drawing1_data.json`, all of which are present. The user wants to draw in "布局1", so I'll check if the script supports layouts since the documentation example only mentions modelspace. + +--- + +Read file: undefined + +--- + +
Thought Process**Assessing the Script's Limitations** + +I've just analyzed `draw_table_from_template.py` and confirmed its restriction to the modelspace. The script currently lacks functionality for layout selection. My focus has now shifted to understanding the implications of this limitation and strategizing a method for layout integration. + + +**Formulating the Strategy** + +I've identified the need to add a `--layout` argument to the script to enable layout selection. My strategy includes adding a command-line argument to the existing script. If a layout name is supplied, the script will fetch the layout; otherwise, it defaults to modelspace. This approach maintains backward compatibility. I'm now preparing to implement these changes. + + +**Devising a Solution** + +I've pinpointed the key limitation of `draw_table_from_template.py`: its exclusive focus on modelspace. My next step is to integrate layout selection. To achieve this, I'll implement a `--layout` argument. The script will then select the appropriate space, maintaining modelspace as the default. Now, I'm drafting the implementation strategy, starting with adding the plan. + + +
+ +--- + +好的,我将按您的要求执行操作。 + +首先,我分析了您提供的需求和现有文件。`draw_table_from_template.py` 脚本目前只能在模型的“模型空间”中绘图,但您的要求是绘制到 "布局1" 中。因此,我需要先对该脚本进行修改,增加指定布局的功能。 + +这是我的行动计划: + +1. **修改 `draw_table_from_template.py` 脚本** + * 添加一个新的命令行参数 `--layout`,用于接收布局名称。 + * 更新代码逻辑:如果用户提供了 `--layout` 参数,程序将尝试获取并使用指定的布局;如果未提供,则默认使用模型空间,以保证旧功能不受影响。 +2. **执行修改后的脚本** + * 使用您提供的路径、坐标和模板文件,执行脚本,将表格绘制到 `塔器.dxf` 文件的 `布局1` 中。 + +我现在开始执行第一步,修改脚本。 + +--- + +## Todo List + +- [-] Modify `draw_table_from_template.py` to support specifying a layout. +- [ ] Run the modified script with user-provided parameters. + +--- + +
Thought Process**Refining Initial Implementation** + +I've begun implementing the `--layout` argument within `draw_table_from_template.py`. Currently, I'm focused on parsing the argument and handling potential errors. The plan is to attempt loading the specified layout and exit gracefully if the layout is missing. + + +**Integrating Argument Parsing** + +I've successfully added the `--layout` argument using `argparse`. Now, I'm focused on implementing the error handling. Specifically, I'm incorporating a `try-except` block to catch `KeyError` if the specified layout is not found in the DXF document and printing helpful error messages, along with available layouts. + + +**Initiating Code Modification** + +I'm now actively working on modifying `draw_table_from_template.py`. I've outlined the `argparse` addition for the `--layout` argument and how to handle it in the `main` function. I'm implementing the code now, specifically integrating the argument parsing and layout selection, including the necessary error handling for missing layouts. I'll be replacing `msp = doc.modelspace()` with the new layout logic, and I've considered the case of a new DXF. + + +
+ +--- + +Okay, I am starting the first task, which is to modify `draw_table_from_template.py`. + +I will add a `--layout` argument. If a layout is specified, I will attempt to retrieve it. If the layout does not exist, I will print an error message and exit. If no layout is specified, I will use the modelspace. + +--- + +
Edit file: 03_Python_OpenSource_DXF/draw_table_from_template.py + +undefined + +**Chunk 1** +Lines added: 1, lines removed: undefined + +```diff +@@ -202,4 +202,5 @@ + help="Sets the anchor point of the table for the insertion coordinates (--x, --y)." + ) ++ parser.add_argument("--layout", type=str, default=None, help="The name of the layout to draw on. Defaults to modelspace.") + args = parser.parse_args() + +``` + +**Chunk 2** +Lines added: 12, lines removed: 1 + +```diff +@@ -218,10 +219,21 @@ + if os.path.exists(args.source_dxf): + doc = ezdxf.readfile(args.source_dxf) +- msp = doc.modelspace() + print(f"Loaded source DXF file: {args.source_dxf}") + else: + print(f"Source file not found, creating a new DXF document.") + doc = ezdxf.new() ++ ++ if args.layout: ++ try: ++ msp = doc.layouts.get(args.layout) ++ print(f"Using layout: {args.layout}") ++ except KeyError: ++ print(f"Error: Layout '{args.layout}' not found in the document.") ++ print("Available layouts:", ", ".join(l.name for l in doc.layouts)) ++ return ++ else: + msp = doc.modelspace() ++ print("Using modelspace.") ++ + except IOError: + print(f"Could not read source DXF file: {args.source_dxf}. Creating a new document.") +``` + +
+ +--- + +
Thought Process**Refining The Code** + +I've been tidying up the code, focusing on improving readability and organization. The edits I made initially were a bit rough around the edges, so I'm working on refining those changes and streamlining the structure of the code block. I want it to be easier to understand and maintain. + + +**Code Clarity Improvement** + +I'm currently focused on refining the "Load DXF" section of the code, aiming for a cleaner and more organized structure. The initial edits, while functional, could be improved for readability, specifically in the error handling and file loading logic. I'm now integrating these changes and re-evaluating how to best handle potential issues. + + +**Improving the Layout Logic** + +I've just completed a review of the layout handling code. The new implementation is more robust, using `doc.layouts.has_layout()` and `doc.layouts.names()` to validate the layout selection, which is a significant improvement over the original approach. This helps in identifying and communicating errors. + + +**Evaluating the Changes** + +I've revisited the "Load DXF" section. I was aiming for more clarity, and it seems I was overthinking things initially. The `doc.layouts.has_layout()` approach is a good check. Using `try...except` with `doc.layouts.get()` is the more "pythonic" route for handling the layout selection and I have incorporated this approach. + + +**Revisiting and Correcting Edits** + +I've just corrected a bug in the previous edits; I had inadvertently moved the `args = parser.parse_args()` line. Also, I'm reviewing my approach, and I believe using `try...except` with `doc.layouts.get()` is the most appropriate way for handling layout selection. I'm going to integrate these improvements. + + +
+ +--- + +Okay, I see the previous edit introduced a bug by misplacing `args = parser.parse_args()`. I will correct this now by applying a cleaned-up version of the logic. + +--- + +
Edit file: 03_Python_OpenSource_DXF/draw_table_from_template.py + +undefined + +**Chunk 1** +Lines added: 2, lines removed: undefined + +```diff +@@ -216,4 +216,6 @@ + + # --- Load DXF --- ++ msp = None ++ doc = None + try: + if os.path.exists(args.source_dxf): +``` + +**Chunk 2** +Lines added: 1, lines removed: 1 + +```diff +@@ -223,5 +225,5 @@ + print(f"Source file not found, creating a new DXF document.") + doc = ezdxf.new() +- ++ + if args.layout: + try: +``` + +**Chunk 3** +Lines added: 1, lines removed: 1 + +```diff +@@ -230,5 +232,5 @@ + except KeyError: + print(f"Error: Layout '{args.layout}' not found in the document.") +- print("Available layouts:", ", ".join(l.name for l in doc.layouts)) ++ print("Available layouts:", ", ".join(doc.layouts.names())) + return + else: +``` + +
+ +--- + +
Thought Process**Troubleshooting Edit Failures** + +I'm still struggling with the edit. It appears the tool I'm using is having issues applying changes properly. I will try again using a more comprehensive code block to give the tool additional context. + + +**Iterating Edit Attempts** + +The prior attempt failed. The edit tool struggles with the task at hand. The goal is to replace the `main` function's logic. I've now provided the desired `main()` function in a complete code block, hoping this comprehensive approach yields better results. I'm aiming for a clean implementation. + + +**Refining the Implementation** + +The previous attempt failed again, and the issue persists. The editing tool's struggle continues, failing to accurately apply the changes. This time, I'm including the complete `main()` function in my code block to give the tool more context. I'm focused on a clean start for the `main` function. + + +**Persisting with Refinements** + +The edit tool continues to be problematic. It's not properly integrating the changes. I'm going to try again with a more extensive code block that provides the complete `main()` function. My focus remains on a clean implementation of the argument parsing and DXF loading. + + +
+ +--- + +
Edit file: 03_Python_OpenSource_DXF/draw_table_from_template.py + +undefined + +**Chunk 1** +Lines added: 1, lines removed: 1 + +```diff +@@ -216,6 +216,6 @@ + + # --- Load DXF --- ++ doc = None + msp = None +- doc = None + try: + if os.path.exists(args.source_dxf): +``` + +
+ +--- + +
Thought Process**Analyzing for Edits** + +I've decided to overhaul the existing edits. The current version isn't satisfactory, so I'm shifting to a more hands-on approach. I plan to read through the file carefully, identifying the areas needing correction, and then craft the edits myself. + + +
+ +--- + +Read file: undefined + +--- + +
Thought Process**Running the Script Now** + +I've confirmed that `draw_table_from_template.py` appears to be functionally sound. The `--layout` argument has been incorporated, along with the necessary logic. My immediate next step is to execute the script using the user-supplied parameters. + + +**Testing the Execution** + +I'm now ready to run the script with the user's provided parameters. I've assembled the command line arguments, including the source DXF, template files, data, output location, coordinates, and the layout specification. I'll monitor the output closely for any errors or unexpected behavior during the run. I'm particularly interested in how the `--layout 布局 1` argument is handled. + + +**Initiating the Run** + +I'm now preparing the command line invocation of the script with the detailed parameters. I've carefully constructed the call, including paths for DXF, templates, data, output, coordinates and crucially, the layout specification. I'll execute it with the full path to the python executable within the virtual environment, as instructed. I'll be watching closely for the `--layout`'s proper integration. + + +**Preparing for Execution** + +I've meticulously constructed the command-line call, focusing on accurate pathing, especially for the python executable and the script itself. I'm also ensuring the proper handling of the `--layout` argument. The next step is to execute the command within the terminal environment. I'll meticulously examine the output, looking for any errors. + + +**Final Execution Preparation** + +I've carefully constructed the command, incorporating relative paths for brevity. The key aspects include the script's location, the Python interpreter's location within the virtual environment, and the full specification of input/output files and parameters. I'm preparing for the execution using PowerShell, ensuring proper quoting. I am optimistic about a successful outcome. + + +
+ +--- + +好的,我已经修改了 `draw_table_from_template.py` 脚本,现在它支持通过 `--layout` 参数指定图纸的布局。 + +接下来,我将执行此脚本,将您指定的表格数据和模板绘制到 `塔器.dxf` 文件的“布局1”中,坐标为 (500, 600)。输出文件将保存为 `塔器_with_table.dxf`。 + +--- + +## Todo List + +- [x] Modify `draw_table_from_template.py` to support specifying a layout. +- [-] Run the modified script with user-provided parameters. + +--- + +```bash +& ".\\03_Python_OpenSource_DXF\\venv\\Scripts\\python.exe" ".\\03_Python_OpenSource_DXF\\draw_table_from_template.py" ".\\04_Test_Files\\塔器.dxf" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\header_template.json" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\columns_template.json" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\drawing1_data.json" ".\\04_Test_Files\\塔器_with_table.dxf" --x 500 --y 600 --layout "布局1" +``` + +``` +"布局1" +Loaded source DXF file: .\\04_Test_Files\\塔器.dxf +Using layout: 布局1 +Drawing table with anchor 'bottom-left' at (500.0, 600.0)... +Calculated bottom-left start position: (500.00, 600.00) +Successfully saved new table to: .\\04_Test_Files\\塔器_with_table.dxf +``` + +--- + +
Thought Process**Assessing Script Execution** + +The script performed as expected, successfully loading the DXF file "塔器.dxf" and utilizing the "布局1" layout. The table was drawn correctly at the designated location, and the output was saved as planned. + + +**Verifying Script Completion** + +I've confirmed successful script execution. The DXF file loaded, layout "布局1" was used, the table was drawn as intended, and the output, including the table, was correctly saved. The output file is located at `.\04_Test_Files\塔器 _with_table.dxf`. + + +
+ +--- + +## Todo List + +- [x] Modify `draw_table_from_template.py` to support specifying a layout. +- [x] Run the modified script with user-provided parameters. + +--- + +
Thought Process**Evaluating the Execution** + +I've confirmed the script ran without a hitch. The DXF file was read, the specified layout was used. Furthermore, the start position was correctly calculated, leading to successful table drawing. The output has been saved, as expected. + + +**Concluding the Process** + +The system performed as expected, precisely following the defined steps. I confirmed the loading of the specified DXF, the use of the correct layout, and the accurate drawing with saved output. Success! The table has been drawn, and the results are saved. + + +
+ +--- + +好的,我已经成功执行了您的请求。 + +具体操作如下: + +1. **修改了绘图脚本**:我对 `03_Python_OpenSource_DXF/draw_table_from_template.py` 脚本进行了修改,添加了对CAD“布局(Layout)”的支持。现在可以通过 `--layout` 参数指定图纸的布局名称。 +2. **执行绘图命令**:使用修改后的脚本,我将您指定的“一级料表模板”和数据,在 `04_Test_Files\塔器.dxf` 文件的 `布局1` 中,于坐标 `(500, 600)` 处插入了表格。 +3. **生成了新文件**:结果已保存到一个新文件中,路径为:`04_Test_Files\塔器_with_table.dxf`。 + +您可以检查生成的文件,看看是否符合您的预期。 + +--- + +_**User (2025-09-11 06:45Z)**_ + +直接把命令发我,我再执行一次 + +--- + +_**Assistant**_ + +
Thought Process**Repeating the Command** + +\n\n + +I've zeroed in on providing the user with the command they need. I'll present the exact string I executed earlier, allowing them to replicate the action. My primary concern is ensuring they have the correct command for direct execution. + + +**Confirming the Action** + +\n\n + +My current thinking confirms the need to reiterate the previous action. Therefore, I'm directly outputting the exact command executed previously. I have formatted it within a code block as requested. This will enable the user to easily rerun the command for identical results. + + +
+ +--- + +好的,这是您需要执行的命令: + +```shell +& ".\\03_Python_OpenSource_DXF\\venv\\Scripts\\python.exe" ".\\03_Python_OpenSource_DXF\\draw_table_from_template.py" ".\\04_Test_Files\\塔器.dxf" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\header_template.json" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\columns_template.json" ".\\03_Python_OpenSource_DXF\\模板\\一级料表模板\\drawing1_data.json" ".\\04_Test_Files\\塔器_with_table.dxf" --x 500 --y 600 --layout "布局1" +``` + +您可以在 `C:\Users\83500\久翌\CAD编辑同步excel\测试文件区` 这个目录下直接运行它。 + +--- + diff --git a/03_Python_OpenSource_DXF/.claude/settings.local.json b/03_Python_OpenSource_DXF/.claude/settings.local.json new file mode 100644 index 0000000..08a38eb --- /dev/null +++ b/03_Python_OpenSource_DXF/.claude/settings.local.json @@ -0,0 +1,17 @@ +{ + "permissions": { + "allow": [ + "Read(/C:\\Users\\83500\\久翌\\CAD编辑同步excel\\测试文件区\\04_Test_Files/**)", + "Bash(pip install:*)", + "Bash(python:*)", + "Bash(call venvScriptsactivate.bat)", + "Bash(./venv/Scripts/python.exe --version)", + "Bash(./venv/Scripts/pip.exe list)", + "Bash(./venv/Scripts/python.exe plot_by_block_name.py \"../04_Test_Files/塔器.dxf\" -o test_output)", + "Bash(./venv/Scripts/python.exe plot_by_block_name.py \"../04_Test_Files/塔器.dxf\" --layout \"布局1\" -o test_output)", + "Bash(./venv/Scripts/python.exe:*)" + ], + "deny": [], + "ask": [] + } +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/README.md b/03_Python_OpenSource_DXF/README.md index addd39e..de2be5a 100644 --- a/03_Python_OpenSource_DXF/README.md +++ b/03_Python_OpenSource_DXF/README.md @@ -123,14 +123,20 @@ 万事俱备!现在运行 `draw_table_from_template.py` 脚本,将**您的模板**、您的数据和您的目标文件作为参数传入。 -最重要的,您现在可以通过 `--x` 和 `--y` 参数来精确指定表格**左下角的插入坐标**。 +最重要的,您现在可以通过 `--x` 和 `--y` 参数来指定插入坐标,并通过 `--anchor` 参数来定义这些坐标所对应的**锚点**。 + +**锚点选项**: +- `bottom-left` (默认): `(x, y)` 是表格的左下角。 +- `bottom-right`: `(x, y)` 是表格的右下角。 +- `top-left`: `(x, y)` 是表格的左上角。 +- `top-right`: `(x, y)` 是表格的右上角。 ```shell -# 用法: python draw_table_from_template.py <目标DXF> <您的表头模板> <您的列模板> <您的数据JSON> <输出DXF> --x --y -./venv/Scripts/python 03_Python_OpenSource_DXF/draw_table_from_template.py "C:/path/to/target_drawing.dxf" "C:/path/to/my_header_template.json" "C:/path/to/my_columns_template.json" "C:/path/to/my_data.json" "C:/path/to/output_with_table.dxf" --x 300 --y 100 +# 用法: python draw_table_from_template.py <目标DXF> <您的表头模板> <您的列模板> <您的数据JSON> <输出DXF> --x --y --anchor <锚点> +./venv/Scripts/python 03_Python_OpenSource_DXF/draw_table_from_template.py "C:/path/to/target_drawing.dxf" "C:/path/to/my_header_template.json" "C:/path/to/my_columns_template.json" "C:/path/to/my_data.json" "C:/path/to/output_with_table.dxf" --x 420 --y 297 --anchor top-right ``` -执行完毕后,`output_with_table.dxf` 文件中就会在 (300, 100) 的位置出现一个根据您的样式和数据绘制好的、崭新的表格。 +执行完毕后,`output_with_table.dxf` 文件的右上角将被精确定位在 `(420, 297)` 坐标点,并出现一个根据您的样式和数据绘制好的、崭新的表格。 --- diff --git a/03_Python_OpenSource_DXF/convert_dxf_to_pdf.py b/03_Python_OpenSource_DXF/convert_dxf_to_pdf.py deleted file mode 100644 index f18e6dc..0000000 --- a/03_Python_OpenSource_DXF/convert_dxf_to_pdf.py +++ /dev/null @@ -1,64 +0,0 @@ -import ezdxf -from ezdxf.addons.drawing import RenderContext, Frontend -from ezdxf.addons.drawing.matplotlib import MatplotlibBackend -import matplotlib.pyplot as plt -import os -import sys - -# --- 配置 --- -# 将脚本的父目录(项目根目录)添加到Python路径中 -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -PROJECT_ROOT = os.path.dirname(SCRIPT_DIR) -sys.path.append(PROJECT_ROOT) - -INPUT_DXF_NAME = "图签测试.dxf" -OUTPUT_PDF_NAME = "图签测试_from_dxf.pdf" -INPUT_DXF_PATH = os.path.join(SCRIPT_DIR, INPUT_DXF_NAME) - -# 确保输出目录存在 -output_dir = os.path.join(PROJECT_ROOT, "04_Test_Files", "结果") -os.makedirs(output_dir, exist_ok=True) -OUTPUT_PDF_PATH = os.path.join(output_dir, OUTPUT_PDF_NAME) - - -def dxf_to_pdf(input_path, output_path): - """ - 将指定的 DXF 文件渲染并保存为 PDF。 - """ - if not os.path.exists(input_path): - print(f"错误: 输入的 DXF 文件未找到: '{input_path}'") - return - - try: - print(f"--- 正在加载 DXF 文件: {os.path.basename(input_path)} ---") - doc = ezdxf.readfile(input_path) - msp = doc.modelspace() - - # 创建 Matplotlib Figure 和 Axes - fig = plt.figure() - ax = fig.add_axes([0, 0, 1, 1]) - - # 设置渲染上下文和后端 - ctx = RenderContext(doc) - out = MatplotlibBackend(ax) - - print("--- 开始渲染 DXF 内容 ---") - # 使用 ezdxf 的绘图插件渲染模型空间 - Frontend(ctx, out).draw_layout(msp, finalize=True) - - print(f"--- 正在将渲染结果保存为 PDF: {os.path.basename(output_path)} ---") - # 保存为 PDF,dpi可以调整清晰度,bbox_inches='tight'会自动裁剪空白边缘 - fig.savefig(output_path, dpi=300, bbox_inches='tight', pad_inches=0.1) - plt.close(fig) - - print("\n操作成功!") - print(f"PDF 文件已保存到: '{output_path}'") - - except IOError: - print(f"错误: 无法读取文件: '{input_path}'") - except Exception as e: - print(f"处理并转换 DXF 文件时发生未知错误: {e}") - -if __name__ == "__main__": - dxf_to_pdf(INPUT_DXF_PATH, OUTPUT_PDF_PATH) - diff --git a/03_Python_OpenSource_DXF/diagnose_blocks.py b/03_Python_OpenSource_DXF/diagnose_blocks.py new file mode 100644 index 0000000..e48af53 --- /dev/null +++ b/03_Python_OpenSource_DXF/diagnose_blocks.py @@ -0,0 +1,49 @@ +import ezdxf +import argparse +from pathlib import Path + +def diagnose_blocks(dxf_file: Path): + """ + 加载一个DXF文件,并打印出其模型空间中所有顶层块参照的名称。 + """ + if not dxf_file.is_file(): + print(f"错误: 文件不存在 -> {dxf_file}") + return + + try: + doc = ezdxf.readfile(dxf_file) + except IOError: + print(f"错误: 无法读取文件 -> {dxf_file}") + return + except ezdxf.DXFStructureError as e: + print(f"DXF 文件结构错误: {e}") + return + + msp = doc.modelspace() + top_level_blocks = msp.query('INSERT') + + print(f"\n--- 在 '{dxf_file.name}' 的模型空间中找到的顶层块参照 ---") + if not top_level_blocks: + print("未找到任何顶层的块参照 (INSERT entities)。") + return + + # 为了更好的可读性,我们统计一下每个块名出现的次数 + from collections import Counter + block_names = [block.dxf.name for block in top_level_blocks] + block_counts = Counter(block_names) + + print(f"共找到 {len(top_level_blocks)} 个块参照,涉及 {len(block_counts)} 个不同的块定义。") + print("-" * 50) + for name, count in block_counts.items(): + print(f" 块名: '{name}' \t (在模型空间中出现了 {count} 次)") + print("-" * 50) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="诊断DXF文件,列出其模型空间中所有顶层的块参照名称。" + ) + parser.add_argument("input_dxf", type=Path, help="要诊断的源DXF文件的路径。") + args = parser.parse_args() + + diagnose_blocks(args.input_dxf) diff --git a/03_Python_OpenSource_DXF/draw_table_from_template.py b/03_Python_OpenSource_DXF/draw_table_from_template.py index aebcfeb..61178ed 100644 --- a/03_Python_OpenSource_DXF/draw_table_from_template.py +++ b/03_Python_OpenSource_DXF/draw_table_from_template.py @@ -192,8 +192,16 @@ def main(): # Output file parser.add_argument("output_dxf", help="Path to the output DXF file to write.") # Optional coordinates - parser.add_argument("--x", type=float, default=260.0, help="The X coordinate for the table's bottom-left insertion point.") - parser.add_argument("--y", type=float, default=50.0, help="The Y coordinate for the table's bottom-left insertion point.") + parser.add_argument("--x", type=float, default=260.0, help="The X coordinate for the table's anchor point.") + parser.add_argument("--y", type=float, default=50.0, help="The Y coordinate for the table's anchor point.") + parser.add_argument( + "--anchor", + type=str, + default="bottom-left", + choices=["bottom-left", "bottom-right", "top-left", "top-right"], + help="Sets the anchor point of the table for the insertion coordinates (--x, --y)." + ) + parser.add_argument("--layout", type=str, default=None, help="The name of the layout to draw on. Defaults to modelspace.") args = parser.parse_args() # --- Load Templates --- @@ -207,15 +215,28 @@ def main(): return # --- Load DXF --- + doc = None + msp = None try: if os.path.exists(args.source_dxf): doc = ezdxf.readfile(args.source_dxf) - msp = doc.modelspace() print(f"Loaded source DXF file: {args.source_dxf}") else: print(f"Source file not found, creating a new DXF document.") doc = ezdxf.new() + + if args.layout: + try: + msp = doc.layouts.get(args.layout) + print(f"Using layout: {args.layout}") + except KeyError: + print(f"Error: Layout '{args.layout}' not found in the document.") + print("Available layouts:", ", ".join(doc.layouts.names())) + return + else: msp = doc.modelspace() + print("Using modelspace.") + except IOError: print(f"Could not read source DXF file: {args.source_dxf}. Creating a new document.") doc = ezdxf.new() @@ -229,10 +250,34 @@ def main(): if bom_data is None: return + # --- Calculate table dimensions to determine the final start position --- + col_boundaries = header_template.get("column_boundaries", [0]) + table_width = col_boundaries[-1] - col_boundaries[0] + + header_height = header_template.get("header_height", 0) + row_height = columns_template.get("row_height", 8.0) + num_data_rows = len(bom_data) + table_height = header_height + num_data_rows * row_height + + # --- Adjust start position based on the anchor --- + start_x = args.x + start_y = args.y + + if args.anchor == "bottom-right": + start_x -= table_width + elif args.anchor == "top-left": + start_y -= table_height + elif args.anchor == "top-right": + start_x -= table_width + start_y -= table_height + + # The drawing function always uses the bottom-left corner as the start position + final_start_position = Vec3(start_x, start_y) + # --- Draw Table --- - print("Drawing table from templates...") - start_position = Vec3(args.x, args.y) - draw_table_from_template(msp, start_position, header_template, columns_template, bom_data) + print(f"Drawing table with anchor '{args.anchor}' at ({args.x}, {args.y})...") + print(f"Calculated bottom-left start position: ({final_start_position.x:.2f}, {final_start_position.y:.2f})") + draw_table_from_template(msp, final_start_position, header_template, columns_template, bom_data) # --- Save Output --- try: diff --git a/03_Python_OpenSource_DXF/export_dxf.py b/03_Python_OpenSource_DXF/export_dxf.py new file mode 100644 index 0000000..ef46b24 --- /dev/null +++ b/03_Python_OpenSource_DXF/export_dxf.py @@ -0,0 +1,170 @@ +import ezdxf +import sys + +from ezdxf.addons.drawing import RenderContext, Frontend +from ezdxf.addons.drawing.matplotlib import MatplotlibBackend +from ezdxf.addons.drawing.properties import Configuration +from ezdxf import bbox # 导入边界框计算模块 +import matplotlib.pyplot as plt +import os +import json # 导入JSON模块 +import argparse # 导入命令行参数处理模块 + +# --- 配置 --- +# 将脚本的父目录(项目根目录)添加到Python路径中 +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +PROJECT_ROOT = os.path.dirname(SCRIPT_DIR) +sys.path.append(PROJECT_ROOT) + +# 指定字体目录 +FONT_DIR = r"C:\Users\83500\久翌\CAD编辑同步excel\测试文件区\03_Python_OpenSource_DXF\fonts" + +def main(): + """ + 主函数,用于解析命令行参数并调用核心处理函数。 + """ + # --- 1. 设置命令行参数解析 --- + parser = argparse.ArgumentParser( + description="将 DXF 文件导出为 PDF, PNG, 并提取其坐标保存为 JSON。", + formatter_class=argparse.RawTextHelpFormatter # 保持帮助文本的格式 + ) + parser.add_argument( + "input_dxf_path", + type=str, + help="要处理的源 DXF 文件的完整路径。" + ) + + # 设置默认输出目录 + default_output_dir = os.path.join(PROJECT_ROOT, "04_Test_Files", "结果") + + parser.add_argument( + "--output_dir", + type=str, + default=default_output_dir, + help="指定输出文件(PDF, PNG, JSON)的保存目录。\n" + f"如果未提供,将默认使用:\n{default_output_dir}" + ) + parser.add_argument( + '--crop', + nargs=4, + type=float, + metavar=('X1', 'Y1', 'X2', 'Y2'), + help="提供一个矩形区域的两个对角点坐标 (X1 Y1 X2 Y2) 来裁剪输出的图像。" + ) + + args = parser.parse_args() + + # --- 2. 确保输出目录存在 --- + os.makedirs(args.output_dir, exist_ok=True) + + # --- 3. 调用核心功能 --- + export_dxf_with_coords(args.input_dxf_path, args.output_dir, crop_coords=args.crop) + + +def export_dxf_with_coords(input_path, output_dir, crop_coords=None): + """ + 将指定的 DXF 文件中的 "布局1" 渲染为 PDF 和 PNG,并将其边界坐标保存为 JSON 文件。 + 如果提供了 crop_coords,则会对输出的图像进行裁剪。 + """ + # --- 1. 检查输入文件是否存在 --- + if not os.path.exists(input_path): + print(f"错误: 输入的 DXF 文件未找到: '{input_path}'") + return + + # --- 2. 设置输出文件名 --- + base_name = os.path.splitext(os.path.basename(input_path))[0] + json_path = os.path.join(output_dir, f"{base_name}_coords.json") + pdf_path = os.path.join(output_dir, f"{base_name}.pdf") + png_path = os.path.join(output_dir, f"{base_name}.png") + + try: + # --- 3. 加载并解析 DXF 文件 --- + print(f"--- 正在加载 DXF 文件: {os.path.basename(input_path)} ---") + doc = ezdxf.readfile(input_path) + + # --- 新增: 查找并使用 "布局1" --- + layout_name = '布局1' + try: + layout = doc.layouts.get(layout_name) + print(f"--- 已成功找到并切换到布局: '{layout_name}' ---") + except KeyError: + available_layouts = ", ".join(doc.layouts.names()) + print(f"错误: 在 DXF 文件中找不到名为 '{layout_name}' 的布局。") + print(f"该文件中可用的布局有: [{available_layouts}]") + return + + # --- 4. 计算图纸边界并保存为 JSON (基于布局) --- + print(f"--- 正在计算 '{layout_name}' 的边界坐标 ---") + extents = bbox.extents(layout, fast=True) + + if not extents.has_data: + print(f"警告: 布局 '{layout_name}' 中不包含任何实体,无法计算坐标。") + # 即使没有坐标,也可能需要渲染一个空白页面,所以这里我们不直接返回 + coords = {} + else: + coords = { + "bottom_left": {"x": round(extents.extmin.x, 2), "y": round(extents.extmin.y, 2)}, + "bottom_right": {"x": round(extents.extmax.x, 2), "y": round(extents.extmin.y, 2)}, + "top_left": {"x": round(extents.extmin.x, 2), "y": round(extents.extmax.y, 2)}, + "top_right": {"x": round(extents.extmax.x, 2), "y": round(extents.extmax.y, 2)}, + } + + with open(json_path, 'w', encoding='utf-8') as f: + json.dump(coords, f, ensure_ascii=False, indent=4) + print(f"坐标已成功保存到: '{json_path}'") + + + # --- 5. 配置渲染器(包括字体) --- + # 鉴于当前环境存在无法解释的版本冲突问题, + # 我们回退到使用全局 support_dirs 的方法,这种方法兼容性更强,可以绕过问题。 + if FONT_DIR not in ezdxf.options.support_dirs: + ezdxf.options.support_dirs.append(FONT_DIR) + + # 使用默认配置, 并添加解决方法来处理3D点实体 + config = Configuration.defaults().with_changes( + # 将点的大小设置为0,这会让渲染器将点绘制为单个像素, + # 从而绕过在处理3D点(POINT)的复杂几何图形时可能出现的Z坐标问题。 + pdsize=0, + ) + + # --- 6. 渲染 DXF 内容 --- + fig = plt.figure() + ax = fig.add_axes([0, 0, 1, 1]) + ctx = RenderContext(doc) + out = MatplotlibBackend(ax) + + print("--- 开始渲染 DXF 内容 ---") + Frontend(ctx, out, config=config).draw_layout(layout, finalize=True) + + # --- 新增: 应用裁剪区域 --- + if crop_coords: + x1, y1, x2, y2 = crop_coords + min_x, max_x = min(x1, x2), max(x1, x2) + min_y, max_y = min(y1, y2), max(y1, y2) + + print(f"--- 正在应用裁剪区域: X({min_x:.2f} - {max_x:.2f}), Y({min_y:.2f} - {max_y:.2f}) ---") + ax.set_xlim(min_x, max_x) + ax.set_ylim(min_y, max_y) + + # --- 7. 保存为 PDF --- + print(f"--- 正在保存为 PDF: {os.path.basename(pdf_path)} ---") + fig.savefig(pdf_path, dpi=300, bbox_inches='tight', pad_inches=0.1) + print(f"PDF 文件已保存到: '{pdf_path}'") + + # --- 8. 保存为 PNG --- + print(f"--- 正在保存为 PNG: {os.path.basename(png_path)} ---") + fig.savefig(png_path, dpi=300, bbox_inches='tight', pad_inches=0.1) + print(f"PNG 文件已保存到: '{png_path}'") + + plt.close(fig) + + print("\n操作成功完成!") + + except IOError: + print(f"错误: 无法读取文件: '{input_path}'") + except Exception as e: + print(f"处理并转换 DXF 文件时发生未知错误: {e}") + +if __name__ == "__main__": + main() + diff --git a/03_Python_OpenSource_DXF/fonts/@extfont2.shx b/03_Python_OpenSource_DXF/fonts/@extfont2.shx new file mode 100644 index 0000000..dc34b5d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/@extfont2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ACADPSC.PS b/03_Python_OpenSource_DXF/fonts/ACADPSC.PS new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/ACADPSC.PS @@ -0,0 +1 @@ + diff --git a/03_Python_OpenSource_DXF/fonts/ACADPSD.PS b/03_Python_OpenSource_DXF/fonts/ACADPSD.PS new file mode 100644 index 0000000..837d506 --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/ACADPSD.PS @@ -0,0 +1,156 @@ +% Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved. +% Distributed by Free Software Foundation, Inc. +% +% This file is part of Ghostscript. +% +% Ghostscript is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +% to anyone for the consequences of using it or for whether it serves any +% particular purpose or works at all, unless he says so in writing. Refer +% to the Ghostscript General Public License for full details. +% +% Everyone is granted permission to copy, modify and redistribute +% Ghostscript, but only under the conditions described in the Ghostscript +% General Public License. A copy of this license is supposed to have been +% given to you along with Ghostscript so you can know your rights and +% responsibilities. It should be in a file named COPYING. Among other +% things, the copyright notice and this notice must be preserved on all +% copies. + +% This file provides a dummy 'statusdict' and 'serverdict', +% and a few of the other LaserWriter operators, for the benefit of +% PostScript programs that think they are running on a LaserWriter. + +% +% *********************************************************************** +% * * +% * M M OOO DDDD III FFFFF III EEEEE DDDD * +% * MM MM O O D D I F I E D D * +% * M M M O O D D I F I E D D * +% * M M O O D D I FFF I EEE D D * +% * M M O O D D I F I E D D * +% * M M O O D D I F I E D D * +% * M M OOO DDDD III F III EEEEE DDDD * +% * * +% * * +% * FFFFF III L EEEEE * +% * F I L E * +% * F I L E * +% * FFF I L EEE * +% * F I L E * +% * F I L E * +% * F III LLLLL EEEEE * +% * * +% *********************************************************************** +% +% .-------------. +% | /\ | +% | / \ | +% | / /\ \ | +% | / / \ \ | +% | / / /\ \ \ | +% | / / / \ \ \| +% `-------------' (R) +% Autodesk, Inc. +% Tools For the Golden Age of Engineering +% +% In keeping with subparagraph 2a of the Gnu General Public License +% (Version 1, February 1989): +% +% 2. You may modify your copy or copies of the Program or any +% portion of it, and copy and distribute such modifications under +% the terms of Paragraph 1 above, provided that you also do the +% following: +% +% a) cause the modified files to carry prominent notices stating +% that you changed the files and the date of any change; and... +% +% the following is a summary of the changes to this file made by +% Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run +% as an ADS application and thereby to perform rendering of +% PostScript files within AutoCAD. +% +% STATUSD.PS Renamed to be ACADPSD.PS +% +% ************************************************************************ + +systemdict begin + + /letter {statusdict begin 0 setpagetype end} def + /note {statusdict begin 1 setpagetype end} def + /legal {} def + /a4 {} def % not in original Red Book, + % but apparently standard now + + /statusdict 50 dict def + /serverdict 4 dict def + +end + +statusdict begin + + /checkpassword {statusdict begin .password eq end} def + /defaulttimeouts {statusdict begin .timeouts aload pop end} def +%/dostartpage + /eescratch {pop 0} def + /idlefonts {statusdict begin mark .idlefonts aload pop end} def + /jobname () def +%/jobtimeout + /manualfeed false def + /manualfeedtimeout 60 def + /margins {statusdict begin .topmargin .leftmargin end} def + /pagecount {4711} def + /pagestackorder {false} def +%/pagetype + /prefeed false def + /printererror {pop pop} def + /printername {statusdict begin .printername exch copy end} def + /product (Ghostscript) def + /revision 20100 def + /sccbatch {pop 9600 0} def + /sccinteractive {pop 9600 0} def + /setdefaulttimeouts {statusdict begin .timeouts astore pop end} def + /setdostartpage {statusdict exch /dostartpage exch put} def + /seteescratch {pop pop} def + /setidlefonts {] statusdict exch /.idlefonts exch put} def + /setjobtimeout {statusdict exch /jobtimeout exch put} def + /setmargins + {statusdict begin /.lmargin exch def /.topmargin exch def end} def + /setpagetype {statusdict exch /pagetype exch put} def + /setpassword + {exch checkpassword + {statusdict exch /.password exch put true} + {pop false} + ifelse} def + /setprintername + {dup length string copy statusdict exch /printername exch put} def + /setsccbatch {pop pop pop} def + /setsccinteractive {pop pop pop} def + /waittimeout 300 def + +/.password 0 def +/.timeouts [0 60 30] def +true setdostartpage +mark setidlefonts +0 setjobtimeout +0 0 setmargins +0 setpagetype +product setprintername + +end % statusdict + +% The following contents of serverdict are a complete guess, +% based on some observed LaserWriter boilerplate. + +serverdict begin + + /execjob { } def +% The Red Book implies that something like the following is +% an appropriate definition of exitserver. + /exitserver { clear stop } def +% However, this interacts badly with Ghostscript's present error handler, +% so we override it with the following less appropriate definition. + /exitserver { clear cleardictstack } def + /setrealdevice { } def + +end % serverdict diff --git a/03_Python_OpenSource_DXF/fonts/ACADPSF.PS b/03_Python_OpenSource_DXF/fonts/ACADPSF.PS new file mode 100644 index 0000000..b87c8eb --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/ACADPSF.PS @@ -0,0 +1,275 @@ +% Copyright (C) 1990, 1991 Aladdin Enterprises. All rights reserved. +% Distributed by Free Software Foundation, Inc. +% +% This file is part of Ghostscript. +% +% Ghostscript is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +% to anyone for the consequences of using it or for whether it serves any +% particular purpose or works at all, unless he says so in writing. Refer +% to the Ghostscript General Public License for full details. +% +% Everyone is granted permission to copy, modify and redistribute +% Ghostscript, but only under the conditions described in the Ghostscript +% General Public License. A copy of this license is supposed to have been +% given to you along with Ghostscript so you can know your rights and +% responsibilities. It should be in a file named COPYING. Among other +% things, the copyright notice and this notice must be preserved on all +% copies. + +% Font initialization for Ghostscript. Despite anything claimed below, +% Ghostscript fonts are actually in the same format as Adobe Type 1 fonts, +% except that the external form customarily does not use eexec encryption. +% Someday there will be GNU documentation that describes this format. +% Until then, you'll have to either get a copy of Adobe's book, or read +% the Ghostscript code. The interpreter for Type 1 fonts, which reveals +% most of their structure, is in the file gstype1.c. + +% +% *********************************************************************** +% * * +% * M M OOO DDDD III FFFFF III EEEEE DDDD * +% * MM MM O O D D I F I E D D * +% * M M M O O D D I F I E D D * +% * M M O O D D I FFF I EEE D D * +% * M M O O D D I F I E D D * +% * M M O O D D I F I E D D * +% * M M OOO DDDD III F III EEEEE DDDD * +% * * +% * * +% * FFFFF III L EEEEE * +% * F I L E * +% * F I L E * +% * FFF I L EEE * +% * F I L E * +% * F I L E * +% * F III LLLLL EEEEE * +% * * +% *********************************************************************** +% +% .-------------. +% | /\ | +% | / \ | +% | / /\ \ | +% | / / \ \ | +% | / / /\ \ \ | +% | / / / \ \ \| +% `-------------' (R) +% Autodesk, Inc. +% Tools For the Golden Age of Engineering +% +% In keeping with subparagraph 2a of the Gnu General Public License +% (Version 1, February 1989): +% +% 2. You may modify your copy or copies of the Program or any +% portion of it, and copy and distribute such modifications under +% the terms of Paragraph 1 above, provided that you also do the +% following: +% +% a) cause the modified files to carry prominent notices stating +% that you changed the files and the date of any change; and... +% +% the following is a summary of the changes to this file made by +% Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run +% as an ADS application and thereby to perform rendering of +% PostScript files within AutoCAD. +% +% ACADPSF.PS Ghostscript font loading procedures. Called +% GS_FONTS.PS in standard Ghostscript. +% +% Added handling for various strange characteristics of +% fonts encountered in the real world. +% +% Added exception handling when fontmap.ps has an incorrect +% entry, to prevent infinite recursion. +% ************************************************************************ + +% Define the default font. +/defaultfontname /Ugly def + + +% Internal procedure to load the font name -> font file name map +% if it isn't loaded already, and push it on the stack. +/Fontmap + { /FontFileMap where + { /FontFileMap get } + { (fontmap.ps) findlibfile not + { (Can't find ) print print (!\n) print stop } + if + + FontDirectory maxlength dict exch + 2 dict begin + mark exch 2 index exch + /; + { % The stack contains a mark, the dictionary, the font name, + % the file name, and additional information about the font. + counttomark 3 sub { pop } repeat put + 1 index + } bind def + run + end + pop pop % pop the mark and the copy of the dictionary + userdict exch /FontFileMap exch put + FontFileMap + } + ifelse + } bind def + + +% Define definefont. This is a procedure built on an operator that +% does all the error checking and key insertion. +/definefont + { 1 dict begin count /d exch def % save stack depth in case of error + { .buildfont readonly } stopped + { count d sub { pop } repeat end /invalidfont signalerror } + { end dup FontDirectory 4 2 roll put } + ifelse + } odef + +/GnernDict 1 dict def + +% Define findfont so it tries to load a font if it's not found. +/findfont + { + % If the key is a string, convert it to a name for lookup. + dup type /stringtype eq { cvn } if + + % If the font isn't in FontDirectory already, load it. + dup FontDirectory exch known + { FontDirectory exch get + } + { dup % save the font name on the stack + + % Push the font name -> font file name map on the stack, + % loading it if necessary. + Fontmap + + % Read the file name from the map. + % (The stack contains the font name and the font file map.) + 1 index known not + { QUIET not + { (Substituting ) print defaultfontname cvx =only + ( for unknown font ) print == flush + } { pop } ifelse + pop defaultfontname findfont + } + { FontFileMap exch get + + % If we can't find the file, substitute for the font. + dup findlibfile + % save the filename here; we'll need it if the load fails. + 2 index /savedfilename exch def + { QUIET not + { (Loading font file ) print exch print (... ) print flush } + { exch pop } + ifelse + + % + % Discard trash before PostScript sentinel + % + % Fonts that come with Adobe Type Manager have some + % trash binary bytes before the "%!" sentinel. Walk + % through the file and make sure we start reading at + % the sentinel. + % + { dup read + { 37 eq { dup read { 33 eq + { dup dup fileposition 2 sub setfileposition exit } + { unread } } { exit} ifelse + ifelse } if } + { exit } ifelse + } loop + % + % End discarding of trash before PostScript sentinel + % + + % Now it's time for some more adhocracy, another + % indulgence in Kelvinist predestination. It turns out + % that the various fonts we've accreted over the years + % obey no coherent conventions for what they leave or don't + % leave on the stack and some, based on the Adobe Type 1 + % encryption decoder, even leave marks on the stack. To + % guarantee that we emerge from the font code with the + % stack in a valid state, we save the stack depth in a + % variable then programmatically pop any trash off the + % stack when we're done. This is ugly, but it works + % with every font I've tried. + + count GnernDict begin /GnernK exch def end + + mark exch + systemdict begin run end % run can take a file + cleartomark + + % Now for the actial dirty work to put the stack back + % the way it was before we loaded the font. + + GnernDict begin + { count GnernK lt { exit } if pop} loop + end + + QUIET not + { vmstatus 3 { =only ( ) print } repeat + (done.\n) print flush + } if + + % OK, make sure the thing has really been loaded. + dup FontDirectory exch known not + { + % Oops. + (The font ) print =only + ( is not really in the file ) print + savedfilename =only + (\n) print flush + defaultfontname + } if + findfont + } + { pop 1 index defaultfontname eq + { (Can't find default font!\n) print + pop pop NullFont + } + { (Can't find font file ) print print + (, substituting ) print defaultfontname cvx =only + (.\n) print flush + pop defaultfontname findfont + } + ifelse + } + ifelse + } + ifelse + + } ifelse + + } bind def + + +% The CharStrings for a Ghostscript font are a dictionary in which +% the key is the character name, and the value is a compressed +% representation of a path, as produced by type1imagepath. +% For detailed information, see the book +% "Adobe Type 1 Font Format", published by Adobe Systems Inc. + +% Here is the BuildChar implementation +% for Type 1 (Ghostscript standard) fonts. +% The name Type1BuildChar is known to the interpreter. + +/Type1BuildChar + { exch begin + Encoding exch get + dup CharStrings exch known not + { QUIET not + { (Substituting .notdef for ) print = flush + } { pop } ifelse + /.notdef + } if + CharStrings exch get + PaintType 0 ne + { 1 setmiterlimit 1 setlinejoin 1 setlinecap + currentdict /StrokeWidth known { StrokeWidth } { 0 } ifelse + setlinewidth } + if + type1addpath % does a fill or stroke + end + } bind def diff --git a/03_Python_OpenSource_DXF/fonts/ACADPSI.PS b/03_Python_OpenSource_DXF/fonts/ACADPSI.PS new file mode 100644 index 0000000..605afed --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/ACADPSI.PS @@ -0,0 +1,820 @@ +% Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved. +% Distributed by Free Software Foundation, Inc. +% +% This file is part of Ghostscript. +% +% Ghostscript is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +% to anyone for the consequences of using it or for whether it serves any +% particular purpose or works at all, unless he says so in writing. Refer +% to the Ghostscript General Public License for full details. +% +% Everyone is granted permission to copy, modify and redistribute +% Ghostscript, but only under the conditions described in the Ghostscript +% General Public License. A copy of this license is supposed to have been +% given to you along with Ghostscript so you can know your rights and +% responsibilities. It should be in a file named COPYING. Among other +% things, the copyright notice and this notice must be preserved on all +% copies. + +% +% *********************************************************************** +% * * +% * M M OOO DDDD III FFFFF III EEEEE DDDD * +% * MM MM O O D D I F I E D D * +% * M M M O O D D I F I E D D * +% * M M O O D D I FFF I EEE D D * +% * M M O O D D I F I E D D * +% * M M O O D D I F I E D D * +% * M M OOO DDDD III F III EEEEE DDDD * +% * * +% * * +% * FFFFF III L EEEEE * +% * F I L E * +% * F I L E * +% * FFF I L EEE * +% * F I L E * +% * F I L E * +% * F III LLLLL EEEEE * +% * * +% *********************************************************************** +% +% .-------------. +% | /\ | +% | / \ | +% | / /\ \ | +% | / / \ \ | +% | / / /\ \ \ | +% | / / / \ \ \| +% `-------------' (R) +% Autodesk, Inc. +% Tools For the Golden Age of Engineering +% +% In keeping with subparagraph 2a of the Gnu General Public License +% (Version 1, February 1989): +% +% 2. You may modify your copy or copies of the Program or any +% portion of it, and copy and distribute such modifications under +% the terms of Paragraph 1 above, provided that you also do the +% following: +% +% a) cause the modified files to carry prominent notices stating +% that you changed the files and the date of any change; and... +% +% the following is a summary of the changes to this file made by +% Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run +% as an ADS application and thereby to perform rendering of +% PostScript files within AutoCAD. +% +% +% ACADPSI.PS I implemented a new procedure, "arun", which is used +% by the (PSGEN) function to run PostScript programs +% included with the PSIN command. "Arun" is a somewhat +% more intelligent version of "run" which accommodates +% variants of PostScript one encounters, especially on +% MS-DOS machines. If the binary "EPSF" header is +% present, used by desktop publishing programs which +% append a bitmap of the PostScript image to the file, +% arun recognises the sentinel, extracts the pointer to +% the bitmap from the header, and uses the new +% setsubfilelimit operator to logically truncate the +% file at that point. A setfileposition is then done to +% skip the header. To allow processing files with a few +% bytes of garbage before the "%!" sentinel, arun reads +% through the file searching for "%!", ignoring anything +% it finds before the sentinel. +% +% Ghostscript master initialisation file. Called +% GS_INIT.PS in standard Ghostscript. I added a new +% "acadpsversion" operator to return the local version +% of ACADPS ("2.2-ACADPS:Q001-JW1" in this release). I +% extended error handling to call "flagerrorhappened" so +% that the error code can be returned to the caller of +% (PSGEN). I changed the file name references to the +% ACADPSx.PS conventions and integrated the local code +% for ARUN, etc., from the version based on Ghostscript +% 2.1.1. I used the new NOPAUSE variable to suppress +% the pause in "copypage" and "showpage" rather than +% commenting out the user prompt as before. (New file.) +% +% +% ************************************************************************ + +% Initialization file for Ghostscript. +% When this is run, systemdict is still writable. + +% Acquire the debugging flags. +currentdict /DEBUG known /DEBUG exch def + /VMDEBUG + DEBUG {{vmstatus pop ( ) cvs print pop ( ) print + systemdict length ( ) cvs print (\n) print flush}} + {{}} ifelse + def +currentdict /NODISPLAY known not /DISPLAYING exch def +currentdict /NOBIND known { /.bind /bind load def /bind { } def } if +currentdict /NOCACHE known /NOCACHE exch def +currentdict /NOPAUSE known /NOPAUSE exch def +currentdict /QUIET known /QUIET exch def + +QUIET not { (Initializing... ) print flush } if + +% Acquire systemdict and userdict. +% Note that the dictionary stack only has 1 element at this point! +/systemdict currentdict def +/userdict 200 dict def +userdict begin % 2 elements now +systemdict begin + +VMDEBUG + +% Define true and false. +/true 0 0 eq def +/false 0 1 eq def + +% Turn on array packing for the rest of initialization. +true setpacking + +% Acquire the standard files. +/.stdin (%stdin) (r) file def +/.stdout (%stdout) (w) file def +/.stderr (%stderr) (w) file def + +% Define a special version of def for making operator procedures. +/odef + {1 index exch makeoperator def} bind def + +% Define predefined procedures substituting for operators, +% in alphabetical order. +/[ /mark load def +/] {counttomark array astore exch pop} odef +/abs {dup 0 lt {neg} if} odef +/cleardictstack + {countdictstack 2 sub {end} repeat} odef +/.copypage /copypage load def +/copypage + {.copypage + (>>copypage, press to continue<<\n) .confirm} odef +/defaultmatrix + {currentdevice exch deviceparams pop pop + counttomark 1 add 1 roll cleartomark} odef +/.echo /echo load def +userdict /.echo.mode true put +/echo {dup /.echo.mode exch store .echo} odef +/eexec {55665 exch type1decryptfile + cvx systemdict begin stopped end + $error /newerror get and {handleerror} if} odef +/executive + { { prompt (%statementedit) (r) file + dup bytesavailable 0 lt + { .stdin bytesavailable 0 lt {closefile exit} if } + if cvx execute + } loop + } odef +/framedevice + {.stderr (Warning: framedevice is an obsolete operator.\n) writestring + .stderr flushfile + pop pop pop setmatrix initclip} odef +/handleerror + {errordict /handleerror get exec} bind def +/identmatrix + {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} odef +/initgraphics + {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin + [] 0 setdash 0 setgray 10 setmiterlimit} odef +/initmatrix + {.tempmatrix defaultmatrix setmatrix} odef +/matrix {6 array identmatrix} odef +/prompt {flush flushpage + (GS) print count 0 ne + {(<) print count =only} + if (>) print flush} bind def +/pstack {0 1 count 3 sub {index ==} for} odef +/run {dup type /filetype eq { true } { findlibfile } ifelse + {cvx execute} + {(r) file} % let the error happen + ifelse} odef +/selectfont + { exch findfont exch + dup type /arraytype eq { makefont } { scalefont } ifelse + setfont + } odef +/showpage + {.copypage (>>showpage, press to continue<<\n) .confirm + erasepage initgraphics} odef +/stack {0 1 count 3 sub {index =} for} odef +/start { QUIET not + {(Ghostscript ) print .version print + ( Copyright (C) 1990, 1991 Aladdin Enterprises,\n) print + ( Menlo Park, CA. All rights reserved.\n) print + (Distributed by Free Software Foundation, Inc.\n) print + (Ghostscript comes with NO WARRANTY: see the file COPYING for details.\n) print + flush + } if + executive + } def +% Define version so it prints a warning once, for programs that think that +% they are going to get an Adobe interpreter version. +/version + { <00> % Flag to make sure we only do this once + dup 0 get 0 eq + { .stderr (Warning -- Ghostscript version #s are not the same as Adobe version #s.\n) writestring + .stderr flushfile + 0 1 put + } + { pop } + ifelse .version + } odef +/.version + (2.2) def + +% ACADPS version string, including base Ghostscript version +/acadpsversion + (2.2-ACADPS:Q001-JW1) def + +% Provide semi-fake but usable definitions for +% the color PostScript extensions (except for colorimage, +% which is actually implemented as an operator). +/setcmykcolor { + 1 exch sub dup dup % C, M, Y, S, S, S + 6 -1 roll 1 exch sub mul % M, Y, S, S, red + exch 5 -1 roll 1 exch sub mul % Y, S, red, green + 4 -2 roll exch 1 exch sub mul % red, green, blue + setrgbcolor +} odef +/currentcmykcolor { + currentrgbcolor + 3 { 1 exch sub 3 1 roll } repeat + 0 +} odef +/setblackgeneration { + pop +} odef +/currentblackgeneration { + {} +} odef +/setundercolorremoval { + pop +} odef +/currentundercolorremoval { + {} +} odef +/setcolorscreen { + setscreen 9 {pop} repeat +} odef +/currentcolorscreen { + currentscreen 3 copy 6 copy +} odef + +% Define some additional built-in procedures (beyond the ones defined by +% the PostScript Language Reference Manual). +/concatprocs + { exch cvlit exch cvlit % proc1 proc2 + dup length 2 index length add array % proc1 proc2 newproc + dup 0 4 index putinterval + dup 3 index length 3 index putinterval + exch pop exch pop cvx + } bind def +/concatstrings + { 1 index length 1 index length add string + 2 index 1 index copy pop + dup 3 index length 3 index length getinterval + 2 index exch copy pop + exch pop exch pop + } bind def +/copyarray + { dup length array copy } bind def +/copystring + { dup length string copy } bind def +/defaultdevice + { systemdict /DEVICE known + { systemdict /DEVICE get finddevice } + { 0 getdevice } + ifelse + } bind def +/finddevice + { systemdict /devicedict get exch get } bind def +/rgbcolor + { gsave setrgbcolor currentgscolor grestore } bind def +/selectdevice + { finddevice setdevice } bind def +/signalerror % object errorname + { errordict exch get exec } bind def + +% Define auxiliary procedures needed for the above. +/shellarguments % -> shell_arguments true (or) false + { /ARGUMENTS where + { /ARGUMENTS get dup type /arraytype eq + { aload pop /ARGUMENTS null store true } + { pop false } + ifelse } + { false } ifelse + } bind def +/.confirm + {DISPLAYING NOPAUSE not and + {% Print a message and wait for the user to type something. + % If the user just types a newline, flush it. + print flush + .echo.mode false echo + .stdin dup read + {dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse + echo} + {pop} ifelse} bind def +/.identmatrix % a read-only identity matrix + matrix readonly def +/.tempmatrix % a temporary matrix + matrix def + +% Define the procedure used by the C executive for executing user input, +% and also by the run operator. +% This is called with a procedure or file on the operand stack. +/execute + {stopped $error /newerror get and {handleerror} if} odef + +% Create the error handling machinery. +% The interpreter has created the ErrorNames array. +% Define $error. +/$error 11 dict def % newerror, errorname, command, errorinfo, + % ostack, estack, dstack, recordstacks, + % binary, .inerror, position +$error begin + /newerror false def + /recordstacks true def + /binary false def + /.inerror false def +end +% Define errordict. It has one entry per error name, plus handleerror. +/errordict ErrorNames length 1 add dict def +% Define the standard error handlers. When they are invoked, +% the top element of the o-stack is the error name; +% the next element is the offending command. +errordict begin + { //$error /.inerror get .instopped not or + { (Unrecoverable error: ) print =only flush + ( in ) print = flush + count 0 gt + { (Operand stack:\n ) print + 0 1 count 3 sub { ( ) print index =only flush } for + (\n) print flush + } if + quit + } if % detect error recursion + $error /.inerror true put + $error /newerror true put + $error exch /errorname exch put + $error exch /command exch put + $error /dstack undef + $error /estack undef + $error /ostack undef + $error /recordstacks get $error /errorname get /VMerror ne and + { $error /dstack countdictstack array dictstack put + $error /estack countexecstack array execstack put + count array astore dup $error exch /ostack exch put + aload pop + } if + $error /.inerror false put + stop + } bind + ErrorNames + { [ 1 index 3 index /exec load ] cvx def + } forall + pop +end +% Define the standard handleerror. +errordict +begin + /handleerror + { + $error + begin + errorname (interrupt) eq + { + % Do not print out error messages and stack traces + % for interrupts; PSIN, if anyone, has that job. + } + { + (Error: ) print + errorname ==only flush + ( in ) print + /command load ==only flush + currentdict /ostack known + { + (\nOperand stack:\n ) print ostack { + ( ) print ==only + } forall + } if + currentdict /estack known + { + (\nExecution stack:\n ) print estack { + ( ) print =only + } forall + } if + currentdict /dstack known + { + (\nDictionary stack:\n ) print dstack + { + dup ( ) print length =only (/) print maxlength =only + } forall + } if + (\n) print + } ifelse + flagerrorhappened + /newerror false def + end + currentdict /position known + { + (Current file position is ) print position = + } + if + flush + .instopped { + stop + } if + } bind def +end + +% Define the =[only] procedures. Also define =print and =string, +% which are used by some P*stScr*pt programs even though +% they aren't documented anywhere. +/=print {=only} def +/=string 128 string def +/= {=only (\n) print} bind def +4 dict begin + /.buf =string def + /.print + {dup type currentdict exch known + {dup type exec} {.buf cvs print} ifelse + } bind def + /stringtype + {dup rcheck not {pop (--nostringval--)} if print} bind def + /nametype + {dup length .buf length gt + {dup length string} + {.buf} + ifelse cvs print} bind def +{0 begin .print end} copyarray dup 0 currentdict put + cvx bind +end +/=only exch def + +% Define the [write]==[only] procedures. +/== {==only (\n) print} bind def +/==only {.stdout exch write==only} bind def +/write== + {2 copy write==only pop (\n) writestring} bind def +/.dict 17 dict dup +begin def + /.buf 128 string def + /.cvp {.buf cvs .p} bind def +% /.f {the_output_file} def + /.nop {(-) .p type .cvp (-) .p} bind def + /.p {.f exch writestring} bind def + /.p1 {.f exch write} bind def + /.print + {dup type .dict exch known + {dup type exec} {.nop} ifelse + } bind def + /integertype /.cvp load def + /realtype /.cvp load def + /booleantype /.cvp load def + /nametype + {dup xcheck not {(/) .p} if + dup length .buf length gt + {dup length string} + {.buf} + ifelse cvs .p} bind def + /arraytype + {dup rcheck + {dup xcheck {(})({)} {(])([)} ifelse .p + exch () exch + {exch .p .print ( )} forall pop .p} + {.nop} + ifelse} bind def + /operatortype + {(--) .p .cvp (--) .p} bind def + /packedarraytype /arraytype load def + /stringtype + {dup rcheck + {(\() .p + {/.ch exch def + .ch 32 lt .ch 127 ge or + {(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p} + {.ch 40 eq .ch 41 eq or .ch 92 eq or + {(\\) .p} if + .ch .p1} + ifelse} + forall (\)) .p} + {.nop} + ifelse} bind def +{0 begin exch cvlit /.f exch def .print end} copyarray dup 0 .dict put + bind cvx +end +/write==only exch def + +VMDEBUG + +% Define the font directory. +% Make it big to leave room for transformed fonts. +/FontDirectory 100 dict def + +% Define the standard encoding vector. +/StandardEncoding +% \00x + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% \04x + /space /exclam /quotedbl /numbersign + /dollar /percent /ampersand /quoteright + /parenleft /parenright /asterisk /plus + /comma /hyphen /period /slash + /zero /one /two /three + /four /five /six /seven + /eight /nine /colon /semicolon + /less /equal /greater /question +% \10x + /at /A /B /C /D /E /F /G + /H /I /J /K /L /M /N /O + /P /Q /R /S /T /U /V /W + /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore +% \14x + /quoteleft /a /b /c /d /e /f /g + /h /i /j /k /l /m /n /o + /p /q /r /s /t /u /v /w + /x /y /z /braceleft /bar /braceright /asciitilde /.notdef +% \20x + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% \24x + /.notdef /exclamdown /cent /sterling + /fraction /yen /florin /section + /currency /quotesingle /quotedblleft /guillemotleft + /guilsinglleft /guilsinglright /fi /fl + /.notdef /endash /dagger /daggerdbl + /periodcentered /.notdef /paragraph /bullet + /quotesinglbase /quotedblbase /quotedblright /guillemotright + /ellipsis /perthousand /.notdef /questiondown +% \30x + /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent + /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron + /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% \34x + /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef + /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef + /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef + /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef +256 packedarray def + +% Define the ISO Latin-1 encoding vector. +% The first half is the same as the standard encoding. +/ISOLatin1Encoding +StandardEncoding 0 128 getinterval aload pop +%****** NOTE: the following are missing in the Adobe documentation, +%****** but appear in the displayed table: +%****** macron at 225, dieresis at 230, cedilla at 233, space at 240. +% \20x + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent + /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron +% \24x + /space /exclamdown /cent /sterling + /currency /yen /brokenbar /section + /dieresis /copyright /ordfeminine /guillemotleft + /logicalnot /hyphen /registered /macron + /degree /plusminus /twosuperior /threesuperior + /acute /mu /paragraph /periodcentered + /cedilla /onesuperior /ordmasculine /guillemotright + /onequarter /onehalf /threequarters /questiondown +% \30x + /Agrave /Aacute /Acircumflex /Atilde + /Adieresis /Aring /AE /Ccedilla + /Egrave /Eacute /Ecircumflex /Edieresis + /Igrave /Iacute /Icircumflex /Idieresis + /Eth /Ntilde /Ograve /Oacute + /Ocircumflex /Otilde /Odieresis /multiply + /Oslash /Ugrave /Uacute /Ucircumflex + /Udieresis /Yacute /Thorn /germandbls +% \34x + /agrave /aacute /acircumflex /atilde + /adieresis /aring /ae /ccedilla + /egrave /eacute /ecircumflex /edieresis + /igrave /iacute /icircumflex /idieresis + /eth /ntilde /ograve /oacute + /ocircumflex /otilde /odieresis /divide + /oslash /ugrave /uacute /ucircumflex + /udieresis /yacute /thorn /ydieresis +256 packedarray def + +% Define a stub for the Symbol encoding. +userdict begin + /SymbolEncoding + { userdict begin (acadpss.ps) run /SymbolEncoding load end + } bind def +end + +% Construct a dictionary of all available devices. +mark + % Loop until the getdevice gets a rangecheck. + 0 { {dup getdevice exch 1 add} loop} stopped pop + dict /devicedict exch def + devicedict begin % 2nd copy of count is on stack + { dup devicename cvn dup 3 -1 roll def + counttomark 1 roll + } repeat + end +] /devicenames exch def +$error /newerror false put % remove error indication + +% Define a special version of `run' that aborts on errors. +/run0 + { dup /.currentfilename exch def + { findlibfile not { stop } if } stopped + { pop (Can't find initialization file ) print = flush quit } if + cvx stopped + { (While reading ) print .currentfilename print (:\n) print flush + handleerror quit + } if + } bind def + +% Internal procedure used by ARUN to read a 32 bit word in Intel +% byte order. Not fast, but squeaky-clean PostScript wise. Leaves +% the file positioned after the value read. + +/.arunRlong { % fileid -- integer + dup read pop + 1 index read pop 8 bitshift or + 1 index read pop 16 bitshift or + 1 index read pop 24 bitshift or + exch pop +} bind def + +% Pseudo-intelligent version of RUN. This version accepts all the +% odd crypto-PostScript files one sees in the real world. It knows +% about positioning over the binary EPSF header tacked on for +% PostScript annotated with bitmap images, and if all else fails it +% will scan over garbage in a file until it finds the file sentinel. + +/arun {dup type /filetype eq { true } { findlibfile } ifelse + + % Test for the EPSF binary sentinel + + { dup .arunRlong 16#C6D3D0C5 eq + { + % Matched binary sentinel. Position past it +% (Position past binary EPSF header\n) print flush + dup .arunRlong % PostScript code start address + 1 index .arunRlong % PostScript code length + 1 index add % Calculate end of PostScript text + 2 index exch setsubfilelimit % Set logical EOF at text end + 1 index exch setfileposition % Seek to start of PostScript + true + } + { + % This is not actually a binary EPSF sentinel. Seek + % back to the start of the file. +% (No EPSF Header\n) print flush + dup 0 setfileposition + false + } + ifelse + not + { +% (Searching for %!\n) print flush + { dup read + { 37 eq { dup read { 33 eq + { dup dup fileposition 2 sub setfileposition exit } + { unread } } { exit} ifelse + ifelse } if } + { exit } ifelse + } loop + + } if + cvx execute + } + {(r) file} % let the error happen + ifelse +} bind def + +% Define statusdict, for the benefit of programs +% that think they are running on a LaserWriter or similar printer. +(acadpsd.ps) run0 + +% Load the initialization files for optional features. +[ (acadpsc.ps) run0 ] % a list of file names + { run0 } forall + +% Establish a default upper limit in the character cache, +% namely, 10 times the average expected character size. +mark + cachestatus 5 index 10 mul 2 index 1 max idiv % bmax, cmax + mark exch dup 10 idiv exch setcacheparams +cleartomark +% Conditionally disable the character cache. +NOCACHE { 1 setcachelimit } if + +VMDEBUG + +% Load the standard font environment. +(acadpsf.ps) run0 + +% Create a null font. This is the initial font. +7 dict dup begin + /FontMatrix [ 1 0 0 1 0 0 ] def + /FontType 3 def + /FontName () def + /Encoding StandardEncoding def + /FontBBox [ 0 0 0 0 ] cvx def % cvx is bogus, but customary ... + /BuildChar { pop pop 0 0 setcharwidth } bind def +end +/NullFont exch definefont setfont +% Define NullFont as the font, but remove it from FontDirectory. +/NullFont currentfont def +FontDirectory /NullFont undef + +% Bind all the operators defined as procedures. +systemdict + { dup type /operatortype eq + { % This might be a real operator, so bind might cause a typecheck. + { bind } stopped pop + $error /newerror false put % remove error indication + } + if pop pop + } forall + +% Close up systemdict. +end +systemdict readonly pop + +% Establish a default environment. +DISPLAYING + { defaultdevice + systemdict /DEVICEWIDTH known systemdict /DEVICEHEIGHT known or + { matrix deviceparams + exch /DEVICEWIDTH where + { pop pop DEVICEWIDTH } + if + exch /DEVICEHEIGHT where + { pop pop DEVICEHEIGHT + % Replace the Y translation if the Y axis is inverted + 2 index 5 get 0 gt + { 2 index 5 2 index put + } + if + } + if + defaultdevice 4 1 roll makedevice + counttomark 1 add 1 roll cleartomark + } + if setdevice % does an erasepage + } + { nulldevice + } +ifelse +1 setflat % initgraphics doesn't set this +{ } settransfer % ditto +% The following 'ordered dither' spot function was contributed by +% Gregg Townsend. Thanks, Gregg! + 72 72 dtransform abs exch abs min % min(|dpi x|,|dpi y|) + 16.001 div 0 % not 16: avoids rounding problems + { 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add < + 0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4 + CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64 + 3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94 + FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54 + 01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB + C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B + 31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B + F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B + 0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7 + CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67 + 3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97 + FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57 + 02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8 + C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68 + 32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98 + F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58 + > exch get 256 div } bind setscreen +initgraphics +% The interpreter relies on there being at least 2 entries +% on the graphics stack. Establish the second one now. +gsave + +VMDEBUG + +% Define control-D as a no-op. This is a hack to get around problems +% in some common P*stScr*pt-generating applications. +(\004) cvn { } def + +% Turn off array packing for interactive use. +false setpacking + +QUIET not { (done.\n) print flush } if + +% Set no pause on copypage and showpage +/NOPAUSE true def + +% The interpreter will run the initial procedure (start). diff --git a/03_Python_OpenSource_DXF/fonts/ACADPSS.PS b/03_Python_OpenSource_DXF/fonts/ACADPSS.PS new file mode 100644 index 0000000..2df9e42 --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/ACADPSS.PS @@ -0,0 +1,140 @@ +% Copyright (C) 1991 Aladdin Enterprises. All rights reserved. +% Distributed by Free Software Foundation, Inc. +% +% This file is part of Ghostscript. +% +% Ghostscript is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +% to anyone for the consequences of using it or for whether it serves any +% particular purpose or works at all, unless he says so in writing. Refer +% to the Ghostscript General Public License for full details. +% +% Everyone is granted permission to copy, modify and redistribute +% Ghostscript, but only under the conditions described in the Ghostscript +% General Public License. A copy of this license is supposed to have been +% given to you along with Ghostscript so you can know your rights and +% responsibilities. It should be in a file named COPYING. Among other +% things, the copyright notice and this notice must be preserved on all +% copies. + +% +% *********************************************************************** +% * * +% * M M OOO DDDD III FFFFF III EEEEE DDDD * +% * MM MM O O D D I F I E D D * +% * M M M O O D D I F I E D D * +% * M M O O D D I FFF I EEE D D * +% * M M O O D D I F I E D D * +% * M M O O D D I F I E D D * +% * M M OOO DDDD III F III EEEEE DDDD * +% * * +% * * +% * FFFFF III L EEEEE * +% * F I L E * +% * F I L E * +% * FFF I L EEE * +% * F I L E * +% * F I L E * +% * F III LLLLL EEEEE * +% * * +% *********************************************************************** +% +% .-------------. +% | /\ | +% | / \ | +% | / /\ \ | +% | / / \ \ | +% | / / /\ \ \ | +% | / / / \ \ \| +% `-------------' (R) +% Autodesk, Inc. +% Tools For the Golden Age of Engineering +% +% In keeping with subparagraph 2a of the Gnu General Public License +% (Version 1, February 1989): +% +% 2. You may modify your copy or copies of the Program or any +% portion of it, and copy and distribute such modifications under +% the terms of Paragraph 1 above, provided that you also do the +% following: +% +% a) cause the modified files to carry prominent notices stating +% that you changed the files and the date of any change; and... +% +% the following is a summary of the changes to this file made by +% Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run +% as an ADS application and thereby to perform rendering of +% PostScript files within AutoCAD. +% +% ACADPSS.PS Ghostscript symbol font encoding vector. Called +% SYMBOL_E.PS in standard Ghostscript. +% +% ************************************************************************ + +% Define the Symbol encoding vector. +/SymbolEncoding +% \000 + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% \040 + /space /exclam /universal /numbersign + /existential /percent /ampersand /suchthat + /parenleft /parenright /asteriskmath /plus + /comma /minus /period /slash + /zero /one /two /three + /four /five /six /seven + /eight /nine /colon /semicolon + /less /equal /greater /question +% \100 + /congruent /Alpha /Beta /Chi + /Delta /Epsilon /Phi /Gamma + /Eta /Iota /theta1 /Kappa + /Lambda /Mu /Nu /Omicron + /Pi /Theta /Rho /Sigma + /Tau /Upsilon /sigma1 /Omega + /Xi /Psi /Zeta /bracketleft + /therefore /bracketright /perpendicular /underscore +% \140 + /radicalex /alpha /beta /chi + /delta /epsilon /phi /gamma + /eta /iota /phi1 /kappa + /lambda /mu /nu /omicron + /pi /theta /rho /sigma + /tau /upsilon /omega1 /omega + /xi /psi /zeta /braceleft + /bar /braceright /similar /.notdef +% \200 + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% \240 + /.notdef /Upsilon1 /minute /lessequal + /fraction /infinity /florin /club + /diamond /heart /spade /arrowboth + /arrowleft /arrowup /arrowright /arrowdown + /degree /plusminus /second /greaterequal + /multiply /proportional /partialdiff /bullet + /divide /notequal /equivalence /approxequal + /ellipsis /arrowvertex /arrowhorizex /carriagereturn +% \300 + /aleph /Ifraktur /Rfraktur /weierstrass + /circlemultiply /circleplus /emptyset /intersection + /union /propersuperset /reflexsuperset /notsubset + /propersubset /reflexsubset /element /notelement + /angle /gradient /registerserif /copyrightserif + /trademarkserif /product /radical /dotmath + /logicalnot /logicaland /logicalor /arrowdblboth + /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown +% \340 + /lozenge /angleleft /registersans /copyrightsans + /trademarksans /summation /parenlefttp /parenleftex + /parenleftbt /bracketlefttp /bracketleftex /bracketleftbt + /bracelefttp /braceleftmid /braceleftbt /braceex + /.notdef /angleright /integral /integraltp + /integralex /integralbt /parenrighttp /parenrightex + /parenrightbt /bracketrighttp /bracketrightex /bracketrightbt + /bracerighttp /bracerightmid /bracerightbt /.notdef +256 packedarray def diff --git a/03_Python_OpenSource_DXF/fonts/ACE.SHX b/03_Python_OpenSource_DXF/fonts/ACE.SHX new file mode 100644 index 0000000..e321353 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ACE.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/AHZTXT.SHX b/03_Python_OpenSource_DXF/fonts/AHZTXT.SHX new file mode 100644 index 0000000..a377275 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/AHZTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/AMDTSymbols.shx b/03_Python_OpenSource_DXF/fonts/AMDTSymbols.shx new file mode 100644 index 0000000..1411f73 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/AMDTSymbols.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/AMGDT DWE Edits.shx b/03_Python_OpenSource_DXF/fonts/AMGDT DWE Edits.shx new file mode 100644 index 0000000..5b3bf37 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/AMGDT DWE Edits.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/AMGDTANS DWE Edits.shx b/03_Python_OpenSource_DXF/fonts/AMGDTANS DWE Edits.shx new file mode 100644 index 0000000..cb3a030 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/AMGDTANS DWE Edits.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/AcadEref.shx b/03_Python_OpenSource_DXF/fonts/AcadEref.shx new file mode 100644 index 0000000..992d395 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/AcadEref.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/CDM_NC.SHX b/03_Python_OpenSource_DXF/fonts/CDM_NC.SHX new file mode 100644 index 0000000..e328ba0 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CDM_NC.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/CHAR_FAST_FONT.shx b/03_Python_OpenSource_DXF/fonts/CHAR_FAST_FONT.shx new file mode 100644 index 0000000..098366d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CHAR_FAST_FONT.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/CIBT____.PFM b/03_Python_OpenSource_DXF/fonts/CIBT____.PFM new file mode 100644 index 0000000..c16f039 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CIBT____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/CIBT____.SHX b/03_Python_OpenSource_DXF/fonts/CIBT____.SHX new file mode 100644 index 0000000..1169249 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CIBT____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/COBT____.PFM b/03_Python_OpenSource_DXF/fonts/COBT____.PFM new file mode 100644 index 0000000..ce88871 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/COBT____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/COBT____.SHX b/03_Python_OpenSource_DXF/fonts/COBT____.SHX new file mode 100644 index 0000000..e328a39 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/COBT____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/COMPLEX9.SHX b/03_Python_OpenSource_DXF/fonts/COMPLEX9.SHX new file mode 100644 index 0000000..fe81750 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/COMPLEX9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/CTXT.SHX b/03_Python_OpenSource_DXF/fonts/CTXT.SHX new file mode 100644 index 0000000..1e9039f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/CYRILLIC.SHX b/03_Python_OpenSource_DXF/fonts/CYRILLIC.SHX new file mode 100644 index 0000000..75c1304 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CYRILLIC.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/CYRILTLC.SHX b/03_Python_OpenSource_DXF/fonts/CYRILTLC.SHX new file mode 100644 index 0000000..7a585b5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/CYRILTLC.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Caed.shx b/03_Python_OpenSource_DXF/fonts/Caed.shx new file mode 100644 index 0000000..6ce20d4 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Caed.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Cdm.shx b/03_Python_OpenSource_DXF/fonts/Cdm.shx new file mode 100644 index 0000000..f070144 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Cdm.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/China.SHX b/03_Python_OpenSource_DXF/fonts/China.SHX new file mode 100644 index 0000000..be014cf Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/China.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Cthc.shx b/03_Python_OpenSource_DXF/fonts/Cthc.shx new file mode 100644 index 0000000..a4d8a4a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Cthc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/DXFS.SHX b/03_Python_OpenSource_DXF/fonts/DXFS.SHX new file mode 100644 index 0000000..4b9a081 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/DXFS.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Dfst.shx b/03_Python_OpenSource_DXF/fonts/Dfst.shx new file mode 100644 index 0000000..5d665a2 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Dfst.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Dft.shx b/03_Python_OpenSource_DXF/fonts/Dft.shx new file mode 100644 index 0000000..b7a36bc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Dft.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ENGINEERING.shx b/03_Python_OpenSource_DXF/fonts/ENGINEERING.shx new file mode 100644 index 0000000..9f50f5f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ENGINEERING.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/EQ_C.SHX b/03_Python_OpenSource_DXF/fonts/EQ_C.SHX new file mode 100644 index 0000000..da89b5a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EQ_C.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/EQ_E.SHX b/03_Python_OpenSource_DXF/fonts/EQ_E.SHX new file mode 100644 index 0000000..1fa2cb9 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EQ_E.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/EURO____.PFM b/03_Python_OpenSource_DXF/fonts/EURO____.PFM new file mode 100644 index 0000000..64ee9ce Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EURO____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/EURO____.SHX b/03_Python_OpenSource_DXF/fonts/EURO____.SHX new file mode 100644 index 0000000..7217e40 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EURO____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/EUR_____.PFM b/03_Python_OpenSource_DXF/fonts/EUR_____.PFM new file mode 100644 index 0000000..34e14b5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EUR_____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/EUR_____.SHX b/03_Python_OpenSource_DXF/fonts/EUR_____.SHX new file mode 100644 index 0000000..a2a0537 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/EUR_____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/FS64F.SHX b/03_Python_OpenSource_DXF/fonts/FS64F.SHX new file mode 100644 index 0000000..19060ca Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/FS64F.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/FSDB.SHX b/03_Python_OpenSource_DXF/fonts/FSDB.SHX new file mode 100644 index 0000000..6c0f10a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/FSDB.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Fangsong_GB2312.SHX b/03_Python_OpenSource_DXF/fonts/Fangsong_GB2312.SHX new file mode 100644 index 0000000..b735acc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Fangsong_GB2312.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Fhz.shx b/03_Python_OpenSource_DXF/fonts/Fhz.shx new file mode 100644 index 0000000..4bd0956 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Fhz.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Fst.shx b/03_Python_OpenSource_DXF/fonts/Fst.shx new file mode 100644 index 0000000..1ee82ed Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Fst.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/GBHZFS.shx b/03_Python_OpenSource_DXF/fonts/GBHZFS.shx new file mode 100644 index 0000000..bf91a78 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GBHZFS.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/GBXWXT.shx b/03_Python_OpenSource_DXF/fonts/GBXWXT.shx new file mode 100644 index 0000000..a694006 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GBXWXT.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/GENISO.SHX b/03_Python_OpenSource_DXF/fonts/GENISO.SHX new file mode 100644 index 0000000..55cae2c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GENISO.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GENLTSHP.SHX b/03_Python_OpenSource_DXF/fonts/GENLTSHP.SHX new file mode 100644 index 0000000..16f878c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GENLTSHP.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GENPRESE.SHX b/03_Python_OpenSource_DXF/fonts/GENPRESE.SHX new file mode 100644 index 0000000..63ec8e6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GENPRESE.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GHCHN.SHX b/03_Python_OpenSource_DXF/fonts/GHCHN.SHX new file mode 100644 index 0000000..6d98502 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GHCHN.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GOTHICE9.SHX b/03_Python_OpenSource_DXF/fonts/GOTHICE9.SHX new file mode 100644 index 0000000..432eb05 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GOTHICE9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GOTHICG9.SHX b/03_Python_OpenSource_DXF/fonts/GOTHICG9.SHX new file mode 100644 index 0000000..cc085de Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GOTHICG9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/GOTHICI9.SHX b/03_Python_OpenSource_DXF/fonts/GOTHICI9.SHX new file mode 100644 index 0000000..c544c38 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/GOTHICI9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Gbtxt.shx b/03_Python_OpenSource_DXF/fonts/Gbtxt.shx new file mode 100644 index 0000000..39e4f67 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Gbtxt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/HJTXT.SHX b/03_Python_OpenSource_DXF/fonts/HJTXT.SHX new file mode 100644 index 0000000..e76fb35 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HJTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HT64F.SHX b/03_Python_OpenSource_DXF/fonts/HT64F.SHX new file mode 100644 index 0000000..282774f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HT64F.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZ.SHX b/03_Python_OpenSource_DXF/fonts/HZ.SHX new file mode 100644 index 0000000..ee9dfba Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZ.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZASC.SHX b/03_Python_OpenSource_DXF/fonts/HZASC.SHX new file mode 100644 index 0000000..2463209 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZASC.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZDX.SHX b/03_Python_OpenSource_DXF/fonts/HZDX.SHX new file mode 100644 index 0000000..1e9039f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZDX.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZFS_1.SHX b/03_Python_OpenSource_DXF/fonts/HZFS_1.SHX new file mode 100644 index 0000000..5d58f8e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZFS_1.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZHT.SHX b/03_Python_OpenSource_DXF/fonts/HZHT.SHX new file mode 100644 index 0000000..29574b3 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZHT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZJ.SHX b/03_Python_OpenSource_DXF/fonts/HZJ.SHX new file mode 100644 index 0000000..e71cb5f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZJ.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZKT.SHX b/03_Python_OpenSource_DXF/fonts/HZKT.SHX new file mode 100644 index 0000000..54a2001 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZKT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZST.SHX b/03_Python_OpenSource_DXF/fonts/HZST.SHX new file mode 100644 index 0000000..fa5ca34 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZST.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZTXT.SHX b/03_Python_OpenSource_DXF/fonts/HZTXT.SHX new file mode 100644 index 0000000..a7c92dd Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZTXT2.SHX b/03_Python_OpenSource_DXF/fonts/HZTXT2.SHX new file mode 100644 index 0000000..430200f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZTXT2.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZTXT3.SHX b/03_Python_OpenSource_DXF/fonts/HZTXT3.SHX new file mode 100644 index 0000000..b735acc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZTXT3.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZTXTF.SHX b/03_Python_OpenSource_DXF/fonts/HZTXTF.SHX new file mode 100644 index 0000000..1fdec07 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZTXTF.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/HZTXTSB.SHX b/03_Python_OpenSource_DXF/fonts/HZTXTSB.SHX new file mode 100644 index 0000000..79bdba0 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HZTXTSB.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Hzfs.shx b/03_Python_OpenSource_DXF/fonts/Hzfs.shx new file mode 100644 index 0000000..0d03790 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Hzfs.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/HzfsOrg.shx b/03_Python_OpenSource_DXF/fonts/HzfsOrg.shx new file mode 100644 index 0000000..aad4342 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/HzfsOrg.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Hzlib.shx b/03_Python_OpenSource_DXF/fonts/Hzlib.shx new file mode 100644 index 0000000..335d087 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Hzlib.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/INTL_ISO.shx b/03_Python_OpenSource_DXF/fonts/INTL_ISO.shx new file mode 100644 index 0000000..069ef3d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/INTL_ISO.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ISO.SHX b/03_Python_OpenSource_DXF/fonts/ISO.SHX new file mode 100644 index 0000000..ccc8879 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ISO.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ISO9.SHX b/03_Python_OpenSource_DXF/fonts/ISO9.SHX new file mode 100644 index 0000000..621607b Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ISO9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ITALIC8.SHX b/03_Python_OpenSource_DXF/fonts/ITALIC8.SHX new file mode 100644 index 0000000..4bb7afc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ITALIC8.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ITALIC9.SHX b/03_Python_OpenSource_DXF/fonts/ITALIC9.SHX new file mode 100644 index 0000000..fa54a29 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ITALIC9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ITALICC9.SHX b/03_Python_OpenSource_DXF/fonts/ITALICC9.SHX new file mode 100644 index 0000000..9b898fc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ITALICC9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ITALICS.shx b/03_Python_OpenSource_DXF/fonts/ITALICS.shx new file mode 100644 index 0000000..e7eb86d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ITALICS.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ITALICT9.SHX b/03_Python_OpenSource_DXF/fonts/ITALICT9.SHX new file mode 100644 index 0000000..7a11c32 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ITALICT9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/Intecad.shx b/03_Python_OpenSource_DXF/fonts/Intecad.shx new file mode 100644 index 0000000..6d98502 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Intecad.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/KHZ.SHX b/03_Python_OpenSource_DXF/fonts/KHZ.SHX new file mode 100644 index 0000000..5a35a27 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/KHZ.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/KT.SHX b/03_Python_OpenSource_DXF/fonts/KT.SHX new file mode 100644 index 0000000..99e461a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/KT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/KT64F.SHX b/03_Python_OpenSource_DXF/fonts/KT64F.SHX new file mode 100644 index 0000000..c182254 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/KT64F.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/KTF.SHX b/03_Python_OpenSource_DXF/fonts/KTF.SHX new file mode 100644 index 0000000..5e684f8 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/KTF.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/LB.SHX b/03_Python_OpenSource_DXF/fonts/LB.SHX new file mode 100644 index 0000000..5bb81bf Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/LB.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/LTYPESHP.SHX b/03_Python_OpenSource_DXF/fonts/LTYPESHP.SHX new file mode 100644 index 0000000..5f46bd8 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/LTYPESHP.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/LYTXT.SHX b/03_Python_OpenSource_DXF/fonts/LYTXT.SHX new file mode 100644 index 0000000..59f01a8 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/LYTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/MONOTXT8.SHX b/03_Python_OpenSource_DXF/fonts/MONOTXT8.SHX new file mode 100644 index 0000000..b9826b5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/MONOTXT8.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/MONOTXT9.SHX b/03_Python_OpenSource_DXF/fonts/MONOTXT9.SHX new file mode 100644 index 0000000..5921017 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/MONOTXT9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/MstnFontConfig.xml b/03_Python_OpenSource_DXF/fonts/MstnFontConfig.xml new file mode 100644 index 0000000..e55318d --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/MstnFontConfig.xml @@ -0,0 +1,276 @@ + + + + + + English + Standard + Arial + simplex,msdefault + bigfont,kanjibig + + + + Japanese + Kanji + MS Gothic + kanji + bigfont,kanjibig + True + + + + SimpChinese + Standard + SimSun + simplex,msdefault + gbcbig + True + + + + TradChinese + chinese_traditional + MingLiU + tradch + chineset + True + + + + Korean + Gothic_single + GulimChe + kor + whgtxt,korbig + True + + + + Arabic + Standard + Arial + simplex,msdefault + bigfont,kanjibig + 2 + + + + Hebrew + Standard + Arial + simplex,msdefault + bigfont,kanjibig + 1 + + + + Thai + Standard + Arial + simplex,msdefault + bigfont,kanjibig + 3 + + + + Vietnamese + Standard + Arial + simplex,msdefault + bigfont,kanjibig + + + + + + + + architectural,block_outline,char_fast_font,compressed,engineering,fancy,iso_fontleft,iso_fontright, + italics,low_res_filled,standard,uppercase,working + False + 1252 + 201 + 200 + 94 + True + True + + + + intl_engineering,intl_iso + False + 1252 + 176 + 248 + 177 + True + True + + + + intl_working + False + 1252 + 94 + 248 + 240 + True + True + + + + ansi_symbols,feature_control_symbols + False + 1252 + 94 + 110 + 126 + False + True + + + + font_iso,gen_eng + False + 1252 + 94 + 126 + 200 + True + True + + + + iges1001 + False + 1252 + 94 + 110 + 200 + True + True + + + + iges1002 + False + 1252 + 94 + 201 + 35 + True + True + + + + iges1003 + False + 1252 + 94 + 201 + 35 + True + True + + + + cs_char_fast_font,cs_font_iso,cs_font_eng + False + 1250 + + + + kanji + False + 932 + 934 + 33163 + 33149 + True + False + + + + myongjo_outline,myongjo_fill,gothic_outline,gothic_fill,myongjo_single,gothic_single + False + 949 + True + False + + + + chinese_traditional + False + 950 + True + False + + + + atisb,atisn + False + 1256 + True + True + + + + * + False + 94 + 216 + 200 + True + True + + + + + kanji,kanjibig,bigfont,extfont,extfont2,@extfont2,spec_bar,spec_sl,special + 932 + False + + + + gbcbig,tssdchn,hzjd,hztxt + 936 + False + + + + tradch,chineset,tradchbig,chinese_traditionalbig + 950 + False + + + + whgdtxt,whgtxt,whtgtxt,whtmtxt,kor,korbig,myongjo_outlinebig,myongjo_fillbig,gothic_outlinebig,gothic_fillbig,myongjo_singlebig,gothic_singlebig + 949 + False + + + + russ + 1251 + False + + + + * + False + True + + + + + * + False + + + + + True + + diff --git a/03_Python_OpenSource_DXF/fonts/PAR_____.PFM b/03_Python_OpenSource_DXF/fonts/PAR_____.PFM new file mode 100644 index 0000000..b5c6b34 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/PAR_____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/PAR_____.SHX b/03_Python_OpenSource_DXF/fonts/PAR_____.SHX new file mode 100644 index 0000000..629705c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/PAR_____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/PDS.shx b/03_Python_OpenSource_DXF/fonts/PDS.shx new file mode 100644 index 0000000..a6b5de6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/PDS.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMANC9.SHX b/03_Python_OpenSource_DXF/fonts/ROMANC9.SHX new file mode 100644 index 0000000..f266c32 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMANC9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMAND9.SHX b/03_Python_OpenSource_DXF/fonts/ROMAND9.SHX new file mode 100644 index 0000000..6c38cc3 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMAND9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMANS9.SHX b/03_Python_OpenSource_DXF/fonts/ROMANS9.SHX new file mode 100644 index 0000000..f44013b Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMANS9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMANT9.SHX b/03_Python_OpenSource_DXF/fonts/ROMANT9.SHX new file mode 100644 index 0000000..8a80de6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMANT9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMB____.PFM b/03_Python_OpenSource_DXF/fonts/ROMB____.PFM new file mode 100644 index 0000000..71ac267 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMB____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMB____.SHX b/03_Python_OpenSource_DXF/fonts/ROMB____.SHX new file mode 100644 index 0000000..8d76168 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMB____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMI____.PFM b/03_Python_OpenSource_DXF/fonts/ROMI____.PFM new file mode 100644 index 0000000..38edb4c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMI____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMI____.SHX b/03_Python_OpenSource_DXF/fonts/ROMI____.SHX new file mode 100644 index 0000000..2867593 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMI____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROMS.SHX b/03_Python_OpenSource_DXF/fonts/ROMS.SHX new file mode 100644 index 0000000..d85fef6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROMS.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ROM_____.PFM b/03_Python_OpenSource_DXF/fonts/ROM_____.PFM new file mode 100644 index 0000000..688ff64 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROM_____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/ROM_____.SHX b/03_Python_OpenSource_DXF/fonts/ROM_____.SHX new file mode 100644 index 0000000..1f9c8a4 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ROM_____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SASBO___.PFM b/03_Python_OpenSource_DXF/fonts/SASBO___.PFM new file mode 100644 index 0000000..f53f5b8 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASBO___.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/SASBO___.SHX b/03_Python_OpenSource_DXF/fonts/SASBO___.SHX new file mode 100644 index 0000000..8d38179 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASBO___.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SASB____.PFM b/03_Python_OpenSource_DXF/fonts/SASB____.PFM new file mode 100644 index 0000000..f9d93de Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASB____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/SASB____.SHX b/03_Python_OpenSource_DXF/fonts/SASB____.SHX new file mode 100644 index 0000000..48d2422 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASB____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SASO____.PFM b/03_Python_OpenSource_DXF/fonts/SASO____.PFM new file mode 100644 index 0000000..81b3869 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASO____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/SASO____.SHX b/03_Python_OpenSource_DXF/fonts/SASO____.SHX new file mode 100644 index 0000000..2c060fb Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SASO____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SAS_____.PFM b/03_Python_OpenSource_DXF/fonts/SAS_____.PFM new file mode 100644 index 0000000..47a1630 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SAS_____.PFM differ diff --git a/03_Python_OpenSource_DXF/fonts/SAS_____.SHX b/03_Python_OpenSource_DXF/fonts/SAS_____.SHX new file mode 100644 index 0000000..e8a959a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SAS_____.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SBTXT.SHX b/03_Python_OpenSource_DXF/fonts/SBTXT.SHX new file mode 100644 index 0000000..be014cf Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SBTXT.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SCRIPTC9.SHX b/03_Python_OpenSource_DXF/fonts/SCRIPTC9.SHX new file mode 100644 index 0000000..ddebafc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SCRIPTC9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SCRIPTS9.SHX b/03_Python_OpenSource_DXF/fonts/SCRIPTS9.SHX new file mode 100644 index 0000000..8361941 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SCRIPTS9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SIMPLEX8.SHX b/03_Python_OpenSource_DXF/fonts/SIMPLEX8.SHX new file mode 100644 index 0000000..da9d51e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SIMPLEX8.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/SIMPLEX9.SHX b/03_Python_OpenSource_DXF/fonts/SIMPLEX9.SHX new file mode 100644 index 0000000..9c62ce0 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/SIMPLEX9.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/ST64F.SHX b/03_Python_OpenSource_DXF/fonts/ST64F.SHX new file mode 100644 index 0000000..f586d0c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ST64F.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/STANDARD.shx b/03_Python_OpenSource_DXF/fonts/STANDARD.shx new file mode 100644 index 0000000..0ffccaa Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/STANDARD.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Sbhz.shx b/03_Python_OpenSource_DXF/fonts/Sbhz.shx new file mode 100644 index 0000000..33718de Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Sbhz.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/Tssdchn.shx b/03_Python_OpenSource_DXF/fonts/Tssdchn.shx new file mode 100644 index 0000000..8ec9365 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/Tssdchn.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/aehalf.shx b/03_Python_OpenSource_DXF/fonts/aehalf.shx new file mode 100644 index 0000000..65baba2 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/aehalf.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/amgdt.shx b/03_Python_OpenSource_DXF/fonts/amgdt.shx new file mode 100644 index 0000000..60c1745 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/amgdt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/amgdtans.shx b/03_Python_OpenSource_DXF/fonts/amgdtans.shx new file mode 100644 index 0000000..99d7b88 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/amgdtans.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/arial.shx b/03_Python_OpenSource_DXF/fonts/arial.shx new file mode 100644 index 0000000..c45439e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/arial.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/arialbig.shx b/03_Python_OpenSource_DXF/fonts/arialbig.shx new file mode 100644 index 0000000..e34b050 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/arialbig.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ascii.shx b/03_Python_OpenSource_DXF/fonts/ascii.shx new file mode 100644 index 0000000..50c0235 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ascii.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/bdihz.SHX b/03_Python_OpenSource_DXF/fonts/bdihz.SHX new file mode 100644 index 0000000..b735acc Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/bdihz.SHX differ diff --git a/03_Python_OpenSource_DXF/fonts/bigfont.shx b/03_Python_OpenSource_DXF/fonts/bigfont.shx new file mode 100644 index 0000000..9f0e8bd Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/bigfont.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/bold.shx b/03_Python_OpenSource_DXF/fonts/bold.shx new file mode 100644 index 0000000..67b063e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/bold.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/chineset.shx b/03_Python_OpenSource_DXF/fonts/chineset.shx new file mode 100644 index 0000000..5f4c96f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/chineset.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/complex.shx b/03_Python_OpenSource_DXF/fonts/complex.shx new file mode 100644 index 0000000..930bfc4 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/complex.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/dim.shx b/03_Python_OpenSource_DXF/fonts/dim.shx new file mode 100644 index 0000000..e80aed5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/dim.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/dx.shx b/03_Python_OpenSource_DXF/fonts/dx.shx new file mode 100644 index 0000000..ee9dfba Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/dx.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/extfont.shx b/03_Python_OpenSource_DXF/fonts/extfont.shx new file mode 100644 index 0000000..fcf3b0e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/extfont.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/extfont2.shx b/03_Python_OpenSource_DXF/fonts/extfont2.shx new file mode 100644 index 0000000..0d5e307 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/extfont2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/exthalf2.shx b/03_Python_OpenSource_DXF/fonts/exthalf2.shx new file mode 100644 index 0000000..b19074c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/exthalf2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/extslim2.shx b/03_Python_OpenSource_DXF/fonts/extslim2.shx new file mode 100644 index 0000000..84c916c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/extslim2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/font.rsc b/03_Python_OpenSource_DXF/fonts/font.rsc new file mode 100644 index 0000000..5232be6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/font.rsc differ diff --git a/03_Python_OpenSource_DXF/fonts/fontmap.ps b/03_Python_OpenSource_DXF/fonts/fontmap.ps new file mode 100644 index 0000000..54851ab --- /dev/null +++ b/03_Python_OpenSource_DXF/fonts/fontmap.ps @@ -0,0 +1,283 @@ +% This is the release version of fontmap.ps. It uses the +% fonts distributed with AutoCAD release 12, as well as +% those fonts distributed by Adobe in the Adobe Type +% Manager for Windows, Adobe Plus Pack, and +% Adobe Font Pack 1 DOS releases. + +% The original fontmap.ps distributed with the Ghostscript +% source code is used as a model; thus, this file is +% covered by the Ghostscript copyright, +% although most of the information herein is specific to +% the Autodesk implementation. +% +% Copyright (C) 1990 Aladdin Enterprises. All rights reserved. +% Distributed by Free Software Foundation, Inc. +% +% This file is part of Ghostscript. +% +% Ghostscript is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +% to anyone for the consequences of using it or for whether it serves any +% particular purpose or works at all, unless he says so in writing. Refer +% to the Ghostscript General Public License for full details. +% +% Everyone is granted permission to copy, modify and redistribute +% Ghostscript, but only under the conditions described in the Ghostscript +% General Public License. A copy of this license is supposed to have been +% given to you along with Ghostscript so you can know your rights and +% responsibilities. It should be in a file named COPYING. Among other +% things, the copyright notice and this notice must be preserved on all +% copies. + +% +% *********************************************************************** +% * * +% * M M OOO DDDD III FFFFF III EEEEE DDDD * +% * MM MM O O D D I F I E D D * +% * M M M O O D D I F I E D D * +% * M M O O D D I FFF I EEE D D * +% * M M O O D D I F I E D D * +% * M M O O D D I F I E D D * +% * M M OOO DDDD III F III EEEEE DDDD * +% * * +% * * +% * FFFFF III L EEEEE * +% * F I L E * +% * F I L E * +% * FFF I L EEE * +% * F I L E * +% * F I L E * +% * F III LLLLL EEEEE * +% * * +% *********************************************************************** +% +% .-------------. +% | /\ | +% | / \ | +% | / /\ \ | +% | / / \ \ | +% | / / /\ \ \ | +% | / / / \ \ \| +% `-------------' (R) +% Autodesk, Inc. +% Tools For the Golden Age of Engineering +% +% In keeping with subparagraph 2a of the Gnu General Public License +% (Version 1, February 1989): +% +% 2. You may modify your copy or copies of the Program or any +% portion of it, and copy and distribute such modifications under +% the terms of Paragraph 1 above, provided that you also do the +% following: +% +% a) cause the modified files to carry prominent notices stating +% that you changed the files and the date of any change; and... +% +% the following is a summary of the changes to this file made by +% Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run +% as an ADS application and thereby to perform rendering of +% PostScript files within AutoCAD. +% +% FONTMAP.PS This file is a heavily modified version of the +% Ghostscript font map. Though the structure is +% identical to the Ghostscript structure, comments +% relating to the Ghostscript distribution fonts +% are removed. +% ************************************************************************ + +% ---------------------------------------------------------------- + +% This file is a catalog of fonts known to Ghostscript. Any font +% that is to be loaded automatically when named must be in this catalog. + +% Each font has an entry consisting of five items: +% +% - The name by which the font is known inside Ghostscript +% (a Ghostscript literal name). This is used to find the file +% from which a font of a given name should be loaded. +% +% - The name of the Ghostscript font file (a Ghostscript string). +% This should be either an Adobe Type 1 .pfb file, or a Ghostscript +% .gsf file. +% +% - The encoding to be used with the font (a Ghostscript literal name). +% This is used only when converting the font. Currently, the only +% defined encodings are `/StandardEncoding' and `/SymbolEncoding'. +% If the font or the conversion program specifies the encoding itself, +% the encoding should be `null' (not `/null'). +% +% - The uniqueID of the font (an integer). This is used to identify +% to identify distinct fonts within the Ghostscript font machinery. +% This number will be included with the documentation for new fonts +% you wish to add. +% +% - A terminating semicolon. + +% Because of limitations in the MS-DOS environment, Ghostscript font +% file names must be no more than 8 characters long, must consist only +% of LOWER CASE letters, digits, and underscores, and must start with a +% letter. Font names, on the other hand, need only obey the syntax of +% names in the Ghostscript language, which is much more liberal. + +% The following table is actually a Ghostscript data structure. +% If you add new entries, be sure to copy the punctuation accurately. +% If you add many new entries, you might need to change the file +% ACADPSI.PS; there is a line that currently says +% /FontDirectory 100 dict def +% Increase the 100 if you run into PostScript interpreter error messages +% such as "dictfull". + +% A homemade font, used only for font substitution. + +/Ugly (uglyr.gsf) /StandardEncoding 4200000 ; + +% Some Linguist fonts (including some not distributed with AutoCAD) + +/CityBlueprint (cibt____.pfb) null 5002674 ; +/CountryBlueprint (cobt____.pfb) null 5002675 ; +/EuroRoman (eur_____.pfb) null 5002676 ; +/EuroRoman-Oblique (euro____.pfb) null 5002677 ; +/Romantic (rom_____.pfb) null 5002534 ; +/Romantic-Bold (romb____.pfb) null 5002535 ; +/Romantic-Italic (romi____.pfb) null 5002536 ; +/SansSerif (sas_____.pfb) null 5002530 ; +/SansSerif-Bold (sasb____.pfb) null 5002531 ; +/SansSerif-BoldOblique (sasbo___.pfb) null 5002533 ; +/SansSerif-Oblique (saso____.pfb) null 5003532 ; +/SuperFrench (suf_____.pfb) null 5002559 ; +/Technic (te______.pfb) null 5002671 ; +/Technic-Bold (teb_____.pfb) null 5002672 ; +/Technic-Light (tel_____.pfb) null 5002673 ; +/PanRoman (par_____.pfb) null 5002548 ; + +% The next set are not tested by Autodesk, and are included as a convenience +% only; to use these fonts, remove the percent sign from the beginning of the +% line. +%/TbilisiText (tbt_____.pfb) null 5002517 ; +%/TbilisiCaps (tbc_____.pfb) null 5002518 ; +%/Hebraica (he______.pfb) null 5002521 ; +%/GraecaOblique (gro_____.pfb) null 5002523 ; +%/Graeca (gr______.pfb) null 5002524 ; +%/IPAsans (ipa_____.pfb) null 5002526 ; +%/IPAKiel (ipak____.pfb) null 5002527 ; +%/IPAKiel-Bold (ipakb___.pfb) null 5002528 ; +%/AradLevelVI (arlvi___.pfb) null 5002537 ; +%/TransCyrillic (trc_____.pfb) null 5002539 ; +%/TransCyrillic-Bold (trcb____.pfb) null 5002540 ; +%/TransCyrillic-Italic (trci____.pfb) null 5002541 ; +%/TransCyrillic-BoldItalic (trcbi___.pfb) null 5002542 ; +%/TransCyrillicSans (trcs____.pfb) null 5002543 ; +%/TransCyrillicSans-Bold (trcsb___.pfb) null 5002544 ; +%/TransCyrillicSans-Oblique (trcso___.pfb) null 5002545 ; +%/TransCyrillicSans-BoldOblique (trcsbo__.pfb) null 5002546 ; + +%/Armenian (ar______.pfb) null 5002547 ; +%/Semitica (se______.pfb) null 5002550 ; +%/SemiticaBold (seb_____.pfb) null 5002551 ; +%/SemiticaItalic (sei_____.pfb) null 5002552 ; +%/Romance (ro______.pfb) null 5002556 ; +%/RomanceBold (rob_____.pfb) null 5002557 ; +%/RomanceItalic (roi_____.pfb) null 5002558 ; + +%/NewSeoul (nes_____.pfb) null 5002560 ; +%/HiGwangJu (higj____.pfb) null 5002561 ; +%/HiInchon (hii_____.pfb) null 5002562 ; +%/NewHiPusan (nehp____.pfb) null 5002563 ; +%/NewJeju (nej_____.pfb) null 5002564 ; +%/Laotian (la______.pfb) null 5002670 ; +%/Tibetan (ti______.pfb) null 5002679 ; +%/Phatphong-Bold (phb_____.pfb) null 5002697 ; +%/Phatphong-Italic (phi_____.pfb) null 5002698 ; +%/Phatphong-BoldItalic (phbi____.pfb) null 5002699 ; +%/HindiSanskrit (his_____.pfb) null 5002700 ; +%/Gujarati (gu______.pfb) null 5002701 ; +%/Sukanya-Bold (sub_____.pfb) null 5002703 ; +%/NaayHaang-Bold (nahb____.pfb) null 5002704 ; +%/NaayHaang-Italic (nahi____.pfb) null 5002705 ; +%/NaayHaang-BoldItalic (nahbi___.pfb) null 5002706 ; +%/KhunKrit-Bold (khkb____.pfb) null 5002707 ; +%/KhunKrit-Italic (khki____.pfb) null 5002708 ; +%/KhunKrit-BoldItalic (khkbi___.pfb) null 5002709 ; +%/Sukanya (su______.pfb) null 5002710 ; +%/NaayHaang (nah_____.pfb) null 5002711 ; +%/Ayudhya (ay______.pfb) null 5002712 ; +%/KhunKrit (khk_____.pfb) null 5002713 ; +%/ChangMai (chm_____.pfb) null 5002714 ; +%/Phatphong (ph______.pfb) null 5002715 ; +%/Thonburi (th______.pfb) null 5002716 ; +%/Bangkok (ba______.pfb) null 5002717 ; +%/AyudhyaBold (ayb_____.pfb) null 5002718 ; +%/ChiangMaiBold (chmb____.pfb) null 5002719 ; +%/VinaBook (vib_____.pfb) null 5002720 ; +%/VinaChan (vic_____.pfb) null 5002721 ; +%/VinaSans (vis_____.pfb) null 5002722 ; +%/VinaPala (vip_____.pfb) null 5002723 ; +%/VinaRoman (vir_____.pfb) null 5002724 ; +%/AksarJhar (akj_____.pfb) null 5010401 ; + + + + + +% Adobe Type 1 fonts. The following, which reside in a directory named +% on the ACAD path, are binary Adobe fonts purchased by the user and +% loaded on the system. Users of Adobe Type Manager may simply include the +% directory where its fonts are kept in the ACAD path. + +% Fonts included with Adobe Type Manager + +/Courier-Bold (cob_____.pfb) /StandardEncoding 27058 ; +/Courier-BoldOblique (cobo____.pfb) /StandardEncoding 27068 ; +/Courier (com_____.pfb) /StandardEncoding 27077 ; +/Courier-Oblique (coo_____.pfb) /StandardEncoding 27082 ; +/Helvetica (hv______.pfb) /StandardEncoding 28352 ; +/Helvetica-Oblique (hvo_____.pfb) /StandardEncoding 28362 ; +/Helvetica-Bold (hvb_____.pfb) /StandardEncoding 28357 ; +/Helvetica-BoldOblique (hvbo____.pfb) /StandardEncoding 28371 ; +/Symbol (sy______.pfb) null 27004 ; +/Times-Bold (tib_____.pfb) /StandardEncoding 28417 ; +/Times-BoldItalic (tibi____.pfb) /StandardEncoding 28425 ; +/Times-Italic (tii_____.pfb) /StandardEncoding 28427 ; +/Times-Roman (tir_____.pfb) /StandardEncoding 28416 ; + +% Fonts in the Adobe Plus Pack + +/AvantGarde-Demi (agd_____.pfb) /StandardEncoding 27044 ; +/AvantGarde-DemiOblique (agdo____.pfb) /StandardEncoding 27049 ; +/AvantGarde-Book (agw_____.pfb) /StandardEncoding 27030 ; +/AvantGarde-BookOblique (agwo____.pfb) /StandardEncoding 27035 ; +/Bookman-Demi (bkd_____.pfb) /StandardEncoding 26183 ; +/Bookman-DemiItalic (bkdi____.pfb) /StandardEncoding 26184 ; +/Bookman-Light (bkl_____.pfb) /StandardEncoding 26185 ; +/Bookman-LightItalic (bkli____.pfb) /StandardEncoding 26186 ; +/Helvetica-Narrow (hvn_____.pfb) /StandardEncoding 28380 ; +/Helvetica-Narrow-Bold (hvnb____.pfb) /StandardEncoding 28398 ; +/Helvetica-Narrow-BoldOblique (hvnbo___.pfb) /StandardEncoding 28407 ; +/Helvetica-Narrow-Oblique (hvno____.pfb) /StandardEncoding 28389 ; +/NewCenturySchlbk-Bold (ncb_____.pfb) /StandardEncoding 26359 ; +/NewCenturySchlbk-BoldItalic (ncbi____.pfb) /StandardEncoding 26360 ; +/NewCenturySchlbk-Italic (nci_____.pfb) /StandardEncoding 26361 ; +/NewCenturySchlbk-Roman (ncr_____.pfb) /StandardEncoding 26362 ; +/Palatino-Bold (pob_____.pfb) /StandardEncoding 31793 ; +/Palatino-BoldItalic (pobi____.pfb) /StandardEncoding 31799 ; +/Palatino-Italic (poi_____.pfb) /StandardEncoding 31796 ; +/Palatino-Roman (por_____.pfb) /StandardEncoding 31790 ; +/ZapfChancery-MediumItalic (zcmi____.pfb) /StandardEncoding 31482 ; +/ZapfDingbats (zd______.pfb) null 26200 ; + +% Fonts in Adobe Type Set 1 + +/Bodoni-Poster (bdps____.pfb) /StandardEncoding 31547 ; +/Cottonwood (c_______.pfb) /StandardEncoding 27255 ; +/FreestyleScript (fs______.pfb) /StandardEncoding 6289 ; +/Hobo (ho______.pfb) /StandardEncoding 6174 ; +/Linotext (lx______.pfb) /StandardEncoding 22835 ; +/Trajan-Regular (tjrg____.pfb) /StandardEncoding 27158 ; +/VAGRounded-Bold (vrb_____.pfb) /StandardEncoding 22942 ; + +% ** End Adobe Fonts ** + + + + + diff --git a/03_Python_OpenSource_DXF/fonts/fs.shx b/03_Python_OpenSource_DXF/fonts/fs.shx new file mode 100644 index 0000000..9511361 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/fs.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/g12f13.shx b/03_Python_OpenSource_DXF/fonts/g12f13.shx new file mode 100644 index 0000000..b8987a3 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/g12f13.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/g13f12d.shx b/03_Python_OpenSource_DXF/fonts/g13f12d.shx new file mode 100644 index 0000000..2693b0f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/g13f12d.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/g13f12w.shx b/03_Python_OpenSource_DXF/fonts/g13f12w.shx new file mode 100644 index 0000000..7e69328 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/g13f12w.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gbcbig.shx b/03_Python_OpenSource_DXF/fonts/gbcbig.shx new file mode 100644 index 0000000..f8b5a86 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gbcbig.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gbeitc.shx b/03_Python_OpenSource_DXF/fonts/gbeitc.shx new file mode 100644 index 0000000..064d770 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gbeitc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gbenor.shx b/03_Python_OpenSource_DXF/fonts/gbenor.shx new file mode 100644 index 0000000..05e9b05 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gbenor.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gdt.shx b/03_Python_OpenSource_DXF/fonts/gdt.shx new file mode 100644 index 0000000..852620e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gdt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/geniso12.shx b/03_Python_OpenSource_DXF/fonts/geniso12.shx new file mode 100644 index 0000000..b8987a3 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/geniso12.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gmgdt.shx b/03_Python_OpenSource_DXF/fonts/gmgdt.shx new file mode 100644 index 0000000..fcd2cd6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gmgdt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gothice.shx b/03_Python_OpenSource_DXF/fonts/gothice.shx new file mode 100644 index 0000000..cd49aa5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gothice.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gothicg.shx b/03_Python_OpenSource_DXF/fonts/gothicg.shx new file mode 100644 index 0000000..d18711f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gothicg.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/gothici.shx b/03_Python_OpenSource_DXF/fonts/gothici.shx new file mode 100644 index 0000000..fd141d0 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/gothici.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/greekc.shx b/03_Python_OpenSource_DXF/fonts/greekc.shx new file mode 100644 index 0000000..cb26a92 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/greekc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/greeks.shx b/03_Python_OpenSource_DXF/fonts/greeks.shx new file mode 100644 index 0000000..aafeac6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/greeks.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/hand1.shx b/03_Python_OpenSource_DXF/fonts/hand1.shx new file mode 100644 index 0000000..5da8015 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/hand1.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/iges1001.shx b/03_Python_OpenSource_DXF/fonts/iges1001.shx new file mode 100644 index 0000000..7d39b7d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/iges1001.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/iges1002.shx b/03_Python_OpenSource_DXF/fonts/iges1002.shx new file mode 100644 index 0000000..e0cf8f5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/iges1002.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/iges1003.shx b/03_Python_OpenSource_DXF/fonts/iges1003.shx new file mode 100644 index 0000000..f87a31d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/iges1003.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/internat.rsc b/03_Python_OpenSource_DXF/fonts/internat.rsc new file mode 100644 index 0000000..feddc31 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/internat.rsc differ diff --git a/03_Python_OpenSource_DXF/fonts/isocp.shx b/03_Python_OpenSource_DXF/fonts/isocp.shx new file mode 100644 index 0000000..e2ec96b Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isocp.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/isocp2.shx b/03_Python_OpenSource_DXF/fonts/isocp2.shx new file mode 100644 index 0000000..2e1f206 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isocp2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/isocp3.shx b/03_Python_OpenSource_DXF/fonts/isocp3.shx new file mode 100644 index 0000000..c9a0e15 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isocp3.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/isoct.shx b/03_Python_OpenSource_DXF/fonts/isoct.shx new file mode 100644 index 0000000..847bb4e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isoct.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/isoct2.shx b/03_Python_OpenSource_DXF/fonts/isoct2.shx new file mode 100644 index 0000000..b84b1ee Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isoct2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/isoct3.shx b/03_Python_OpenSource_DXF/fonts/isoct3.shx new file mode 100644 index 0000000..3c38c8e Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/isoct3.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/italic.shx b/03_Python_OpenSource_DXF/fonts/italic.shx new file mode 100644 index 0000000..843c210 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/italic.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/italicc.shx b/03_Python_OpenSource_DXF/fonts/italicc.shx new file mode 100644 index 0000000..0707aaf Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/italicc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/italict.shx b/03_Python_OpenSource_DXF/fonts/italict.shx new file mode 100644 index 0000000..85c32da Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/italict.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/ls.shx b/03_Python_OpenSource_DXF/fonts/ls.shx new file mode 100644 index 0000000..80ee5f5 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/ls.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/monotxt.shx b/03_Python_OpenSource_DXF/fonts/monotxt.shx new file mode 100644 index 0000000..1726c28 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/monotxt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/romanc.shx b/03_Python_OpenSource_DXF/fonts/romanc.shx new file mode 100644 index 0000000..304ac04 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/romanc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/romand.shx b/03_Python_OpenSource_DXF/fonts/romand.shx new file mode 100644 index 0000000..e2d24a8 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/romand.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/romans.shx b/03_Python_OpenSource_DXF/fonts/romans.shx new file mode 100644 index 0000000..da35e62 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/romans.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/romant.shx b/03_Python_OpenSource_DXF/fonts/romant.shx new file mode 100644 index 0000000..a715377 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/romant.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/sas_____.pfb b/03_Python_OpenSource_DXF/fonts/sas_____.pfb new file mode 100644 index 0000000..8339552 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/sas_____.pfb differ diff --git a/03_Python_OpenSource_DXF/fonts/scriptc.shx b/03_Python_OpenSource_DXF/fonts/scriptc.shx new file mode 100644 index 0000000..764bbc6 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/scriptc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/scripts.shx b/03_Python_OpenSource_DXF/fonts/scripts.shx new file mode 100644 index 0000000..3b18316 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/scripts.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/simplex.shx b/03_Python_OpenSource_DXF/fonts/simplex.shx new file mode 100644 index 0000000..476672f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/simplex.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/spec_bar.shx b/03_Python_OpenSource_DXF/fonts/spec_bar.shx new file mode 100644 index 0000000..fa671bd Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/spec_bar.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/spec_sl.shx b/03_Python_OpenSource_DXF/fonts/spec_sl.shx new file mode 100644 index 0000000..fb0c21d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/spec_sl.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/special.shx b/03_Python_OpenSource_DXF/fonts/special.shx new file mode 100644 index 0000000..fb0c21d Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/special.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/syastro.shx b/03_Python_OpenSource_DXF/fonts/syastro.shx new file mode 100644 index 0000000..3ff3332 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/syastro.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/symap.shx b/03_Python_OpenSource_DXF/fonts/symap.shx new file mode 100644 index 0000000..c2001ba Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/symap.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/symath.shx b/03_Python_OpenSource_DXF/fonts/symath.shx new file mode 100644 index 0000000..e2efa9b Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/symath.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/symeteo.shx b/03_Python_OpenSource_DXF/fonts/symeteo.shx new file mode 100644 index 0000000..66c5b7a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/symeteo.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/symusic.shx b/03_Python_OpenSource_DXF/fonts/symusic.shx new file mode 100644 index 0000000..796dba3 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/symusic.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/thcbig.shx b/03_Python_OpenSource_DXF/fonts/thcbig.shx new file mode 100644 index 0000000..f544186 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/thcbig.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/theitc.shx b/03_Python_OpenSource_DXF/fonts/theitc.shx new file mode 100644 index 0000000..38bdf3f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/theitc.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/thenor.shx b/03_Python_OpenSource_DXF/fonts/thenor.shx new file mode 100644 index 0000000..568b6de Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/thenor.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/times.shx b/03_Python_OpenSource_DXF/fonts/times.shx new file mode 100644 index 0000000..00c89f4 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/times.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/timesout.shx b/03_Python_OpenSource_DXF/fonts/timesout.shx new file mode 100644 index 0000000..9382585 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/timesout.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/tssdeng.shx b/03_Python_OpenSource_DXF/fonts/tssdeng.shx new file mode 100644 index 0000000..e48652a Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/tssdeng.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/txt.shx b/03_Python_OpenSource_DXF/fonts/txt.shx new file mode 100644 index 0000000..57dbfee Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/txt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/txt_1.shx b/03_Python_OpenSource_DXF/fonts/txt_1.shx new file mode 100644 index 0000000..f47e46c Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/txt_1.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/txt_2.shx b/03_Python_OpenSource_DXF/fonts/txt_2.shx new file mode 100644 index 0000000..38bdf3f Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/txt_2.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/whgdtxt.shx b/03_Python_OpenSource_DXF/fonts/whgdtxt.shx new file mode 100644 index 0000000..e5a6c83 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/whgdtxt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/whgtxt.shx b/03_Python_OpenSource_DXF/fonts/whgtxt.shx new file mode 100644 index 0000000..767d596 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/whgtxt.shx differ diff --git a/03_Python_OpenSource_DXF/fonts/whtgtxt.shx b/03_Python_OpenSource_DXF/fonts/whtgtxt.shx new file mode 100644 index 0000000..e88c077 Binary files /dev/null and b/03_Python_OpenSource_DXF/fonts/whtgtxt.shx differ diff --git a/03_Python_OpenSource_DXF/plot_by_block_name.py b/03_Python_OpenSource_DXF/plot_by_block_name.py new file mode 100644 index 0000000..7006e43 --- /dev/null +++ b/03_Python_OpenSource_DXF/plot_by_block_name.py @@ -0,0 +1,241 @@ +import ezdxf +from ezdxf.addons.drawing import Frontend, RenderContext, pymupdf +from ezdxf import bbox # 修正导入方式 +import fitz # PyMuPDF,用于二次裁剪 PDF 页面 +from pathlib import Path +import argparse + +# --- 配置区 (您需要修改的全部内容都在这里) --- + +# 移除了 DXF_FILE 和 OUTPUT_DIR 的硬编码 + +# 3. 定义标准纸张尺寸库 (宽, 高) in mm. +# 这里我们为每种尺寸都定义了横向(landscape)和纵向(portrait) +PAPER_SIZES_MM = { + "A4": {"landscape": (297, 210), "portrait": (210, 297)}, + "A3": {"landscape": (420, 297), "portrait": (297, 420)}, + "A2": {"landscape": (594, 420), "portrait": (420, 594)}, + "A1": {"landscape": (841, 594), "portrait": (594, 841)}, + "A0": {"landscape": (1189, 841), "portrait": (841, 1189)}, +} + +# 4. 【核心配置】指定哪些块需要打印,以及如何打印 +# 格式: "您的块名": ("纸张代号", "方向"), +# - "纸张代号" 必须是上面 PAPER_SIZES_MM 中定义的键 (例如 "A3") +# - "方向" 必须是 "landscape" (横向) 或 "portrait" (纵向) +PRINTABLE_BLOCKS = { + + # !! 注意:您需要为它们指定正确的纸张尺寸和方向 !! + # 我在这里先做了假设,请根据实际情况修改 + "A$C2EB80DB8": ("A1", "portrait"), # A1 竖向 + "A$C1CC9093B": ("A1", "landscape"), # A1 横向 + "A$C6D564680": ("A2", "portrait"), # A2 竖向 + "新块": ("A3", "landscape"), # A3 横向 + "新块1": ("A4", "portrait"), # A4 竖向 +} + +# --- 代码正文 (通常无需修改) --- + +def export_frame_to_pdf(doc, search_space, block_ref, settings, output_filename): + """ + 根据精确的设置,将单个图框块导出为PDF。 + """ + layout_name = None # 初始化变量,增加代码健壮性 + block_name = block_ref.dxf.name + paper_size_key, orientation = settings + + try: + page_dimensions = PAPER_SIZES_MM[paper_size_key][orientation] + except KeyError: + print(f" - 错误:为块 '{block_name}' 提供的设置 ('{paper_size_key}', '{orientation}') 无效。请检查配置。") + return + + print(f" - 图框: '{block_name}', 设置: {paper_size_key} {orientation} ({page_dimensions[0]}x{page_dimensions[1]}mm)") + + try: + entities = list(block_ref.virtual_entities()) + if not entities: + print(f" - 警告:块 '{block_name}' 是空的,跳过。") + return + + # 修正:直接将实体列表传递给 extents() 函数, + # 它会自动处理不同类型的实体,包括 LWPolyline。 + bbox_result = bbox.extents(entities) + if bbox_result.extmin is None or bbox_result.extmax is None: + print(f" - 警告:块 '{block_name}' 的边界为空,跳过。") + return + + # 页面尺寸(mm) + page_width, page_height = page_dimensions + + print(f" - 正在生成 PDF...") + ctx = RenderContext(doc) + backend = pymupdf.PyMuPdfBackend() + + # 绘制整个布局,但跳过已知容易引发异常的实体类型 + def _filter(e): + t = e.dxftype() + # 跳过容易引发坐标错误的实体类型 + problematic_types = {"HATCH", "TRACE", "SOLID", "REGION", "BODY", "3DSOLID", "ACIS", "MESH"} + if t in problematic_types: + return False + + # 检查实体是否有有效的坐标 + try: + if hasattr(e, 'dxf'): + # 检查基本坐标属性 + for attr in ['start', 'end', 'center', 'insert']: + if hasattr(e.dxf, attr): + point = getattr(e.dxf, attr, None) + if point is not None: + # 检查坐标值是否有效 + if any(coord is None or not isinstance(coord, (int, float)) for coord in [point.x, point.y]): + return False + except (AttributeError, TypeError): + # 如果检查过程中出错,跳过该实体 + return False + + return True + + try: + # 只绘制该块中的实体,而不是整个布局 + entities = list(block_ref.virtual_entities()) + filtered_entities = [e for e in entities if _filter(e)] + print(f" - 过滤后剩余实体数量: {len(filtered_entities)}/{len(entities)}") + + # 直接绘制过滤后的实体 + for entity in filtered_entities: + try: + ctx.push_state() + backend.set_background('#FFFFFF') # 设置白色背景 + entity_type = entity.dxftype() + + # 只处理最安全的实体类型 + if entity_type in {"LINE", "CIRCLE", "ARC", "TEXT", "MTEXT"}: + from ezdxf.addons.drawing.frontend import Frontend + temp_frontend = Frontend(ctx, backend) + temp_frontend.draw_entity(entity, ctx.current_entity_properties()) + except Exception as entity_error: + print(f" - 跳过有问题的实体 {entity.dxftype()}: {entity_error}") + continue + finally: + ctx.pop_state() + + except Exception as draw_error: + print(f" - 警告:绘制过程中出现错误: {draw_error}") + print(f" - 尝试只绘制基本线条和文字...") + + # 最后的备用方案:只绘制最基本的实体 + try: + entities = list(block_ref.virtual_entities()) + for entity in entities: + entity_type = entity.dxftype() + if entity_type == "LINE": + try: + from ezdxf.addons.drawing.frontend import Frontend + temp_frontend = Frontend(ctx, backend) + temp_frontend.draw_entity(entity, ctx.current_entity_properties()) + except: + continue + except Exception as final_error: + print(f" - 错误:无法绘制任何实体,跳过此块: {final_error}") + return + + from ezdxf.addons.drawing import layout as draw_layout + page_def = draw_layout.Page(page_width, page_height, units=draw_layout.Units.mm) + pdf_bytes = backend.get_pdf_bytes(page_def) + + # 用 PyMuPDF 对生成的 PDF 进行页面级裁剪,裁到块的范围 + mm_to_pt = 72.0 / 25.4 + minx_mm, miny_mm = bbox_result.extmin.x, bbox_result.extmin.y + maxx_mm, maxy_mm = bbox_result.extmax.x, bbox_result.extmax.y + x0 = max(0.0, minx_mm) * mm_to_pt + x1 = max(0.0, maxx_mm) * mm_to_pt + top = max(0.0, page_height - maxy_mm) * mm_to_pt + bottom = max(0.0, page_height - miny_mm) * mm_to_pt + + pdf_doc = fitz.open(stream=pdf_bytes, filetype="pdf") + page = pdf_doc[0] + crop_rect = fitz.Rect(x0, top, x1, bottom) + page.set_cropbox(crop_rect) + pdf_doc.save(str(output_filename)) + + print(f" - 已保存到: {output_filename}") + + finally: + pass + +def main(): + parser = argparse.ArgumentParser( + description="根据DXF文件中的块名,自动批量打印为带正确纸张尺寸的PDF。" + ) + parser.add_argument("input_dxf", type=Path, help="要处理的源DXF文件的路径。") + parser.add_argument( + "-o", "--output", + type=Path, + default=Path("plots_output"), + help="指定PDF文件的输出目录 (默认为: plots_output)" + ) + parser.add_argument( + "-l", "--layout", + type=str, + default=None, + help="指定要在哪个图纸布局(Layout)中查找块。如果未提供,则在模型空间(Modelspace)中查找。" + ) + args = parser.parse_args() + + output_dir = args.output + dxf_file = args.input_dxf + + output_dir.mkdir(exist_ok=True) + + try: + doc = ezdxf.readfile(dxf_file) + except IOError: + print(f"错误:无法读取文件 '{dxf_file}'") + return + except ezdxf.DXFStructureError as e: + print(f"DXF 文件结构错误: {e}") + return + + # 根据参数决定在哪个空间查找块 + if args.layout: + try: + search_space = doc.layouts.get(args.layout) + print(f"--- 目标空间: 布局 '{args.layout}' ---") + except KeyError: + available = ", ".join(doc.layouts.names()) + print(f"错误: 找不到名为 '{args.layout}' 的布局。可用的布局有: [{available}]") + return + else: + search_space = doc.modelspace() + print("--- 目标空间: 模型空间 ---") + + # 查找目标空间中所有的块参照 (INSERT entities) + all_block_references = search_space.query('INSERT') + + # 根据 PRINTABLE_BLOCKS 字典的键来筛选需要处理的块 + frame_references = [ + ref for ref in all_block_references + if ref.dxf.name in PRINTABLE_BLOCKS + ] + + if not frame_references: + print("未找到任何在配置字典 PRINTABLE_BLOCKS 中定义的可打印图框块。") + return + + print(f"在 '{dxf_file}' 中共找到 {len(frame_references)} 个待处理的图框块。开始处理...") + + for i, block_ref in enumerate(frame_references): + block_name = block_ref.dxf.name + settings = PRINTABLE_BLOCKS[block_name] + + print(f"\n处理第 {i+1} 个图框: '{block_name}' (句柄: {block_ref.dxf.handle})") + output_filename = output_dir / f"{block_name}_{i+1}.pdf" + + export_frame_to_pdf(doc, search_space, block_ref, settings, output_filename) + + print("\n所有指定的图框处理完毕!") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/plot_by_block_name_simple.py b/03_Python_OpenSource_DXF/plot_by_block_name_simple.py new file mode 100644 index 0000000..ee0c400 --- /dev/null +++ b/03_Python_OpenSource_DXF/plot_by_block_name_simple.py @@ -0,0 +1,385 @@ +import ezdxf +import matplotlib.pyplot as plt +import matplotlib.patches as patches +from pathlib import Path +import argparse +import os +import sys + +from ezdxf.addons.drawing import RenderContext, Frontend +from ezdxf.addons.drawing.matplotlib import MatplotlibBackend +from ezdxf.addons.drawing.properties import Configuration +from ezdxf import bbox + +# 配置中文字体支持 +import matplotlib.font_manager as fm +plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei', 'DejaVu Sans'] # 支持中文显示 +plt.rcParams['axes.unicode_minus'] = False # 正常显示负号 + +# 字体目录配置 +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +FONT_DIR = os.path.join(SCRIPT_DIR, "fonts") + +# 纸张尺寸定义 (mm) +PAPER_SIZES_MM = { + "A4": {"landscape": (297, 210), "portrait": (210, 297)}, + "A3": {"landscape": (420, 297), "portrait": (297, 420)}, + "A2": {"landscape": (594, 420), "portrait": (420, 594)}, + "A1": {"landscape": (841, 594), "portrait": (594, 841)}, + "A0": {"landscape": (1189, 841), "portrait": (841, 1189)}, +} + +PRINTABLE_BLOCKS = { + "A$C2EB80DB8": ("A1", "portrait"), + "A$C1CC9093B": ("A1", "landscape"), + "A$C6D564680": ("A2", "portrait"), + "新块": ("A3", "landscape"), + "新块1": ("A4", "portrait"), +} + +def export_frame_to_pdf_matplotlib(doc, search_space, block_ref, settings, output_filename): + """使用ezdxf专业渲染系统导出PDF,支持完整的CAD实体和中文字体""" + block_name = block_ref.dxf.name + paper_size_key, orientation = settings + + try: + page_dimensions = PAPER_SIZES_MM[paper_size_key][orientation] + except KeyError: + print(f" - 错误:为块 '{block_name}' 提供的设置无效") + return + + print(f" - 图框: '{block_name}', 设置: {paper_size_key} {orientation} ({page_dimensions[0]}x{page_dimensions[1]}mm)") + + try: + # 配置字体支持 + if FONT_DIR not in ezdxf.options.support_dirs: + ezdxf.options.support_dirs.append(FONT_DIR) + print(f" - 已添加字体目录: {FONT_DIR}") + + # 获取块中的所有实体 + entities = list(block_ref.virtual_entities()) + if not entities: + print(f" - 警告:块 '{block_name}' 是空的,跳过") + return + + print(f" - 找到 {len(entities)} 个实体") + + # 计算边界框 + bbox_result = bbox.extents(entities) + if bbox_result.extmin is None or bbox_result.extmax is None: + print(f" - 警告:块 '{block_name}' 的边界为空,跳过") + return + + minx, miny = bbox_result.extmin.x, bbox_result.extmin.y + maxx, maxy = bbox_result.extmax.x, bbox_result.extmax.y + + print(f" - 边界: ({minx:.2f}, {miny:.2f}) 到 ({maxx:.2f}, {maxy:.2f})") + + # 配置渲染器 - 参考export_dxf.py的成功配置 + config = Configuration.defaults().with_changes( + pdsize=0, # 点的大小设置为0,避免3D点处理问题 + ) + + # 设置正确的PDF纸张尺寸(英寸) + fig_width_in = page_dimensions[0] / 25.4 + fig_height_in = page_dimensions[1] / 25.4 + + print(f" - 设置PDF尺寸: {fig_width_in:.2f}x{fig_height_in:.2f}英寸") + + # 创建matplotlib图形,固定尺寸 + fig = plt.figure(figsize=(fig_width_in, fig_height_in)) + ax = fig.add_axes([0, 0, 1, 1]) + + # 设置视图边界为块的边界 + ax.set_xlim(minx, maxx) + ax.set_ylim(miny, maxy) + ax.set_aspect('equal') + ax.axis('off') + + print(f" - 正确的方法:先渲染整个布局,再裁剪到块区域...") + + # 正确的方法:渲染整个布局的所有内容,然后设置视图为块的边界 + try: + ctx = RenderContext(doc) + backend = MatplotlibBackend(ax) + frontend = Frontend(ctx, backend, config=config) + + print(f" - 渲染整个布局的内容(包含图纸的所有图形)...") + + # 渲染整个布局 + frontend.draw_layout(search_space, finalize=True) + + print(f" - 布局渲染完成,视图已设置为块 '{block_name}' 的边界区域") + + except Exception as layout_error: + print(f" - 完整布局渲染失败: {layout_error}") + print(f" - 尝试带过滤的布局渲染...") + + try: + # 过滤掉3D坐标问题的实体 + def safe_filter(entity): + entity_type = entity.dxftype() + # 跳过可能导致3D坐标问题的实体 + problematic_types = {"HATCH", "SOLID", "REGION", "BODY", "3DSOLID", "MESH", "SURFACE"} + return entity_type not in problematic_types + + ctx = RenderContext(doc) + backend = MatplotlibBackend(ax) + frontend = Frontend(ctx, backend, config=config) + + frontend.draw_layout(search_space, finalize=True, filter_func=safe_filter) + print(f" - 过滤渲染成功") + + except Exception as filter_error: + print(f" - 过滤渲染也失败: {filter_error}") + print(f" - 使用matplotlib直接渲染所有实体...") + + # 最后备用方案:matplotlib直接渲染所有布局实体 + ax.clear() + ax.set_xlim(minx, maxx) + ax.set_ylim(miny, maxy) + ax.set_aspect('equal') + ax.axis('off') + + all_entities = list(search_space.query('*')) # 获取布局中的所有实体 + drawn_count = 0 + + print(f" - 开始渲染布局中的 {len(all_entities)} 个实体...") + + for entity in all_entities: + try: + entity_type = entity.dxftype() + + # 检查实体是否在块的边界区域内 + if hasattr(entity.dxf, 'start') and hasattr(entity.dxf, 'end'): + # 线条类实体 + start = entity.dxf.start + end = entity.dxf.end + if not (minx <= start.x <= maxx and miny <= start.y <= maxy and + minx <= end.x <= maxx and miny <= end.y <= maxy): + continue # 跳过不在区域内的实体 + elif hasattr(entity.dxf, 'center'): + # 圆形类实体 + center = entity.dxf.center + if not (minx <= center.x <= maxx and miny <= center.y <= maxy): + continue + elif hasattr(entity.dxf, 'insert'): + # 文本类实体 + insert = entity.dxf.insert + if not (minx <= insert.x <= maxx and miny <= insert.y <= maxy): + continue + + # 渲染在区域内的实体 + if entity_type == "LINE": + start = entity.dxf.start + end = entity.dxf.end + ax.plot([start.x, end.x], [start.y, end.y], 'k-', linewidth=0.5) + drawn_count += 1 + + elif entity_type == "CIRCLE": + center = entity.dxf.center + radius = entity.dxf.radius + circle = patches.Circle((center.x, center.y), radius, fill=False, edgecolor='black', linewidth=0.5) + ax.add_patch(circle) + drawn_count += 1 + + elif entity_type == "ARC": + center = entity.dxf.center + radius = entity.dxf.radius + start_angle = entity.dxf.start_angle + end_angle = entity.dxf.end_angle + arc = patches.Arc((center.x, center.y), 2*radius, 2*radius, + theta1=start_angle, theta2=end_angle, + edgecolor='black', linewidth=0.5) + ax.add_patch(arc) + drawn_count += 1 + + elif entity_type in ["TEXT", "MTEXT"]: + insert_point = entity.dxf.insert if hasattr(entity.dxf, 'insert') else (0, 0, 0) + text_content = entity.dxf.text if hasattr(entity.dxf, 'text') else "" + if text_content.strip(): + ax.text(insert_point.x, insert_point.y, text_content, + fontsize=6, ha='left', va='bottom', color='black') + drawn_count += 1 + + elif entity_type == "LWPOLYLINE": + points = list(entity.get_points()) + if len(points) > 1: + x_coords = [p[0] for p in points] + y_coords = [p[1] for p in points] + ax.plot(x_coords, y_coords, 'k-', linewidth=0.5) + drawn_count += 1 + + elif entity_type == "DIMENSION": + # 处理尺寸标注 + try: + if hasattr(entity, 'get_measurement'): + # 简化:绘制尺寸线的基本线条 + if hasattr(entity.dxf, 'defpoint') and hasattr(entity.dxf, 'defpoint2'): + p1 = entity.dxf.defpoint + p2 = entity.dxf.defpoint2 if hasattr(entity.dxf, 'defpoint2') else p1 + ax.plot([p1.x, p2.x], [p1.y, p2.y], 'k-', linewidth=0.3) + drawn_count += 1 + except: + pass + + elif entity_type == "INSERT": + # 处理嵌套INSERT块 - 这是关键的缺失部分! + try: + nested_entities = list(entity.virtual_entities()) + insert_drawn = 0 + + for nested_entity in nested_entities: + try: + nested_type = nested_entity.dxftype() + + if nested_type == "LINE": + start = nested_entity.dxf.start + end = nested_entity.dxf.end + ax.plot([start.x, end.x], [start.y, end.y], 'k-', linewidth=0.5) + insert_drawn += 1 + + elif nested_type == "CIRCLE": + center = nested_entity.dxf.center + radius = nested_entity.dxf.radius + circle = patches.Circle((center.x, center.y), radius, fill=False, edgecolor='black', linewidth=0.5) + ax.add_patch(circle) + insert_drawn += 1 + + elif nested_type in ["TEXT", "MTEXT"]: + insert_point = nested_entity.dxf.insert if hasattr(nested_entity.dxf, 'insert') else (0, 0, 0) + text_content = nested_entity.dxf.text if hasattr(nested_entity.dxf, 'text') else "" + if text_content.strip(): + ax.text(insert_point.x, insert_point.y, text_content, + fontsize=6, ha='left', va='bottom', color='blue') # 用蓝色区分嵌套块文字 + insert_drawn += 1 + + elif nested_type == "LWPOLYLINE": + points = list(nested_entity.get_points()) + if len(points) > 1: + x_coords = [p[0] for p in points] + y_coords = [p[1] for p in points] + ax.plot(x_coords, y_coords, 'k-', linewidth=0.5) + insert_drawn += 1 + except: + continue + + if insert_drawn > 0: + drawn_count += insert_drawn + + except: + pass + + except Exception as e: + continue + + # 最后,确保渲染当前目标块本身的内容(框架和标签) + print(f" - 正在渲染目标块 '{block_name}' 本身的内容...") + block_drawn = 0 + + for block_entity in entities: # entities 是当前块的虚拟实体 + try: + entity_type = block_entity.dxftype() + + if entity_type == "LINE": + start = block_entity.dxf.start + end = block_entity.dxf.end + ax.plot([start.x, end.x], [start.y, end.y], 'r-', linewidth=1.0) # 用红色突出显示块框架 + block_drawn += 1 + + elif entity_type in ["TEXT", "MTEXT"]: + insert_point = block_entity.dxf.insert if hasattr(block_entity.dxf, 'insert') else (0, 0, 0) + text_content = block_entity.dxf.text if hasattr(block_entity.dxf, 'text') else "" + if text_content.strip(): + ax.text(insert_point.x, insert_point.y, text_content, + fontsize=8, ha='left', va='bottom', color='red', weight='bold') # 用红色粗体显示块标签 + block_drawn += 1 + + elif entity_type == "LWPOLYLINE": + points = list(block_entity.get_points()) + if len(points) > 1: + x_coords = [p[0] for p in points] + y_coords = [p[1] for p in points] + ax.plot(x_coords, y_coords, 'r-', linewidth=1.0) # 用红色显示块边框 + block_drawn += 1 + + elif entity_type == "INSERT": + # 处理目标块内的嵌套块 + nested_entities = list(block_entity.virtual_entities()) + for nested in nested_entities: + try: + if nested.dxftype() == "LINE": + start = nested.dxf.start + end = nested.dxf.end + ax.plot([start.x, end.x], [start.y, end.y], 'r-', linewidth=0.8) + block_drawn += 1 + except: + pass + + except Exception as e: + continue + + print(f" - 目标块本身渲染完成,绘制了 {block_drawn} 个块实体") + print(f" - matplotlib区域渲染总计完成,绘制了 {drawn_count + block_drawn} 个实体") + + # 保存为PDF,使用固定尺寸,不自动调整边界 + plt.savefig(str(output_filename), format='pdf', dpi=300, + bbox_inches=None, pad_inches=0) + plt.close() + + print(f" - 已保存到: {output_filename}") + + except Exception as e: + print(f" - 错误:处理块 '{block_name}' 时出现异常: {e}") + return + +def main(): + parser = argparse.ArgumentParser(description="使用matplotlib渲染DXF块为PDF") + parser.add_argument("input_dxf", type=Path, help="DXF文件路径") + parser.add_argument("-o", "--output", type=Path, default=Path("plots_output"), help="输出目录") + parser.add_argument("-l", "--layout", type=str, default=None, help="布局名称") + args = parser.parse_args() + + output_dir = args.output + output_dir.mkdir(exist_ok=True) + + try: + doc = ezdxf.readfile(args.input_dxf) + except Exception as e: + print(f"错误:无法读取文件 '{args.input_dxf}': {e}") + return + + if args.layout: + try: + search_space = doc.layouts.get(args.layout) + print(f"--- 目标空间: 布局 '{args.layout}' ---") + except KeyError: + available = ", ".join(doc.layouts.names()) + print(f"错误: 找不到布局 '{args.layout}'。可用布局: [{available}]") + return + else: + search_space = doc.modelspace() + print("--- 目标空间: 模型空间 ---") + + all_block_references = search_space.query('INSERT') + frame_references = [ref for ref in all_block_references if ref.dxf.name in PRINTABLE_BLOCKS] + + if not frame_references: + print("未找到任何配置的可打印图框块") + return + + print(f"共找到 {len(frame_references)} 个待处理的图框块") + + for i, block_ref in enumerate(frame_references): + block_name = block_ref.dxf.name + settings = PRINTABLE_BLOCKS[block_name] + + print(f"\n处理第 {i+1} 个图框: '{block_name}'") + output_filename = output_dir / f"{block_name}_{i+1}.pdf" + + export_frame_to_pdf_matplotlib(doc, search_space, block_ref, settings, output_filename) + + print("\n处理完毕!") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_2.pdf b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_2.pdf new file mode 100644 index 0000000..e580a80 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_2.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_3.pdf b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_3.pdf new file mode 100644 index 0000000..8989bb1 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_3.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_4.pdf b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_4.pdf new file mode 100644 index 0000000..c2b9af8 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete/A$C1CC9093B_4.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete/A$C2EB80DB8_1.pdf b/03_Python_OpenSource_DXF/test_complete/A$C2EB80DB8_1.pdf new file mode 100644 index 0000000..45e22b5 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete/A$C2EB80DB8_1.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete2/A$C1CC9093B_1.pdf b/03_Python_OpenSource_DXF/test_complete2/A$C1CC9093B_1.pdf new file mode 100644 index 0000000..93e56df Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete2/A$C1CC9093B_1.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete2/A$C2EB80DB8_3.pdf b/03_Python_OpenSource_DXF/test_complete2/A$C2EB80DB8_3.pdf new file mode 100644 index 0000000..b56e9a1 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete2/A$C2EB80DB8_3.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete2/A$C6D564680_2.pdf b/03_Python_OpenSource_DXF/test_complete2/A$C6D564680_2.pdf new file mode 100644 index 0000000..32623be Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete2/A$C6D564680_2.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete2/新块1_5.pdf b/03_Python_OpenSource_DXF/test_complete2/新块1_5.pdf new file mode 100644 index 0000000..3816895 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete2/新块1_5.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete2/新块_4.pdf b/03_Python_OpenSource_DXF/test_complete2/新块_4.pdf new file mode 100644 index 0000000..935bae9 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_complete2/新块_4.pdf differ diff --git a/03_Python_OpenSource_DXF/test_complete_render/塔器_coords.json b/03_Python_OpenSource_DXF/test_complete_render/塔器_coords.json new file mode 100644 index 0000000..4ae3b6b --- /dev/null +++ b/03_Python_OpenSource_DXF/test_complete_render/塔器_coords.json @@ -0,0 +1,18 @@ +{ + "bottom_left": { + "x": -176.03, + "y": -2957.52 + }, + "bottom_right": { + "x": 5514.72, + "y": -2957.52 + }, + "top_left": { + "x": -176.03, + "y": 380.38 + }, + "top_right": { + "x": 5514.72, + "y": 380.38 + } +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_2.pdf b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_2.pdf new file mode 100644 index 0000000..2d9621f Binary files /dev/null and b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_2.pdf differ diff --git a/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_3.pdf b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_3.pdf new file mode 100644 index 0000000..5929a1e Binary files /dev/null and b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_3.pdf differ diff --git a/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_4.pdf b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_4.pdf new file mode 100644 index 0000000..01cd6a5 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_correct/A$C1CC9093B_4.pdf differ diff --git a/03_Python_OpenSource_DXF/test_correct/A$C2EB80DB8_1.pdf b/03_Python_OpenSource_DXF/test_correct/A$C2EB80DB8_1.pdf new file mode 100644 index 0000000..fbd7396 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_correct/A$C2EB80DB8_1.pdf differ diff --git a/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_2.pdf b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_2.pdf new file mode 100644 index 0000000..1d60153 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_2.pdf differ diff --git a/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_3.pdf b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_3.pdf new file mode 100644 index 0000000..15d54a5 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_3.pdf differ diff --git a/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_4.pdf b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_4.pdf new file mode 100644 index 0000000..e8e609f Binary files /dev/null and b/03_Python_OpenSource_DXF/test_final/A$C1CC9093B_4.pdf differ diff --git a/03_Python_OpenSource_DXF/test_final/A$C2EB80DB8_1.pdf b/03_Python_OpenSource_DXF/test_final/A$C2EB80DB8_1.pdf new file mode 100644 index 0000000..ba882c0 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_final/A$C2EB80DB8_1.pdf differ diff --git a/03_Python_OpenSource_DXF/test_output/A$C2EB80DB8_1.pdf b/03_Python_OpenSource_DXF/test_output/A$C2EB80DB8_1.pdf new file mode 100644 index 0000000..80587be Binary files /dev/null and b/03_Python_OpenSource_DXF/test_output/A$C2EB80DB8_1.pdf differ diff --git a/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_2.pdf b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_2.pdf new file mode 100644 index 0000000..3e98a50 Binary files /dev/null and b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_2.pdf differ diff --git a/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_3.pdf b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_3.pdf new file mode 100644 index 0000000..2df5c2e Binary files /dev/null and b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_3.pdf differ diff --git a/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_4.pdf b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_4.pdf new file mode 100644 index 0000000..2df5c2e Binary files /dev/null and b/03_Python_OpenSource_DXF/test_precise/A$C1CC9093B_4.pdf differ diff --git a/03_Python_OpenSource_DXF/test_precise/A$C2EB80DB8_1.pdf b/03_Python_OpenSource_DXF/test_precise/A$C2EB80DB8_1.pdf new file mode 100644 index 0000000..12a5dbf Binary files /dev/null and b/03_Python_OpenSource_DXF/test_precise/A$C2EB80DB8_1.pdf differ diff --git a/03_Python_OpenSource_DXF/模板/一级料表模板/columns_template.json b/03_Python_OpenSource_DXF/模板/一级料表模板/columns_template.json new file mode 100644 index 0000000..291ca6a --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/一级料表模板/columns_template.json @@ -0,0 +1,170 @@ +{ + "row_height": 8.0, + "column_definitions": [ + { + "name": "件号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.82, + 1.46 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + { + "name": "图号或标准号", + "relative_x_start": 15.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 14.77, + 1.15 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名称", + "relative_x_start": 45.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [ + 1.76, + 3.88 + ], + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "data_key": "english_name", + "relative_pos": [ + 1.79, + 1.0 + ], + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [ + 18.68, + 3.9 + ], + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "数量", + "relative_x_start": 100.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 4.97, + 1.37 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材料", + "relative_x_start": 110.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 15.16, + 1.12 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "单", + "relative_x_start": 140.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "总", + "relative_x_start": 150.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "备注", + "relative_x_start": 160.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 12.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/一级料表模板/drawing1_data.json b/03_Python_OpenSource_DXF/模板/一级料表模板/drawing1_data.json new file mode 100644 index 0000000..c2c2967 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/一级料表模板/drawing1_data.json @@ -0,0 +1,13 @@ +[ + {"件号": {"main": "1"}, "图号或标准号": {"main": "JB/T 1001"}, "名称": {"chinese_name": "轴承座", "english_name": "Bearing Seat"}, "数量": {"main": "2"}, "材料": {"main": "HT200"}, "单": {"main": "15.5"}, "总": {"main": "31.0"}, "备注": {"main": "外购"}}, + {"件号": {"main": "2"}, "图号或标准号": {"main": "GB/T 5783"}, "名称": {"chinese_name": "六角螺栓", "english_name": "Hex Bolt"}, "数量": {"main": "8"}, "材料": {"main": "Q235"}, "单": {"main": "0.5"}, "总": {"main": "4.0"}, "备注": {"main": "M8x20"}}, + {"件号": {"main": "3"}, "图号或标准号": {"main": "GB/T 93"}, "名称": {"chinese_name": "弹簧垫圈", "english_name": "Spring Washer"}, "数量": {"main": "8"}, "材料": {"main": "65Mn"}, "单": {"main": "0.1"}, "总": {"main": "0.8"}, "备注": {"main": "d8"}}, + {"件号": {"main": "4"}, "图号或标准号": {"main": "JB/T 2002"}, "名称": {"chinese_name": "齿轮", "english_name": "Gear"}, "数量": {"main": "1"}, "材料": {"main": "40Cr"}, "单": {"main": "25.0"}, "总": {"main": "25.0"}, "备注": {"main": "调质"}}, + {"件号": {"main": "5"}, "图号或标准号": {"main": "HG/T 3030"}, "名称": {"chinese_name": "密封圈", "english_name": "Seal Ring"}, "数量": {"main": "2"}, "材料": {"main": "NBR"}, "单": {"main": "2.3"}, "总": {"main": "4.6"}, "备注": {"main": ""}}, + {"件号": {"main": "6"}, "图号或标准号": {"main": "JB/T 3003"}, "名称": {"chinese_name": "键", "english_name": "Key"}, "数量": {"main": "1"}, "材料": {"main": "45#"}, "单": {"main": "0.2"}, "总": {"main": "0.2"}, "备注": {"main": "A型"}}, + {"件号": {"main": "7"}, "图号或标准号": {"main": "GB/T 119"}, "名称": {"chinese_name": "圆柱销", "english_name": "Dowel Pin"}, "数量": {"main": "4"}, "材料": {"main": "35#"}, "单": {"main": "0.3"}, "总": {"main": "1.2"}, "备注": {"main": ""}}, + {"件号": {"main": "8"}, "图号或标准号": {"main": "JB/T 4004"}, "名称": {"chinese_name": "轴", "english_name": "Shaft"}, "数量": {"main": "1"}, "材料": {"main": "40CrNiMo"}, "单": {"main": "50.0"}, "总": {"main": "50.0"}, "备注": {"main": "精加工"}}, + {"件号": {"main": "9"}, "图号或标准号": {"main": "GB/T 276"}, "名称": {"chinese_name": "深沟球轴承", "english_name": "Deep Groove Ball Bearing"}, "数量": {"main": "2"}, "材料": {"main": "GCr15"}, "单": {"main": "18.0"}, "总": {"main": "36.0"}, "备注": {"main": "外购"}}, + {"件号": {"main": "10"}, "图号或标准号": {"main": "JB/T 5005"}, "名称": {"chinese_name": "端盖", "english_name": "End Cap"}, "数量": {"main": "1"}, "材料": {"main": "ZG270-500"}, "单": {"main": "8.5"}, "总": {"main": "8.5"}, "备注": {"main": ""}} +] + diff --git a/03_Python_OpenSource_DXF/模板/一级料表模板/header_template.json b/03_Python_OpenSource_DXF/模板/一级料表模板/header_template.json new file mode 100644 index 0000000..dc4698d --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/一级料表模板/header_template.json @@ -0,0 +1,485 @@ +{ + "template_name": "标准物料清单-底部表头", + "row_height": 8.0, + "header_height": 14.0, + "column_boundaries": [ + 0.0, + 15.0, + 45.0, + 100.0, + 110.0, + 140.0, + 150.0, + 160.0, + 185.0 + ], + "header_definition": { + "lines": [ + { + "start": [ + 0.0, + 14.0 + ], + "end": [ + 185.0, + 14.0 + ] + }, + { + "start": [ + 160.0, + 6.5 + ], + "end": [ + 140.0, + 6.5 + ] + }, + { + "start": [ + 110.0, + 0.0 + ], + "end": [ + 110.0, + 14.0 + ] + }, + { + "start": [ + 15.0, + 14.0 + ], + "end": [ + 15.0, + 0.0 + ] + }, + { + "start": [ + 45.0, + 0.0 + ], + "end": [ + 45.0, + 14.0 + ] + }, + { + "start": [ + 100.0, + 0.0 + ], + "end": [ + 100.0, + 14.0 + ] + }, + { + "start": [ + 140.0, + 0.0 + ], + "end": [ + 140.0, + 14.0 + ] + }, + { + "start": [ + 160.0, + 0.0 + ], + "end": [ + 160.0, + 14.0 + ] + }, + { + "start": [ + 150.0, + 6.5 + ], + "end": [ + 150.0, + 14.0 + ] + }, + { + "start": [ + 0.0, + 0.0 + ], + "end": [ + 185.0, + 0.0 + ] + }, + { + "start": [ + 185.0, + 0.0 + ], + "end": [ + 185.0, + 14.0 + ] + } + ], + "texts": [ + { + "content": "总", + "relative_pos": [ + 153.62, + 10.23 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "单", + "relative_pos": [ + 143.79, + 10.02 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "TOTAL", + "relative_pos": [ + 152.64, + 7.45 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "SINGLE", + "relative_pos": [ + 141.89, + 7.45 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "备 注", + "relative_pos": [ + 169.33, + 6.8 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "材 料", + "relative_pos": [ + 121.56, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "数量", + "relative_pos": [ + 102.5, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "名 称", + "relative_pos": [ + 67.3, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "件 号", + "relative_pos": [ + 4.43, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "图号或标准号", + "relative_pos": [ + 22.43, + 6.53 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "MAT'L", + "relative_pos": [ + 122.94, + 2.33 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "QTY.", + "relative_pos": [ + 102.89, + 2.33 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "REMARKS", + "relative_pos": [ + 165.48, + 2.3 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "PARTS. NAME.", + "relative_pos": [ + 65.06, + 1.76 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "DWG NO. OR STD. NO.", + "relative_pos": [ + 19.43, + 1.76 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "PARTS .NO.", + "relative_pos": [ + 7.77, + 1.76 + ], + "alignment": "BOTTOM_CENTER", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "MASS(kg)", + "relative_pos": [ + 148.32, + 1.7 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "质量", + "relative_pos": [ + 142.49, + 0.87 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + "column_definitions": [ + { + "name": "件号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.82, 1.46], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + { + "name": "图号或标准号", + "relative_x_start": 15.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [14.77, 1.15], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名称", + "relative_x_start": 45.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [1.76, 3.88], + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "data_key": "english_name", + "relative_pos": [1.79, 1.0], + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [18.68, 3.9], + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "数量", + "relative_x_start": 100.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [4.97, 1.37], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材料", + "relative_x_start": 110.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [15.16, 1.12], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "单", + "relative_x_start": 140.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "总", + "relative_x_start": 150.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "备注", + "relative_x_start": 160.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [12.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/三级料表模板/columns_template.json b/03_Python_OpenSource_DXF/模板/三级料表模板/columns_template.json new file mode 100644 index 0000000..33ff87f --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/三级料表模板/columns_template.json @@ -0,0 +1,170 @@ +{ + "row_height": 8.0, + "column_definitions": [ + { + "name": "件 号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.82, + 1.46 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + { + "name": "图号或标准号", + "relative_x_start": 15.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 14.77, + 1.15 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名 称", + "relative_x_start": 45.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [ + 1.76, + 3.88 + ], + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "data_key": "english_name", + "relative_pos": [ + 1.79, + 1.0 + ], + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [ + 18.68, + 3.9 + ], + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "数量", + "relative_x_start": 100.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 4.97, + 1.37 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材 料", + "relative_x_start": 110.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 15.16, + 1.12 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "单", + "relative_x_start": 140.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "总", + "relative_x_start": 150.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 5.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "备 注", + "relative_x_start": 160.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [ + 10.06, + 1.42 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/三级料表模板/drawing1_data.json b/03_Python_OpenSource_DXF/模板/三级料表模板/drawing1_data.json new file mode 100644 index 0000000..a1b7b29 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/三级料表模板/drawing1_data.json @@ -0,0 +1,13 @@ +[ + {"件 号": {"main": "1"}, "图号或标准号": {"main": "JB/T 1001"}, "名 称": {"chinese_name": "轴承座", "english_name": "Bearing Seat"}, "数量": {"main": "2"}, "材 料": {"main": "HT200"}, "单": {"main": "15.5"}, "总": {"main": "31.0"}, "备 注": {"main": "外购"}}, + {"件 号": {"main": "2"}, "图号或标准号": {"main": "GB/T 5783"}, "名 称": {"chinese_name": "六角螺栓", "english_name": "Hex Bolt"}, "数量": {"main": "8"}, "材 料": {"main": "Q235"}, "单": {"main": "0.5"}, "总": {"main": "4.0"}, "备 注": {"main": "M8x20"}}, + {"件 号": {"main": "3"}, "图号或标准号": {"main": "GB/T 93"}, "名 称": {"chinese_name": "弹簧垫圈", "english_name": "Spring Washer"}, "数量": {"main": "8"}, "材 料": {"main": "65Mn"}, "单": {"main": "0.1"}, "总": {"main": "0.8"}, "备 注": {"main": "d8"}}, + {"件 号": {"main": "4"}, "图号或标准号": {"main": "JB/T 2002"}, "名 称": {"chinese_name": "齿轮", "english_name": "Gear"}, "数量": {"main": "1"}, "材 料": {"main": "40Cr"}, "单": {"main": "25.0"}, "总": {"main": "25.0"}, "备 注": {"main": "调质"}}, + {"件 号": {"main": "5"}, "图号或标准号": {"main": "HG/T 3030"}, "名 称": {"chinese_name": "密封圈", "english_name": "Seal Ring"}, "数量": {"main": "2"}, "材 料": {"main": "NBR"}, "单": {"main": "2.3"}, "总": {"main": "4.6"}, "备 注": {"main": ""}}, + {"件 号": {"main": "6"}, "图号或标准号": {"main": "JB/T 3003"}, "名 称": {"chinese_name": "键", "english_name": "Key"}, "数量": {"main": "1"}, "材 料": {"main": "45#"}, "单": {"main": "0.2"}, "总": {"main": "0.2"}, "备 注": {"main": "A型"}}, + {"件 号": {"main": "7"}, "图号或标准号": {"main": "GB/T 119"}, "名 称": {"chinese_name": "圆柱销", "english_name": "Dowel Pin"}, "数量": {"main": "4"}, "材 料": {"main": "35#"}, "单": {"main": "0.3"}, "总": {"main": "1.2"}, "备 注": {"main": ""}}, + {"件 号": {"main": "8"}, "图号或标准号": {"main": "JB/T 4004"}, "名 称": {"chinese_name": "轴", "english_name": "Shaft"}, "数量": {"main": "1"}, "材 料": {"main": "40CrNiMo"}, "单": {"main": "50.0"}, "总": {"main": "50.0"}, "备 注": {"main": "精加工"}}, + {"件 号": {"main": "9"}, "图号或标准号": {"main": "GB/T 276"}, "名 称": {"chinese_name": "深沟球轴承", "english_name": "Deep Groove Ball Bearing"}, "数量": {"main": "2"}, "材 料": {"main": "GCr15"}, "单": {"main": "18.0"}, "总": {"main": "36.0"}, "备 注": {"main": "外购"}}, + {"件 号": {"main": "10"}, "图号或标准号": {"main": "JB/T 5005"}, "名 称": {"chinese_name": "端盖", "english_name": "End Cap"}, "数量": {"main": "1"}, "材 料": {"main": "ZG270-500"}, "单": {"main": "8.5"}, "总": {"main": "8.5"}, "备 注": {"main": ""}} +] + diff --git a/03_Python_OpenSource_DXF/模板/三级料表模板/header_template.json b/03_Python_OpenSource_DXF/模板/三级料表模板/header_template.json new file mode 100644 index 0000000..55c4f19 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/三级料表模板/header_template.json @@ -0,0 +1,485 @@ +{ + "template_name": "标准物料清单-底部表头", + "row_height": 8.0, + "header_height": 14.0, + "column_boundaries": [ + 0.0, + 15.0, + 45.0, + 100.0, + 110.0, + 140.0, + 150.0, + 160.0, + 180.0 + ], + "header_definition": { + "lines": [ + { + "start": [ + 0.0, + 14.0 + ], + "end": [ + 185.0, + 14.0 + ] + }, + { + "start": [ + 160.0, + 6.5 + ], + "end": [ + 140.0, + 6.5 + ] + }, + { + "start": [ + 110.0, + 0.0 + ], + "end": [ + 110.0, + 14.0 + ] + }, + { + "start": [ + 15.0, + 14.0 + ], + "end": [ + 15.0, + 0.0 + ] + }, + { + "start": [ + 45.0, + 0.0 + ], + "end": [ + 45.0, + 14.0 + ] + }, + { + "start": [ + 100.0, + 0.0 + ], + "end": [ + 100.0, + 14.0 + ] + }, + { + "start": [ + 140.0, + 0.0 + ], + "end": [ + 140.0, + 14.0 + ] + }, + { + "start": [ + 160.0, + 0.0 + ], + "end": [ + 160.0, + 14.0 + ] + }, + { + "start": [ + 150.0, + 6.5 + ], + "end": [ + 150.0, + 14.0 + ] + }, + { + "start": [ + 0.0, + 0.0 + ], + "end": [ + 185.0, + 0.0 + ] + }, + { + "start": [ + 180.0, + 0.0 + ], + "end": [ + 180.0, + 14.0 + ] + } + ], + "texts": [ + { + "content": "总", + "relative_pos": [ + 153.62, + 10.23 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "单", + "relative_pos": [ + 143.79, + 10.02 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "TOTAL", + "relative_pos": [ + 152.64, + 7.45 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "SINGLE", + "relative_pos": [ + 141.89, + 7.45 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "备 注", + "relative_pos": [ + 169.33, + 6.8 + ], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "材 料", + "relative_pos": [ + 121.56, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "数量", + "relative_pos": [ + 102.5, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "名 称", + "relative_pos": [ + 67.3, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "件 号", + "relative_pos": [ + 4.43, + 6.56 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "图号或标准号", + "relative_pos": [ + 22.43, + 6.53 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "MAT'L", + "relative_pos": [ + 122.94, + 2.33 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "QTY.", + "relative_pos": [ + 102.89, + 2.33 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "REMARKS", + "relative_pos": [ + 165.48, + 2.3 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "PARTS. NAME.", + "relative_pos": [ + 65.06, + 1.76 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "DWG NO. OR STD. NO.", + "relative_pos": [ + 19.43, + 1.76 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "PARTS .NO.", + "relative_pos": [ + 7.77, + 1.76 + ], + "alignment": "BOTTOM_CENTER", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "MASS(kg)", + "relative_pos": [ + 148.32, + 1.7 + ], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "content": "质量", + "relative_pos": [ + 142.49, + 0.87 + ], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + "column_definitions": [ + { + "name": "件 号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.82, 1.46], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + } + ] + }, + { + "name": "图号或标准号", + "relative_x_start": 15.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [14.77, 1.15], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名 称", + "relative_x_start": 45.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [1.76, 3.88], + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 3 + }, + { + "data_key": "english_name", + "relative_pos": [1.79, 1.0], + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [18.68, 3.9], + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "数量", + "relative_x_start": 100.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [4.97, 1.37], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材 料", + "relative_x_start": 110.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [15.16, 1.12], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "单", + "relative_x_start": 140.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "总", + "relative_x_start": 150.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [5.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "备 注", + "relative_x_start": 160.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [10.06, 1.42], + "alignment": "BOTTOM_CENTER", + "height": 3.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/二级料表模板/columns_template.json b/03_Python_OpenSource_DXF/模板/二级料表模板/columns_template.json new file mode 100644 index 0000000..749f698 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/二级料表模板/columns_template.json @@ -0,0 +1,146 @@ +{ + "row_height": 8.0, + "column_definitions": [ + { + "name": "件号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [7.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名称", + "relative_x_start": 20.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [2.0, 3.58], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "english_name", + "relative_pos": [2.0, 1.0], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [20.0, 4.1], + "alignment": "BOTTOM_LEFT", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材料", + "relative_x_start": 65.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [15.0, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "chinese_name", + "relative_pos": [15.0, 3.58], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "english_name", + "relative_pos": [15.0, 1.0], + "alignment": "BOTTOM_CENTER", + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + } + ] + }, + { + "name": "质量", + "relative_x_start": 95.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [10.0, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "比例", + "relative_x_start": 115.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [7.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "所在图号", + "relative_x_start": 130.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [12.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "装配图号", + "relative_x_start": 155.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [12.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/二级料表模板/drawing2_data_corrected.json b/03_Python_OpenSource_DXF/模板/二级料表模板/drawing2_data_corrected.json new file mode 100644 index 0000000..fb6f418 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/二级料表模板/drawing2_data_corrected.json @@ -0,0 +1,255 @@ +[ + { + "件号": { + "main": "11" + }, + "名称": { + "chinese_name": "螺栓", + "english_name": "Bolt", + "specification": "M10x30" + }, + "材料": { + "main": "ML35" + }, + "质量": { + "main": "0.02" + }, + "比例": { + "main": "1:1" + }, + "所在图号": { + "main": "A-001-11" + }, + "装配图号": { + "main": "A-001" + } + }, + { + "件号": { + "main": "12" + }, + "名称": { + "chinese_name": "外壳", + "english_name": "Housing", + "specification": "" + }, + "材料": { + "chinese_name": "铸铁", + "english_name": "Cast Iron" + }, + "质量": { + "main": "5.2" + }, + "比例": { + "main": "1:2" + }, + "所在图号": { + "main": "B-002-01" + }, + "装配图号": { + "main": "B-002" + } + }, + { + "件号": { + "main": "13" + }, + "名称": { + "chinese_name": "齿轮轴", + "english_name": "Gear Shaft", + "specification": "m=2, z=30" + }, + "材料": { + "main": "40Cr" + }, + "质量": { + "main": "1.8" + }, + "比例": { + "main": "1:1" + }, + "所在图号": { + "main": "B-002-02" + }, + "装配图号": { + "main": "B-002" + } + }, + { + "件号": { + "main": "14" + }, + "名称": { + "chinese_name": "盖板", + "english_name": "Cover Plate", + "specification": "" + }, + "材料": { + "main": "Q235-A" + }, + "质量": { + "main": "0.75" + }, + "比例": { + "main": "1:2" + }, + "所在图号": { + "main": "C-003-01" + }, + "装配图号": { + "main": "C-003" + } + }, + { + "件号": { + "main": "15" + }, + "名称": { + "chinese_name": "轴承", + "english_name": "Bearing", + "specification": "6204" + }, + "材料": { + "main": "GCr15" + }, + "质量": { + "main": "0.1" + }, + "比例": { + "main": "" + }, + "所在图号": { + "main": "" + }, + "装配图号": { + "main": "B-002" + } + }, + { + "件号": { + "main": "16" + }, + "名称": { + "chinese_name": "密封垫", + "english_name": "Gasket", + "specification": "DN100" + }, + "材料": { + "chinese_name": "石棉橡胶板", + "english_name": "Asbestos Rubber" + }, + "质量": { + "main": "0.05" + }, + "比例": { + "main": "" + }, + "所在图号": { + "main": "" + }, + "装配图号": { + "main": "C-003" + } + }, + { + "件号": { + "main": "17" + }, + "名称": { + "chinese_name": "联轴器", + "english_name": "Coupling", + "specification": "HL3" + }, + "材料": { + "main": "HT200" + }, + "质量": { + "main": "3.5" + }, + "比例": { + "main": "1:2.5" + }, + "所在图号": { + "main": "D-004-01" + }, + "装配图号": { + "main": "D-004" + } + }, + { + "件号": { + "main": "18" + }, + "名称": { + "chinese_name": "电机支架", + "english_name": "Motor Bracket", + "specification": "" + }, + "材料": { + "main": "SS304" + }, + "质量": { + "main": "2.1" + }, + "比例": { + "main": "1:2" + }, + "所在图号": { + "main": "D-004-02" + }, + "装配图号": { + "main": "D-004" + } + }, + { + "件号": { + "main": "19" + }, + "名称": { + "chinese_name": "观察窗", + "english_name": "Sight Glass", + "specification": "DN50" + }, + "材料": { + "chinese_name": "有机玻璃", + "english_name": "Plexiglass" + }, + "质量": { + "main": "0.3" + }, + "比例": { + "main": "" + }, + "所在图号": { + "main": "" + }, + "装配图号": { + "main": "C-003" + } + }, + { + "件号": { + "main": "20" + }, + "名称": { + "chinese_name": "活塞", + "english_name": "Piston", + "specification": "D=80" + }, + "材料": { + "main": "ZL101" + }, + "质量": { + "main": "0.9" + }, + "比例": { + "main": "1:1" + }, + "所在图号": { + "main": "E-005-01" + }, + "装配图号": { + "main": "E-005" + } + } +] \ No newline at end of file diff --git a/03_Python_OpenSource_DXF/模板/二级料表模板/header_template.json b/03_Python_OpenSource_DXF/模板/二级料表模板/header_template.json new file mode 100644 index 0000000..c75d639 --- /dev/null +++ b/03_Python_OpenSource_DXF/模板/二级料表模板/header_template.json @@ -0,0 +1,320 @@ +{ + "template_name": "标准物料清单-底部表头", + "row_height": 12.0, + "header_height": 12.0, + "column_boundaries": [ + 0.0, + 20.0, + 65.0, + 95.0, + 115.0, + 130.0, + 155.0, + 180.0 + ], + "header_definition": { + "lines": [ + { + "start": [0.0, 0.0], + "end": [180.0, 0.0] + }, + { + "start": [0.0, 0.0], + "end": [0.0, 12.0] + }, + { + "start": [20.0, 0.0], + "end": [20.0, 12.0] + }, + { + "start": [65.0, 0.0], + "end": [65.0, 12.0] + }, + { + "start": [95.0, 0.0], + "end": [95.0, 12.0] + }, + { + "start": [115.0, 0.0], + "end": [115.0, 12.0] + }, + { + "start": [130.0, 0.0], + "end": [130.0, 12.0] + }, + { + "start": [155.0, 0.0], + "end": [155.0, 12.0] + }, + { + "start": [180.0, 0.0], + "end": [180.0, 12.0] + } + ], + "texts": [ + { + "content": "件 号", + "relative_pos": [6.16, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "PART NO.", + "relative_pos": [5.29, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "名 称", + "relative_pos": [35.60, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "PARTS. NAME.", + "relative_pos": [35.45, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "材 料", + "relative_pos": [75.65, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "MAT'L", + "relative_pos": [76.19, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "质量", + "relative_pos": [98.70, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "(kg)", + "relative_pos": [104.32, 6.25], + "height": 3, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "MASS", + "relative_pos": [102.15, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "比 例", + "relative_pos": [119.09, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "SCALE", + "relative_pos": [119.04, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "所在图号", + "relative_pos": [137.23, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "DWG. NO.", + "relative_pos": [138.16, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "装配图号", + "relative_pos": [162.59, 6.25], + "height": 3.5, + "style": "HZ", + "layer": "6文字层", + "color": 256 + }, + { + "content": "ASSY. DWG. NO.", + "relative_pos": [160.50, 1.89], + "height": 2.0, + "style": "HZ", + "layer": "6文字层", + "color": 256 + } + ] + }, + "column_definitions": [ + { + "name": "件号", + "relative_x_start": 0.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [7.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "名称", + "relative_x_start": 20.0, + "text_definitions": [ + { + "data_key": "chinese_name", + "relative_pos": [2.0, 3.58], + "alignment": "BOTTOM_LEFT", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "english_name", + "relative_pos": [2.0, 1.0], + "alignment": "BOTTOM_LEFT", + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + }, + { + "data_key": "specification", + "relative_pos": [20.0, 4.1], + "alignment": "BOTTOM_LEFT", + "height": 3.0, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "材料", + "relative_x_start": 65.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [15.0, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "chinese_name", + "relative_pos": [15.0, 3.58], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + }, + { + "data_key": "english_name", + "relative_pos": [15.0, 1.0], + "alignment": "BOTTOM_CENTER", + "height": 2.0, + "style": "HZTXT", + "layer": "2", + "color": 256 + } + ] + }, + { + "name": "质量", + "relative_x_start": 95.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [10.0, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "比例", + "relative_x_start": 115.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [7.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "所在图号", + "relative_x_start": 130.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [12.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + }, + { + "name": "装配图号", + "relative_x_start": 155.0, + "text_definitions": [ + { + "data_key": "main", + "relative_pos": [12.5, 2.17], + "alignment": "BOTTOM_CENTER", + "height": 3.5, + "style": "HZTXT", + "layer": "6文字层", + "color": 256 + } + ] + } + ] +} \ No newline at end of file