Python初学者8号 发表于 2021-2-18 12:09:03

关于PyhtonOCC的建模

由于occ更新过于快,之前的一些包总是没办法在现在使用了,我现在记录一下一些建模的的方法

参考了诸位大佬],我写点笔记

1.生成直线:
这段代码是生成xyz上面的三个直线

from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCC.gp import gp_Pnt
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire
from OCC.GC import GC_MakeSegment
from OCC.Display.SimpleGui import init_display



aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(100, 0, 0))
aEdge_x = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(0, 100, 0))
aEdge_y = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(0, 0, 100))
aEdge_z = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

if __name__ == "__main__":
    from OCC.Display.SimpleGui import init_display

    display, start_display, add_menu, add_function_to_menu = init_display()
    for i in range(len(Ox)):
      display.DisplayShape(v, update=True, color=rgb_color(0, 1, 0))
    display.DisplayShape(aEdge_x, update=True, color="red")
    display.DisplayShape(aEdge_y, update=True, color="green")
    display.DisplayShape(aEdge_z, update=True, color="blue")
    display.DisplayShape(orgin, update=True, color="yellow")

    start_display()



页: [1]
查看完整版本: 关于PyhtonOCC的建模