Compare commits
2 Commits
6caafc91a5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0665a83a9c | ||
|
|
d7e16069db |
10
cad.py
10
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]):
|
||||
|
||||
13
dem.py
13
dem.py
@@ -58,7 +58,7 @@ class Dem:
|
||||
toml_dict = self._toml_dict
|
||||
out_dxf_file_dir = toml_dict["parameter"]["out_dxf_file_dir"]
|
||||
# 写整个断面
|
||||
dm_whole_doc = ezdxf.new(dxfversion="R2004")
|
||||
dm_whole_doc = ezdxf.new(dxfversion="R2010")
|
||||
dm_whole_accumulative_distance = 0 # 累加里程
|
||||
dm_whole_msp = dm_whole_doc.modelspace()
|
||||
for foo in range(len(excel_pfs) - 1):
|
||||
@@ -74,7 +74,7 @@ class Dem:
|
||||
left_elevation = self.get_elevation(line_coordination[:, 0:2])
|
||||
center_elevation = self.get_elevation(line_coordination[:, 2:4])
|
||||
right_elevation = self.get_elevation(line_coordination[:, 4:6])
|
||||
dm_doc = ezdxf.new(dxfversion="R2004")
|
||||
dm_doc = ezdxf.new(dxfversion="R2010")
|
||||
# 设置线形
|
||||
# for name, desc, pattern in linetypes():
|
||||
# if name not in dm_doc.linetypes:
|
||||
@@ -93,6 +93,8 @@ class Dem:
|
||||
(x_axis[i] / 5 / zoom_factor, left_elevation[i] * 2 / zoom_factor)
|
||||
for i in range(len(left_elevation))
|
||||
]
|
||||
# dm_whole_msp.add_polyline2d([[0,0],[100,100]])
|
||||
# dm_doc.saveas('f.dxf')
|
||||
dm_whole_msp.add_polyline2d(
|
||||
np.array(left_line)
|
||||
+ np.hstack(
|
||||
@@ -378,7 +380,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 +400,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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user