pythonocc基础使用:2.提取曲线上的点位信息或者曲面上的点位信息

总目录 >> PythonOCC入门进阶到实战(目前已更新入门篇、基础篇和进阶篇)


BRepLProp:(local property 局部性质)

  • These global functions compute the degree ofcontinuity of a curve built by concatenation of twoedges at their junction point.
    BRepGProp :(global property 全部性质)
    -Provides global functions to compute a shape’s globalproperties for lines, surfaces or volumes, and bringthem together with the global properties alreadycomputed for a geometric system.The global properties computed for a system are :- its mass(质量),- its center of mass(质心),- its matrix of inertia(惯性矩阵),- its moment(惯性矩) about an axis,- its radius of gyration(回转半径) about an axis,- and its principal properties of inertia such as principal axis, principal moments, principal radius of gyration.

做cad开发,有一个很重要的目的就是识别曲线或者曲面的点位信息。
用的主要函数是breptools_UVBoundsGeomLProp_SurfaceTool.D1


    for shape in shp: #只有选中的是shp中的部分,才跳入到下面循环
        face = topods_Face(shape)
        surface=BRep_Tool.Surface(face)
        global umax, umin, vmax, vmin
        Umin, Umax, Vmin, Vmax = breptools_UVBounds(face)
        umax = str(Umax)
        umin = str(Umin)
        vmax = str(Vmax)
        vmin = str(Vmin)
        #face2 = BRepAdaptor_Surface(face1).D1()
        p=gp_Pnt() #点
        D1U=gp_Vec() #一阶u
        D1V=gp_Vec() #一阶v
        GeomLProp_SurfaceTool.D1(surface,0.3,0.4,p,D1U,D1V)
        #此处可以返回p(也就是该点的位置信息),,D1U是指U的一阶导数,D1V是指V的一阶导数,通过U的一阶导数与V的一阶导数的叉乘可以得到该点的法向量

© 版权声明
THE END
喜欢就支持一下吧
点赞67 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容