修复了autocad不能识别//路径的bug。
This commit is contained in:
parent
6caafc91a5
commit
d7e16069db
10
cad.py
10
cad.py
|
|
@ -3,7 +3,6 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def convert_dxf_to_dwg(dxf_files: List[str]):
|
def convert_dxf_to_dwg(dxf_files: List[str]):
|
||||||
cad_file_path = r"D:/Program Files/Cad2022/AutoCAD 2022/accoreconsole.exe"
|
cad_file_path = r"D:/Program Files/Cad2022/AutoCAD 2022/accoreconsole.exe"
|
||||||
first_dwg_file = dxf_files[0]
|
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"
|
new_dwg_name = f"{file_name_path}.dwg"
|
||||||
if os.path.exists(new_dwg_name):
|
if os.path.exists(new_dwg_name):
|
||||||
os.remove(new_dwg_name)
|
os.remove(new_dwg_name)
|
||||||
|
new_dwg_name = new_dwg_name.replace("//", "/")
|
||||||
f.write(f'saveas 2004 "{new_dwg_name}"\n')
|
f.write(f'saveas 2004 "{new_dwg_name}"\n')
|
||||||
cmd = rf'"{cad_file_path}" /s "{script_path}" /i "{dxf}" /iso'
|
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]):
|
def convert_dxf_to_dwg1(dxf_files: List[str]):
|
||||||
|
|
|
||||||
7
dem.py
7
dem.py
|
|
@ -378,7 +378,8 @@ class Dem:
|
||||||
path_length = (
|
path_length = (
|
||||||
(point_x_s - point_x_e) ** 2 + (point_y_s - point_y_e) ** 2
|
(point_x_s - point_x_e) ** 2 + (point_y_s - point_y_e) ** 2
|
||||||
) ** 0.5
|
) ** 0.5
|
||||||
dem_resolution = self._dem_resolution # dem的精度
|
# dem_resolution = self._dem_resolution # dem的精度
|
||||||
|
dem_resolution = 5
|
||||||
# TODO:设定为5m 1个点。
|
# TODO:设定为5m 1个点。
|
||||||
n = round(path_length / dem_resolution)
|
n = round(path_length / dem_resolution)
|
||||||
# n = round(path_length / 5)
|
# 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_y = side_width * math.sin(line_angel + math.pi / 2)
|
||||||
left_offset_point_x = center_point_x + left_offset_x
|
left_offset_point_x = center_point_x + left_offset_x
|
||||||
left_offset_point_y = center_point_y + left_offset_y
|
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
|
right_offset_point_y = center_point_y - left_offset_y
|
||||||
r = np.array(
|
r = np.array(
|
||||||
[
|
[
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue