pythonCascade Sample Problems

Import/Export: Reading a Brep

 

        self.Initialize()

        self.interactive_context.EraseAll(0,1)

 

        dlg = wxFileDialog(self,"Choose a BRep file","c:\work\awork\demo","","*.brep",wxOPEN|wxMULTIPLE)

        if dlg.ShowModal() == wxID_OK:

            self.aSequence= TopTools_HSequenceOfShape()

            aBuilder = BRep_Builder()

            result,aShape = BRepTools().Read(dlg.GetPath(),aBuilder)

            if result:

                self.aSequence.Append(aShape)

                for i in range(1,self.aSequence.Length()+1):

                    AIS_Shape(self.aSequence.Value(i))

                    self.interactive_context.Display(AIS_Shape(self.aSequence.Value(i)),1)

                   

            else:

                print "Error : The file is not read","CasCade Error"

 

 

 

        self.view.FitAll(0.01,0)

        self.view.ZFitAll(0.01)

        self.view.Redraw()