pythonCascade Sample Problems

self.Initialize()
self.interactive_context.EraseAll(0,1)
dlg = wxFileDialog(self,"Choose a
CSFDB
file","c:\work\awork\demo","","*.csfdb",wxOPEN|wxMULTIPLE)
if dlg.ShowModal() == wxID_OK:
self.aSequence= TopTools_HSequenceOfShape()
f = FSD_File()
s = ShapeSchema()
d = Storage_Data()
d.ClearErrorStatus()
if
FSD_File().IsGoodFileType(dlg.GetPath()) != Storage_VSOk:
print "Bad file type for "
+ dlg.GetPath()
return
# Open the archive, Read mode
err = f.Open(dlg.GetPath(),
Storage_VSRead)
# Read all the persistent object
in the file with the schema
if err != Storage_VSOk:
BuildStorageErrorMessage(d.ErrorStatus())
return
d = s.Read( f )
err = d.ErrorStatus()
if err != Storage_VSOk :
BuildStorageErrorMessage(d.ErrorStatus())
return
f.Close()
print "Application Name :" + d.ApplicationName()
print "Application Version :" + d.ApplicationVersion()
print "Data type :"+ d.DataType()
print "== User Infos : ==\n"
UserInfo = d.UserInfo()
for i in UserInfo:
print i
print "== Comments :
==\n"
Comments=d.Comments()
for i in Comments:
print i
roots = d.Roots()
for i in range(1,roots.Length()+1
):
# Get the root
r = roots.Value(i)
# Get the persistent application
object from the root
p = r.Object()
# Display information
print "Persistent Object
"+`i`
print "Name :" + r.Name()
print "Type :" + r.Type()
aPShape = PTopoDS_HShape().DownCast(p)
if aPShape.IsNull() == 0:
#To Be ReWriten to suppress the cout,
# and provide a CallBack method for dynamic
information.
# Get the persistent shape
aMap = PTColStd_PersistentTransientMap()
aMap,aTShape =
MgtBRep().Translate(aPShape,MgtBRepAbs_WithTriangle)
self.aSequence.Append(aTShape)
else:
print "Unable to
read"
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)
self.view.FitAll(0.01,0)
self.view.ZFitAll(0.01)
self.view.Redraw()