Open kalosu opened 2 months ago
I seem this is not the method you are aiming for, but it is possible to create a triangular face between neighboring points using the Delauney method. However, there are the following problems.
To construct a surface, it is necessary to create an algorithm that 1) constructs a surface from a set of partial points using B-Spline, etc., and 2) connects the surfaces so that the boundary parts do not become discontinuous. I do not know such an algorithm.
import numpy as np
from OCC.Core.gp import gp_Pnt
from OCCUtils.Construct import make_polygon
from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()
from scipy.spatial import ConvexHull, Delaunay, voronoi_plot_2d
# https://github.com/tpaviot/pythonocc-demos/blob/master/assets/models/bunny.pcd
pcd_file = "bunny.pcd"
dat = np.loadtxt(pcd_file, skiprows=10)
cov = Delaunay(dat[:, 0:2])
print(cov.simplices)
# print(cov.vertices)
for xyz in dat:
display.DisplayShape(gp_Pnt(*xyz))
for ixyz in cov.simplices:
lxyz = dat[ixyz]
display.DisplayShape(make_polygon(gp_Pnt(*p) for p in lxyz))
display.FitAll()
start_display()
Hello there pythonocc community,
I am new to this community and maybe what I am asking is really basic. However, I was not able to find any reference example for what I want to do.
I have a set of coordinate points (x,y,z) which are supposed to represent a continuous surface. From these points, I would like to generate a STEP file.
Is it possible to do this using pythonocc? (i.e, via generating a NURBS surface from the discrete points that I have)
Is there maybe some reference on how to do these two things?
Any comments and help will be appreciated!