Changes between Version 8 and Version 9 of PythonOcc


Ignore:
Timestamp:
Dec 12, 2011, 3:06:25 PM (13 years ago)
Author:
skulovec
Comment:

STEP->barve in layerji

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc

    v8 v9  
    435435
    436436# Pripravimo enostaven CAD primer za izvoz v STEP format
    437 my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape()
     437my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape() # Izdelava kocke
    438438
    439439# Obliko my_box_shape izvozimo v STEP format
    440 my_step_exporter = STEPExporter("result_export_single.stp")
     440my_step_exporter = STEPExporter("result_export_single.stp") # Določitev imena file.a
    441441my_step_exporter.add_shape(my_box_shape)
    442442my_step_exporter.write_file()
     
    453453
    454454# Pripravimo enostavna CAD primera za izvoz v STEP format
    455 my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape()
    456 my_sphere_shape = BRepPrimAPI_MakeSphere(20).Shape()
     455my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape() # Izdelava kocke
     456my_sphere_shape = BRepPrimAPI_MakeSphere(20).Shape() # Izdelava krogle
    457457
    458458# Obliki my_box_shape in my_sphere_shape izvozimo v STEP format
    459 my_step_exporter = STEPExporter("result_export_multi.stp")
     459my_step_exporter = STEPExporter("result_export_multi.stp") # Določitev imena file.a
    460460my_step_exporter.add_shape(my_box_shape)
    461461my_step_exporter.add_shape(my_sphere_shape) #funkcijo ADD uporabimo za dodajanje oblik v STEP format
    462462my_step_exporter.write_file()
     463}}}
     464
     465=== Prikaz izvoza CAD modelov z barvami in layer.ji ===
     466{{{
     467#!python
     468# Vključimo knjižnico za izvoz STEP formata
     469from OCC.Utils.DataExchange.STEP import StepOCAF_Export
     470
     471from OCC.BRepPrimAPI import *
     472
     473# Pripravimo enostavna CAD primera za izvoz v STEP format
     474my_box_shape = BRepPrimAPI_MakeBox(50,50,50).Shape() # Izdelava kocke
     475my_sphere_shape = BRepPrimAPI_MakeSphere(20).Shape() # Izdelava krogle
     476
     477# Export to STEP
     478my_step_exporter = StepOCAF_Export("result_export_multi_color_layer.stp") # Določitev imena file.a
     479my_step_exporter.set_color(1,0,0) # določitev barve (rdeča) -> RedGreenBlue paleta barv (RGB)
     480my_step_exporter.set_layer('red') # določitev layer.ja
     481my_step_exporter.add_shape(my_box_shape) # izbira oblike za izbrane parametre my_box_shape
     482my_step_exporter.set_color(0,1,0)
     483my_step_exporter.set_layer('green')
     484my_step_exporter.add_shape(my_sphere_shape)
     485my_step_exporter.write_file()
     486
    463487}}}
    464488