pythococc_锥度弯曲管

在这里插入图片描述

from OCC.Core.BRepOffsetAPI import BRepOffsetAPI_MakePipeShell
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire
from OCC.Core.Geom import Geom_BezierCurve
from OCC.Core.Law import Law_Linear
from OCC.Core.TColgp import TColgp_Array1OfPnt
from OCC.Core.gp import gp_Circ, gp_Pnt, gp_ZOX

from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()

def thicken_spline(event=None):
    # Creation of points for the spine
    array = TColgp_Array1OfPnt(1, 5)
    array.SetValue(1, gp_Pnt(1, 4,0))
    array.SetValue(2, gp_Pnt(2, 2,0))
    array.SetValue(3, gp_Pnt(3, 3,0))
    array.SetValue(4, gp_Pnt(4, 3,0))
    array.SetValue(5, gp_Pnt(5, 5,0))

    # Creation of a Bezier Curve as the spine #创建贝塞尔曲线作为主干
    bz_curv = Geom_BezierCurve(array)
    bz_curv_edge = BRepBuilderAPI_MakeEdge(bz_curv).Edge()
    bz_curv_wire = BRepBuilderAPI_MakeWire(bz_curv_edge).Wire()
    display.DisplayShape(bz_curv_wire)

    # Creation of profile to sweep along the spine #创建沿脊柱扫描的轮廓
    circle = gp_Circ(gp_ZOX(), 1)
    circle.SetLocation(array[0])
    circle_edge = BRepBuilderAPI_MakeEdge(circle).Edge()
    circle_wire = BRepBuilderAPI_MakeWire(circle_edge).Wire()

    # Creation of the law to dictate the evolution of the profile#创造法律来规定轮廓的演变 
    brep1  =BRepOffsetAPI_MakePipeShell(bz_curv_wire)
    law_f = Law_Linear()
    law_f.Set(0, 0.5, 1, 1)
    brep1.SetLaw(circle_wire,law_f, False, True)
    return brep1.Shape()


if __name__ == '__main__':
    display.DisplayShape(thicken_spline(), update=True)
    start_display()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值