mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-17 03:27:55 +05:00
Added possibilty to re-init geompy by new Study
This commit is contained in:
parent
4d153d0bec
commit
c2ef5d47ff
@ -36,20 +36,67 @@ import GEOM
|
|||||||
|
|
||||||
g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
|
g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
|
||||||
geom = g._narrow( GEOM.GEOM_Gen )
|
geom = g._narrow( GEOM.GEOM_Gen )
|
||||||
myBuilder = myStudy.NewBuilder()
|
gg = ImportComponentGUI("GEOM")
|
||||||
|
|
||||||
father = myStudy.FindComponent("GEOM")
|
#SRN: modified on Mar 18, 2005
|
||||||
if father is None:
|
|
||||||
father = myBuilder.NewComponent("GEOM")
|
geomStudy = None
|
||||||
A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
|
geomBuilder = None
|
||||||
|
geomStudyId = 0
|
||||||
|
BasicOp = None
|
||||||
|
CurvesOp = None
|
||||||
|
PrimOp = None
|
||||||
|
ShapesOp = None
|
||||||
|
HealOp = None
|
||||||
|
InsertOp = None
|
||||||
|
BoolOp = None
|
||||||
|
TrsfOp = None
|
||||||
|
LocalOp = None
|
||||||
|
MeasuOp = None
|
||||||
|
BlocksOp = None
|
||||||
|
GroupOp = None
|
||||||
|
|
||||||
|
def init_geom(theStudy):
|
||||||
|
|
||||||
|
global geomStudy, geomBuilder, geomStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp
|
||||||
|
global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp
|
||||||
|
|
||||||
|
geomStudy = theStudy
|
||||||
|
geomStudyId = geomStudy._get_StudyId()
|
||||||
|
geomBuilder = geomStudy.NewBuilder()
|
||||||
|
father = geomStudy.FindComponent("GEOM")
|
||||||
|
if father is None:
|
||||||
|
father = geomBuilder.NewComponent("GEOM")
|
||||||
|
A1 = geomBuilder.FindOrCreateAttribute(father, "AttributeName")
|
||||||
FName = A1._narrow(SALOMEDS.AttributeName)
|
FName = A1._narrow(SALOMEDS.AttributeName)
|
||||||
FName.SetValue("Geometry")
|
FName.SetValue("Geometry")
|
||||||
A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
|
A2 = geomBuilder.FindOrCreateAttribute(father, "AttributePixMap")
|
||||||
aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
|
aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
|
||||||
aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
|
aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
|
||||||
myBuilder.DefineComponentInstance(father,geom)
|
geomBuilder.DefineComponentInstance(father,geom)
|
||||||
|
pass
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Assign Operations Interfaces
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
gg = ImportComponentGUI("GEOM")
|
BasicOp = geom.GetIBasicOperations (geomStudyId)
|
||||||
|
CurvesOp = geom.GetICurvesOperations (geomStudyId)
|
||||||
|
PrimOp = geom.GetI3DPrimOperations (geomStudyId)
|
||||||
|
ShapesOp = geom.GetIShapesOperations (geomStudyId)
|
||||||
|
HealOp = geom.GetIHealingOperations (geomStudyId)
|
||||||
|
InsertOp = geom.GetIInsertOperations (geomStudyId)
|
||||||
|
BoolOp = geom.GetIBooleanOperations (geomStudyId)
|
||||||
|
TrsfOp = geom.GetITransformOperations(geomStudyId)
|
||||||
|
LocalOp = geom.GetILocalOperations (geomStudyId)
|
||||||
|
MeasuOp = geom.GetIMeasureOperations (geomStudyId)
|
||||||
|
BlocksOp = geom.GetIBlocksOperations (geomStudyId)
|
||||||
|
GroupOp = geom.GetIGroupOperations (geomStudyId)
|
||||||
|
pass
|
||||||
|
|
||||||
|
init_geom(myStudy)
|
||||||
|
|
||||||
|
#SRN: end of modifications
|
||||||
|
|
||||||
def SubShapeName(aSubObj, aMainObj):
|
def SubShapeName(aSubObj, aMainObj):
|
||||||
"""
|
"""
|
||||||
@ -70,7 +117,7 @@ def addToStudy(aShape, aName):
|
|||||||
* Example: see GEOM_TestAll.py
|
* Example: see GEOM_TestAll.py
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
|
aSObject = geom.AddInStudy(geomStudy, aShape, aName, None)
|
||||||
except:
|
except:
|
||||||
print "addToStudy() failed"
|
print "addToStudy() failed"
|
||||||
return ""
|
return ""
|
||||||
@ -83,7 +130,7 @@ def addToStudyInFather(aFather, aShape, aName):
|
|||||||
* Example: see GEOM_TestAll.py
|
* Example: see GEOM_TestAll.py
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
|
aSObject = geom.AddInStudy(geomStudy, aShape, aName, aFather)
|
||||||
except:
|
except:
|
||||||
print "addToStudyInFather() failed"
|
print "addToStudyInFather() failed"
|
||||||
return ""
|
return ""
|
||||||
@ -95,23 +142,6 @@ def addToStudyInFather(aFather, aShape, aName):
|
|||||||
|
|
||||||
ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
|
ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# Get Operations Interfaces
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BasicOp = geom.GetIBasicOperations (myStudyId)
|
|
||||||
CurvesOp = geom.GetICurvesOperations (myStudyId)
|
|
||||||
PrimOp = geom.GetI3DPrimOperations (myStudyId)
|
|
||||||
ShapesOp = geom.GetIShapesOperations (myStudyId)
|
|
||||||
HealOp = geom.GetIHealingOperations (myStudyId)
|
|
||||||
InsertOp = geom.GetIInsertOperations (myStudyId)
|
|
||||||
BoolOp = geom.GetIBooleanOperations (myStudyId)
|
|
||||||
TrsfOp = geom.GetITransformOperations(myStudyId)
|
|
||||||
LocalOp = geom.GetILocalOperations (myStudyId)
|
|
||||||
MeasuOp = geom.GetIMeasureOperations (myStudyId)
|
|
||||||
BlocksOp = geom.GetIBlocksOperations (myStudyId)
|
|
||||||
GroupOp = geom.GetIGroupOperations (myStudyId)
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Basic primitives
|
# Basic primitives
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user