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