Changes between Version 12 and Version 13 of PythonOcc


Ignore:
Timestamp:
Dec 27, 2011, 4:26:19 PM (13 years ago)
Author:
skulovec
Comment:

Prikaz izdelave kocke in uporaba funkcije krožnega izvleka

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc

    v12 v13  
    700700start_display()
    701701}}}
     702
     703=== Prikaz izdelave kocke in uporaba funkcije krožnega izvleka ===
     704{{{
     705#!python
     706##Prikaz izdelave kocke in uporaba funkcije krožnega izvleka
     707##S.Kulovec, 2011
     708
     709from OCC.gp import *
     710from OCC.BRepPrimAPI import *
     711from OCC.TopExp import *
     712from OCC.TopAbs import *
     713import OCC.TopoDS
     714from OCC.BRep import *
     715from OCC.Geom import *
     716from OCC.GCE2d import *
     717from OCC.Geom2d import *
     718from OCC.BRepLib import *
     719from OCC.BRepFeat import *
     720
     721from OCC.Utils.Topology import Topo
     722from OCC.BRepBuilderAPI import *
     723
     724import sys, time
     725from OCC.Display.SimpleGui import *
     726display, start_display, add_menu, add_function_to_menu = init_display()
     727
     728S = BRepPrimAPI_MakeBox(400.,250.,300.).Shape()
     729faces = list(Topo(S).faces())
     730F1 = faces[2]
     731surf = BRep_Tool_Surface(F1)
     732Pl = Handle_Geom_Plane_DownCast(surf)
     733
     734D = gp.gp_OX()
     735
     736MW1 = BRepBuilderAPI_MakeWire()
     737p1 = gp_Pnt2d(100.,100.)
     738p2 = gp_Pnt2d(200.,100.)
     739aline = GCE2d_MakeLine(p1,p2).Value()
     740MW1.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,p1.Distance(p2)).Edge())
     741
     742p1 = gp_Pnt2d(200.,100.)
     743p2 = gp_Pnt2d(150.,200.)
     744aline = GCE2d_MakeLine(p1,p2).Value()
     745MW1.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,p1.Distance(p2)).Edge())
     746
     747p1 = gp_Pnt2d(150.,200.)
     748p2 = gp_Pnt2d(100.,100.)
     749aline = GCE2d_MakeLine(p1,p2).Value()
     750MW1.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,p1.Distance(p2)).Edge())
     751
     752MKF1 = BRepBuilderAPI_MakeFace()
     753MKF1.Init(surf,False)
     754MKF1.Add(MW1.Wire())
     755FP = MKF1.Face()
     756BRepLib_BuildCurves3d(FP)
     757MKrev = BRepFeat_MakeRevol(S,FP,F1,D,1,True)
     758F2 = faces[4]
     759MKrev.Perform(F2)
     760display.EraseAll()
     761display.DisplayShape(MKrev.Shape())
     762
     763start_display()
     764
     765}}}