파이썬에서에서 dxf 파일을 ply로 변환

그러나 가능하면 dxf로 cloud data를 뽑지 맙시다

import ezdxf
import numpy as np
import open3d as o3d
import tqdm

# read dxf file
File = "your file name"
doc = ezdxf.readfile(File + ".dxf")
msp = doc.modelspace()

points = msp.query('POINT')
entity_types = set(entity.dxftype() for entity in msp)

print("Entities in modelspace:")
for entity_type in entity_types:
print(entity_type)

vertices = []
for entity in msp:
if entity.dxftype() == "POINT":
point = entity.dxf.location
vertices.append(point)

vertices = np.array(vertices)
print(vertices.shape)

# Plot the vertices on open3d
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(vertices)
# o3d.visualization.draw_geometries([pcd])


# save the point cloud
o3d.io.write_point_cloud(File + "_conveted.ply", pcd)