2011/12/3 Vincent Acary <vincent.ac...@inria.fr>

> Dear pyhtonocc users,
>
> I use the following file script to try to us view a STEP file, byt nothing
> appear ?
>
> Do you have an idea where is my (huge) mistake ?
>
> Is there an equivalent example in the repository ?
>
> Vincent
>
> from OCC.BRepPrimAPI import *
> from OCC.gp import *
> from OCC.TopLoc import *
> from OCC.AIS import *
> from OCC.Display.SimpleGui import *
> display, start_display, add_menu, add_function_to_menu = init_display()
> v = display.GetView().GetObject()
>
> from OCC import STEPControl,Quantity
>
> step_reader = STEPControl.STEPControl_Reader()
> status =  step_reader.ReadFile(filename)
> if(status == STEPControl.IFSelect.IFSelect_RetDone):
>     #Interface_TraceFile::SetDefault();
>     failsonly = False
>     step_reader.PrintCheckLoad( failsonly,
> STEPControl.IFSelect.IFSelect_ItemsByEntity )
>     nbr = step_reader.NbRootsForTransfer()
>     step_reader.PrintCheckTransfer( failsonly,
> STEPControl.IFSelect.IFSelect_ItemsByEntity )
>     for n in range(1,nbr+1) :
>         ok = step_reader.TransferRoot( n )
>         nbs = step_reader.NbShapes()
>         trans=2.0
>         print "importSTEP Solid, nb shapes ", nbs
>         if  nbs > 0  :
>             for i in range(1,nbs+1) :
>                 # TopoDS_Shape shape = aReaderManette.Shape( i );
>                 pAis=AIS_Shape( step_reader.Shape( i ))
>                 #pAis.SetTransparency(1)
>                 pAis.SetColor(Quantity.Quantity_NOC_DARKVIOLET);
>                 #pAis.SetMaterial(Graphic3d_NOM_PLASTIC);
>                 toto = Handle_AIS_InteractiveObject(pAis)
>                 display.Context.Display(toto, True )
>
>     display.Context.UpdateCurrentViewer()
> else:
>     print "An error occured when loading", filename
>
>
Hi Vincent,

Is something displayed if you move your display code from
"""
pAis=AIS_Shape( step_reader.Shape( i ))
pAis.SetColor(Quantity.Quantity_NOC_DARKVIOLET);
toto = Handle_AIS_InteractiveObject(pAis)
display.Context.Display(toto, True )
"""

to

"""
display.DisplayShape(step_reader.Shape(i))
"""
?

Thomas
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to