// Prepare a file name to open
TCollection_AsciiString aNameWithExt("");
if (isMultiFile)
-- aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
- (getStudyServant()->URL())).c_str());
- (Kernel_Utils::encode(theComponent->GetStudy()->URL()))).c_str());
++ aNameWithExt = TCollection_AsciiString( (char*)(SALOMEDS_Tool::GetNameFromPath(
++ Kernel_Utils::encode(getStudyServant()->URL())).c_str()));
#if OCC_VERSION_MAJOR > 6
aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
#else
# Create the part
try:
- part = parts.__dict__[parttype](
- self._studyEditor.studyId, meshGroup,
- groupGeomObj, newparams)
+ part = parts.__dict__[parttype](meshGroup,
+ groupGeomObj, newparams)
element.addPart(part)
- except InvalidParameterError, e:
+ except InvalidParameterError as e:
logger.error("Invalid parameter error: %s" % e)
raise
except:
different parts of the structural element, and add them to the study.
"""
gg = salome.ImportComponentGUI("GEOM")
- geompy = getGeompy(self._studyEditor.studyId)
++
+ geompy = getGeompy()
- for part in self._parts.itervalues():
+ for part in self._parts.values():
# Build the structural element part
logger.debug("Building %s" % part)
try:
"""
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
name = Beam.DEFAULT_NAME, color = None):
if color is None:
- if parameters.has_key("R1"): # variable section
+ if "R1" in parameters: # variable section
color = LIGHT_RED
else: # constant section
color = RED
"""
- def __init__(self, studyId, groupName, groupGeomObj, parameters,
+ def __init__(self, groupName, groupGeomObj, parameters,
name = Beam.DEFAULT_NAME, color = None):
if color is None:
- if parameters.has_key("HY1") or parameters.has_key("H1"):
+ if "HY1" in parameters or "H1" in parameters:
color = LIGHT_BLUE # variable section
else: # constant section
color = BLUE
# Get information about objects
hasInfo = geompy.hasObjectInfo()
- print "Check if GEOM module provides information about its objects: ", hasInfo
+ print("Check if GEOM module provides information about its objects: ", hasInfo)
if hasInfo == True:
- print "Information about first object: ", geompy.getObjectInfo(obj1_entry)
- print "Information about second object: ", geompy.getObjectInfo(obj2_entry)
- print "Information about third object: ", geompy.getObjectInfo(obj3_entry)
- print "Information about fourth object: ", geompy.getObjectInfo(obj4_entry)
- print "Information about fifth object: ", geompy.getObjectInfo(obj5_entry)
- print("Information about first object: ", geompy.getObjectInfo(salome.myStudyId, obj1_entry))
- print("Information about second object: ", geompy.getObjectInfo(salome.myStudyId, obj2_entry))
- print("Information about third object: ", geompy.getObjectInfo(salome.myStudyId, obj3_entry))
- print("Information about fourth object: ", geompy.getObjectInfo(salome.myStudyId, obj4_entry))
- print("Information about fifth object: ", geompy.getObjectInfo(salome.myStudyId, obj5_entry))
++ print("Information about first object: ", geompy.getObjectInfo(obj1_entry))
++ print("Information about second object: ", geompy.getObjectInfo(obj2_entry))
++ print("Information about third object: ", geompy.getObjectInfo(obj3_entry))
++ print("Information about fourth object: ", geompy.getObjectInfo(obj4_entry))
++ print("Information about fifth object: ", geompy.getObjectInfo(obj5_entry))
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
if os.access(theFilenameToSave, os.F_OK):
if os.access(theFilenameToSave, os.W_OK):
os.remove(theFilenameToSave)
- salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
+ salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
else:
- print "You have no enough permissions to overwrite HDF file: ",theFilenameToSave
+ print("You have no enough permissions to overwrite HDF file: ",theFilenameToSave)
else:
- salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
+ salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
#print "-------- geomBuilder __init__ --- ", created, self
if not created:
created = True
- GEOM._objref_GEOM_Gen.__init__(self)
+ GEOM._objref_GEOM_Gen.__init__(self, *args)
self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
self.myBuilder = None
- self.myStudyId = 0
self.father = None
self.BasicOp = None
"""
# Example: see GEOM_TestAll.py
try:
- aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
+ aSObject = self.AddInStudy(aShape, aName, None)
if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
if doRestoreSubShapes:
- self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
+ self.RestoreSubShapesSO(aSObject, theArgs,
theFindMethod, theInheritFirstArg, True )
except:
- print "addToStudy() failed"
+ print("addToStudy() failed")
return ""
return aShape.GetStudyEntry()
"""
# Example: see GEOM_TestAll.py
try:
- aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
+ aSObject = self.AddInStudy(aShape, aName, aFather)
if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
except:
- print "addToStudyInFather() failed"
+ print("addToStudyInFather() failed")
return ""
return aShape.GetStudyEntry()
if include_min: left_str = " <= "
if include_max: right_str = " <= "
- self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
- + left_str + "length" + right_str + `max_length`)
+ self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
+ + left_str + "length" + right_str + repr(max_length))
- sg.updateObjBrowser(True)
+ sg.updateObjBrowser()
return group_edges
else:
return v, l, arc1, part1
-def pointsProjetes(study, vref, face):
- #geompy = geomBuilder.New(study)
+def pointsProjetes(vref, face):
vface = geompy.ExtractShapes(face, geompy.ShapeType["VERTEX"], True)
- vord = range(len(vref))
+ vord = list(range(len(vref)))
plan = geompy.MakePlaneThreePnt(vref[0], vref[1], vref[-1], 10000)
vproj = [ geompy.MakeProjection(vert, plan) for vert in vface ]
for i,v in enumerate(vproj):
vord[dist[0][1]] = vface[i]
return vord
-def arcsProjetes(study, vf, face):
- #geompy = geomBuilder.New(study)
+def arcsProjetes(vf, face):
lface = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
- lord = range(3)
+ lord = list(range(3))
ends = [vf[1], vf[6], vf[7], vf[3]]
for i in range(3):
for lf in lface:
h1 = r1 * 2.0
h2 = h1
try:
- res = build_shape(theStudy, r1, r2, h1, h2, thickness)
+ res = build_shape(r1, r2, h1, h2, thickness)
geompy.addToStudy(res, "res_%f_%f_%f"%(r1,r2, thickness))
except:
- print "problem with res_%f_%f_%f"%(r1,r2, thickness)
+ print("problem with res_%f_%f_%f"%(r1,r2, thickness))
if __name__=="__main__":
"""For testing purpose"""