diff --git a/cad.py b/cad.py index 641bad9..d47a963 100644 --- a/cad.py +++ b/cad.py @@ -3,7 +3,6 @@ import os import subprocess - def convert_dxf_to_dwg(dxf_files: List[str]): cad_file_path = r"D:/Program Files/Cad2022/AutoCAD 2022/accoreconsole.exe" first_dwg_file = dxf_files[0] @@ -15,9 +14,16 @@ def convert_dxf_to_dwg(dxf_files: List[str]): new_dwg_name = f"{file_name_path}.dwg" if os.path.exists(new_dwg_name): os.remove(new_dwg_name) + new_dwg_name = new_dwg_name.replace("//", "/") f.write(f'saveas 2004 "{new_dwg_name}"\n') cmd = rf'"{cad_file_path}" /s "{script_path}" /i "{dxf}" /iso' - subprocess.call(cmd,stderr=subprocess.DEVNULL,stdin=subprocess.DEVNULL,stdout=subprocess.DEVNULL) + cmd = cmd.replace("//", "/") + subprocess.call( + cmd, + stderr=subprocess.DEVNULL, + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + ) def convert_dxf_to_dwg1(dxf_files: List[str]): diff --git a/dem.py b/dem.py index 5922644..2ca8bc8 100644 --- a/dem.py +++ b/dem.py @@ -378,7 +378,8 @@ class Dem: path_length = ( (point_x_s - point_x_e) ** 2 + (point_y_s - point_y_e) ** 2 ) ** 0.5 - dem_resolution = self._dem_resolution # dem的精度 + # dem_resolution = self._dem_resolution # dem的精度 + dem_resolution = 5 # TODO:设定为5m 1个点。 n = round(path_length / dem_resolution) # n = round(path_length / 5) @@ -397,7 +398,9 @@ class Dem: left_offset_y = side_width * math.sin(line_angel + math.pi / 2) left_offset_point_x = center_point_x + left_offset_x left_offset_point_y = center_point_y + left_offset_y - right_offset_point_x = center_point_x - left_offset_x # 向左偏移和向右偏移正好是相反的 + right_offset_point_x = ( + center_point_x - left_offset_x + ) # 向左偏移和向右偏移正好是相反的 right_offset_point_y = center_point_y - left_offset_y r = np.array( [