假设有一条曲线的边TopoDS_Edge,记为aEdge
from OCC.Core.BRepGProp import brepgprop_LinearProperties
from OCC.Core.GProp import GProp_GProps
from OCC.Core.GeomAdaptor import GeomAdaptor_Curve
from OCC.Core.GCPnts import GCPnts_UniformAbscissa
aCurve = BRep_Tool.Curve(aEdge)[0] # 先把它转换为Geom_Curve
system = GProp_GProps()
brepgprop_LinearProperties(aEdge, system)
# print("system.Mass(): ", system.Mass())
nb_ = system.Mass() / step # step是步长,这句话的意思是等步长平分周长,nb_是平分的点的数目
gac = GeomAdaptor_Curve(aCurve)
ua = GCPnts_UniformAbscissa(gac, nb_)
if ua.IsDone():
n = ua.NbPoints()
pts = []
for count in range(1, n + 1): # 索引从1开始,到n结束
p = gp_Pnt()
aCurve.D0(ua.Parameter(count), p) # 获取坐标
pts.append(p)