天天看点

pythonocc 画一条直线

# -*- coding: utf-8 -*-

"""

Created on Wed Jul  8 09:38:19 2020

@author: zxl

"""

from OCC.Core.gp import gp_Pnt

from OCC.Extend.ShapeFactory import make_wire

from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge

from OCC.Display.SimpleGui import init_display

display,start_display, add_menu,add_functionto_menu = init_display()

aPnt1 = gp_Pnt(1, 1, 1)

aPnt2 = gp_Pnt(1, 2, 3)

aEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt2).Edge()

aWire = make_wire(aEdge1)

display.DisplayShape(aWire)

display.FitAll() # make display fit the window

start_display()