Sorry, I forgot that the selection manager returns an AIS_Shape. You can get
the TopoDS_Shape from the AIS_Shape with the help of the Shape() method:

s1.IsEqual(sel.Shape())

Thomas



2010/4/29 Vladimir <u2...@e66.ru>

> Hi, Tomas!
> Error!
> My program fragments:
>
> 1) Drawing shape
> s = self.canva._3dDisplay.DisplayColoredShape(w,'YELLOW', False)
> s1 = s.GetObject()
> self.canva.drawDict[id_topo] = [heigth,coord_sys,s1]
> # I want save link to shape into dict as list with 3 elements.
> print s1
> <OCC.AIS.AIS_Shape; proxy of <Swig Object of type 'AIS_Shape *' at
> 0xa4328c0> >
>
>
> 2) Selected shape
> sel=self.canva._3dDisplay.selected_shape
> print sel
>
> <OCC.TopoDS.TopoDS_Shape; proxy of <Swig Object of type 'TopoDS_Shape *'
> at 0xa435fa0> >
>
> if sel:
>    for k in self.canva.drawDict.keys():
>        shapeInfo = self.canva.drawDict[k]
>        s1 =shapeInfo[2] # I get link to shape from dict
>        print(s1)
>
> <OCC.AIS.AIS_Shape; proxy of <Swig Object of type 'AIS_Shape *' at
> 0xa4350e0> >
>
>        if (s1.IsEqual(sel)):
>            print ("Selected " + str(shapeInfo))
>
> And I take Error:
>
> Traceback (most recent call last):
>  File "/home/cyx/ggis/pyGGIS/src/mineGIS.py", line 826, in OnCExplore
>    if (s1.IsEqual(sel)):
> AttributeError: 'AIS_Shape' object has no attribute 'IsEqual'
>
>
> If I do:
>
>  if (sel.IsEqual(s1)):
> TypeError: in method 'TopoDS_Shape_IsEqual', argument 2 of type
> 'TopoDS_Shape const &'
>
> I want identify selected shapes, that constructed from database
> records.
> drawDict[id_topo] - id_topo is primary key. How do it?
>
> Thanks!
> -
> С уважением, Суханов Владимир Иванович, д.т.н., зав.кафедрой ПСС
> УГТУ-УПИ. Тел: 375-97-18, 8912-628-83-91, 211-51-26
>
>
> В Чтв, 29/04/2010 в 08:15 +0200, Thomas Paviot пишет:
> > 2010/4/29 Vladimir <u2...@e66.ru>
> >         Hi All!
> >
> >         After
> >
> >         s =
> >         self.canva._3dDisplay.DisplayColoredShape(w,'YELLOW',False)
> >         s1 = s.GetObject()
> >         print s1
> >
> >         I have
> >
> >         <OCC.AIS.AIS_Shape; proxy of <Swig Object of type 'AIS_Shape
> >         *' at
> >         0xb311180> >
> >
> >         After selected
> >         sel=self.canva._3dDisplay.selected_shape
> >         print sel
> >
> >         I have
> >
> >         <OCC.TopoDS.TopoDS_Shape; proxy of <Swig Object of type
> >         'TopoDS_Shape *'
> >         at 0xb3164e0> >
> >
> >         How can I programmed check, that s1 (or s) and sel is equal
> >         objects?
> >
> >         Thanks!
> >         -
> >         С уважением, Суханов Владимир Иванович, д.т.н., зав.кафедрой
> >         ПСС
> >         УГТУ-УПИ. Тел: 375-97-18, 8912-628-83-91, 211-51-26
> >
> >
> >
> >
> > Hi Vladimir,
> >
> >
> > s1.IsEqual(sel) returns either True or False.
> >
> >
> > Regards,
> >
> >
> > Thomas
>
>
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to