Hello, 
 
If you want to display a shape in a wxPython based display window, you can use 
the method:
 
DisplayShape(your_shape) of the Display3d class.
 
The material used for the shape is the default material. You can also specify a 
different material. Available materials are:
Graphic3d_NOM_BRASS,
Graphic3d_NOM_BRONZE,
Graphic3d_NOM_COPPER,
Graphic3d_NOM_GOLD,
Graphic3d_NOM_PEWTER,
Graphic3d_NOM_PLASTER,
Graphic3d_NOM_PLASTIC,
Graphic3d_NOM_SILVER,
Graphic3d_NOM_STEEL,
Graphic3d_NOM_STONE,
Graphic3d_NOM_SHINY_PLASTIC,
Graphic3d_NOM_SATIN,
Graphic3d_NOM_METALIZED,
Graphic3d_NOM_NEON_GNC,
Graphic3d_NOM_CHROME,
Graphic3d_NOM_ALUMINIUM,
Graphic3d_NOM_OBSIDIAN,
Graphic3d_NOM_NEON_PHC,
Graphic3d_NOM_JADE,
Graphic3d_NOM_DEFAULT,
Graphic3d_NOM_UserDefined

 

1st step: create your material:

my_material = Graphic3d_MaterialAspect(Graphic3d_NOM_CHROME)

2nd step: display shape


DisplayShape(my_shape,my_material).

Another possibility is to customize your own material: create a new material ( 
my_material = Graphic3d_MaterialAspect() ) and set emissive, specular, 
reflection etc.

The screenshot below was obtained with "Silver" mand "Gold" materials. Source 
code is attached.

Thomas






<<attachment: moz-screenshot-6.jpg>>

<<attachment: moz-screenshot-7.jpg>>

#!/usr/bin/env python

##Copyright 2008 Thomas Paviot
##
[EMAIL PROTECTED]
##
##pythonOCC is a computer program whose purpose is to provide a complete set
##of python bindings for OpenCasacde library.
##
##This software is governed by the CeCILL license under French law and
##abiding by the rules of distribution of free software.  You can  use, 
##modify and/ or redistribute the software under the terms of the CeCILL
##license as circulated by CEA, CNRS and INRIA at the following URL
##"http://www.cecill.info";. 
##
##As a counterpart to the access to the source code and  rights to copy,
##modify and redistribute granted by the license, users are provided only
##with a limited warranty  and the software's author,  the holder of the
##economic rights,  and the successive licensors  have only  limited
##liability. 
##
##In this respect, the user's attention is drawn to the risks associated
##with loading,  using,  modifying and/or developing or reproducing the
##software by the user in light of its specific status of free software,
##that may mean  that it is complicated to manipulate,  and  that  also
##therefore means  that it is reserved for developers  and  experienced
##professionals having in-depth computer knowledge. Users are therefore
##encouraged to load and test the software's suitability as regards their
##requirements in conditions enabling the security of their systems and/or 
##data to be ensured and,  more generally, to use and operate it in the 
##same conditions as regards security. 
##
##The fact that you are presently reading this means that you have had
##knowledge of the CeCILL license and that you accept its terms.

from OCC import *

import wx
from wxDisplay import GraphicsCanva3D

if __name__=="__main__":
    class AppFrame(wx.Frame):
        def __init__(self, parent):
            wx.Frame.__init__(self, parent, -1, "Material", 
style=wx.DEFAULT_FRAME_STYLE,size = (640,480))
            self.canva = GraphicsCanva3D(self)
            my_material = Graphic3d_MaterialAspect(Graphic3d_NOM_GOLD)
            S = BRepPrimAPI_MakeTorus(400,100)
            shape = S.Shape()
            self.canva._3dDisplay.DisplayShape(S.Shape(),my_material)
    app = wx.PySimpleApp()
    wx.InitAllImageHandlers()
    frame = AppFrame(None)
    frame.Show(True)
    app.SetTopWindow(frame)
    app.MainLoop()            
_______________________________________________
Minerva-pythonocc mailing list
Minerva-pythonocc@gna.org
https://mail.gna.org/listinfo/minerva-pythonocc

Reply via email to