Changes between Version 3 and Version 4 of PythonOcc


Ignore:
Timestamp:
Nov 28, 2011, 11:57:44 AM (13 years ago)
Author:
Leon Kos
Comment:

cad kocke

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc

    v3 v4  
    316316    start_display()
    317317}}}
     318
     319=== Izris CAD kocke ===
     320{{{
     321#!python
     322## Izdelava kocke
     323
     324from OCC.Display.SimpleGui import *
     325from OCC.BRepPrimAPI import *
     326from OCC.gp import *
     327from OCC.GC import *
     328from OCC.BRepBuilderAPI import *
     329#from OCC.TopoDS import *
     330
     331display, start_display, add_menu, add_function_to_menu = init_display()
     332
     333#Definiranje točk v prostoru
     334aPnt1 = gp_Pnt(0 , 0 , 0)
     335aPnt2 = gp_Pnt(10 , 0, 0)
     336aPnt3 = gp_Pnt(10 , 10 , 0)
     337aPnt4 = gp_Pnt(0, 10 , 0)
     338
     339#Izdelava segmentov--definiranje geometrije
     340aSegment1 = GC_MakeSegment(aPnt1 , aPnt2)
     341aSegment2 = GC_MakeSegment(aPnt2 , aPnt3)
     342aSegment3 = GC_MakeSegment(aPnt3 , aPnt4)
     343aSegment4 = GC_MakeSegment(aPnt4 , aPnt1)
     344
     345#Izdelava robov -- definiranje topologije
     346aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1.Value())
     347aEdge2 = BRepBuilderAPI_MakeEdge(aSegment2.Value())
     348aEdge3 = BRepBuilderAPI_MakeEdge(aSegment3.Value())
     349aEdge4 = BRepBuilderAPI_MakeEdge(aSegment4.Value())
     350
     351#Povezovanje robov v mrežo
     352aWire  = BRepBuilderAPI_MakeWire(aEdge1.Edge() , aEdge2.Edge() ,\
     353                                 aEdge3.Edge(), aEdge4.Edge())
     354
     355#Telo: Iz profila se izdela telo
     356myFaceProfile = BRepBuilderAPI_MakeFace(aWire.Wire())
     357
     358aPrismVec = gp_Vec(0 , 0 , 10)
     359
     360myBody = BRepPrimAPI_MakePrism(myFaceProfile.Face() , aPrismVec).Shape()
     361
     362display.DisplayShape(myBody)
     363start_display()
     364}}}