I use the port provided by macports. With PyQt4, I was not able to do what I 
want (see my mail on this list on 4 november 2011 15:23:41 HNEC)

> port installed | grep wx
  py26-wxpython @2.8.10.1_0+gtk (active)
  wxWidgets-python @2.8.10.1_2+gtk (active)

I should say that I am able to load and manipulate STEP file with my own C++ 
code which is after wrapped with Swig. Here is the code in C++

void CADMBTB_loadArtefactCADFile(const char * fileName,double trans)
{
  if(!pAIS_InteractiveContext)
    return;

  printf("CADMBTB_loadArtefactCADFile using file %s.\n",fileName);
  STEPControl_Reader aReader;
  IFSelect_ReturnStatus status = aReader.ReadFile(fileName);
  if(status == IFSelect_RetDone)
  {
    //Interface_TraceFile::SetDefault();
    bool failsonly = false;
    aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
    int nbr = aReader.NbRootsForTransfer();
    aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);
    for(Standard_Integer n = 1; n <= nbr; n++)
    {
      bool ok = aReader.TransferRoot(n);
      int nbs = aReader.NbShapes();
      printf("importSTEP Solid, nb shapes: %d",nbs);
      if(nbs > 0)
      {
        for(int i = 1; i <= nbs; i++)
        {
          //    TopoDS_Shape shape = aReaderManette.Shape( i );
          AIS_Shape * pAis=new AIS_Shape(aReader.Shape(i));
          pAis->SetTransparency(trans);
          pAIS_InteractiveContext->Display(pAis, true);

        }
      }
    }
  }
}



Regards,
Vincent.



Le 5 déc. 2011 à 05:11, Thomas Paviot a écrit :

> How did you get it working? I've never find any wxPython/X11 on OSX.
> 
> Thomas
> 
> 2011/12/5 Vincent Acary <vincent.ac...@inria.fr>
> Here are the info:
> 
> wxPython on Apple MacOsX 10.6.8 Snow leopard. OpenCASCADE/6.3.0. pythonocc 0.5
> 
> Vincent
> 
> Le 4 déc. 2011 à 21:35, Thomas Paviot a écrit :
> 
>> Which GUI manager do you use: pyQt, wxPython? Which OS?
>> 
>> Thomas
>> 
>> 2011/12/4 Vincent Acary <vincent.ac...@inria.fr>
>> These new codes do not work with my installation. It is very strange. I am 
>> only to view something with
>> 
>> display.DisplayShape(step_reader.Shape(i))
>> 
>> Even in this case, I am not able to manpulate it with the mouse button
>> 
>> 
>> Vincent.
>> 
>> Le 4 déc. 2011 à 00:55, Thomas Paviot a écrit :
>> 
>>> Ok. The correct code should be:
>>> 
>>> for i in range(1,nbs+1) :
>>>     pAis=AIS_Shape( step_reader.Shape( i )).GetHandle()
>>>     display.Context.SetColor(pAis,Quantity.Quantity_NOC_DARKVIOLET,0)
>>>     display.Context.Display(pAis, True )
>>> 
>>> or, better:
>>> for i in range(1,nbs+1) :
>>>     display.DisplayColoredShape( step_reader.Shape( i 
>>> ),Quantity.Quantity_NOC_DARKVIOLET)
>>> 
>>> Thomas
>>> 
>>> 2011/12/3 Vincent Acary <vincent.ac...@inria.fr>
>>> Cher Thomas,
>>> 
>>> It works perfectly well ! Something was wrong perhaps in my cast.
>>> 
>>> Thank you very much
>>> 
>>> Vincent
>>> Le 3 déc. 2011 à 16:25, Thomas Paviot a écrit :
>>> 
>>>> 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
>>> 
>>> 
>>> --
>>> Vincent ACARY                                                           
>>> Chargé de recherche
>>> INRIA/ BIPOP                                     
>>> http://bipop.inrialpes.fr/people/acary     
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Pythonocc-users mailing list
>>> Pythonocc-users@gna.org
>>> https://mail.gna.org/listinfo/pythonocc-users
>>> 
>>> 
>>> _______________________________________________
>>> Pythonocc-users mailing list
>>> Pythonocc-users@gna.org
>>> https://mail.gna.org/listinfo/pythonocc-users
>> 
>> 
>> --
>> Vincent ACARY                                                           
>> Chargé de recherche
>> INRIA/ BIPOP                                     
>> http://bipop.inrialpes.fr/people/acary      
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Pythonocc-users mailing list
>> Pythonocc-users@gna.org
>> https://mail.gna.org/listinfo/pythonocc-users
>> 
>> 
>> _______________________________________________
>> Pythonocc-users mailing list
>> Pythonocc-users@gna.org
>> https://mail.gna.org/listinfo/pythonocc-users
> 
> 
> --
> Vincent ACARY                                                           
> Chargé de recherche
> INRIA/ BIPOP                                     
> http://bipop.inrialpes.fr/people/acary       
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users
> 
> 
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users

--
Vincent ACARY                                                           Chargé 
de recherche
INRIA/ BIPOP                                     
http://bipop.inrialpes.fr/people/acary 





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

Reply via email to