Changes between Version 24 and Version 25 of PythonOcc


Ignore:
Timestamp:
Nov 5, 2012, 3:48:55 PM (8 years ago)
Author:
skulovec
Comment:

Popravek kode za izris 3d modela

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc

    v24 v25  
    9090[[Image(3Dprimitives.png, width=480px)]]
    9191[[BR]]
     92
     93Primer kode 3D modela:[[BR]]
     94{{{
     95#!python
     96## Izdelava kocke
     97
     98from OCC.Display.SimpleGui import *
     99from OCC.BRepPrimAPI import *
     100from OCC.gp import *
     101from OCC.GC import *
     102from OCC.BRepBuilderAPI import *
     103#from OCC.TopoDS import *
     104
     105display, start_display, add_menu, add_function_to_menu = init_display()
     106
     107#Definiranje točk v prostoru
     108aPnt1 = gp_Pnt(0 , 0 , 0)
     109aPnt2 = gp_Pnt(10 , 0, 0)
     110aPnt3 = gp_Pnt(10 , 10 , 0)
     111aPnt4 = gp_Pnt(0, 10 , 0)
     112
     113#Izdelava segmentov--definiranje geometrije
     114aSegment1 = GC_MakeSegment(aPnt1 , aPnt2)
     115aSegment2 = GC_MakeSegment(aPnt2 , aPnt3)
     116aSegment3 = GC_MakeSegment(aPnt3 , aPnt4)
     117aSegment4 = GC_MakeSegment(aPnt4 , aPnt1)
     118
     119#Izdelava robov -- definiranje topologije
     120aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1.Value())
     121aEdge2 = BRepBuilderAPI_MakeEdge(aSegment2.Value())
     122aEdge3 = BRepBuilderAPI_MakeEdge(aSegment3.Value())
     123aEdge4 = BRepBuilderAPI_MakeEdge(aSegment4.Value())
     124
     125#Povezovanje robov v mrežo
     126aWire  = BRepBuilderAPI_MakeWire(aEdge1.Edge() , aEdge2.Edge() ,\
     127                                 aEdge3.Edge(), aEdge4.Edge())
     128
     129#Telo: Iz profila se izdela telo
     130myFaceProfile = BRepBuilderAPI_MakeFace(aWire.Wire())
     131
     132aPrismVec = gp_Vec(0 , 0 , 10)
     133
     134myBody = BRepPrimAPI_MakePrism(myFaceProfile.Face() , aPrismVec).Shape()
     135
     136display.DisplayShape(myBody)
     137start_display()
     138}}}
    92139
    93140=== Slikovni pregled izdelave 3D modela ===
     
    407454}}}
    408455
    409 === Izris CAD kocke ===
    410 {{{
    411 #!python
    412 ## Izdelava kocke
    413 
    414 from OCC.Display.SimpleGui import *
    415 from OCC.BRepPrimAPI import *
    416 from OCC.gp import *
    417 from OCC.GC import *
    418 from OCC.BRepBuilderAPI import *
    419 #from OCC.TopoDS import *
    420 
    421 display, start_display, add_menu, add_function_to_menu = init_display()
    422 
    423 #Definiranje točk v prostoru
    424 aPnt1 = gp_Pnt(0 , 0 , 0)
    425 aPnt2 = gp_Pnt(10 , 0, 0)
    426 aPnt3 = gp_Pnt(10 , 10 , 0)
    427 aPnt4 = gp_Pnt(0, 10 , 0)
    428 
    429 #Izdelava segmentov--definiranje geometrije
    430 aSegment1 = GC_MakeSegment(aPnt1 , aPnt2)
    431 aSegment2 = GC_MakeSegment(aPnt2 , aPnt3)
    432 aSegment3 = GC_MakeSegment(aPnt3 , aPnt4)
    433 aSegment4 = GC_MakeSegment(aPnt4 , aPnt1)
    434 
    435 #Izdelava robov -- definiranje topologije
    436 aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1.Value())
    437 aEdge2 = BRepBuilderAPI_MakeEdge(aSegment2.Value())
    438 aEdge3 = BRepBuilderAPI_MakeEdge(aSegment3.Value())
    439 aEdge4 = BRepBuilderAPI_MakeEdge(aSegment4.Value())
    440 
    441 #Povezovanje robov v mrežo
    442 aWire  = BRepBuilderAPI_MakeWire(aEdge1.Edge() , aEdge2.Edge() ,\
    443                                  aEdge3.Edge(), aEdge4.Edge())
    444 
    445 #Telo: Iz profila se izdela telo
    446 myFaceProfile = BRepBuilderAPI_MakeFace(aWire.Wire())
    447 
    448 aPrismVec = gp_Vec(0 , 0 , 10)
    449 
    450 myBody = BRepPrimAPI_MakePrism(myFaceProfile.Face() , aPrismVec).Shape()
    451 
    452 display.DisplayShape(myBody)
    453 start_display()
    454 }}}
    455456
    456457=== Izris CAD prizme ===