mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
changes in ifc2ca standard case
This commit is contained in:
@@ -94,8 +94,8 @@ class CA2IFC:
|
|||||||
)
|
)
|
||||||
ifcMaterialProfileSets = [None for _ in range(len(mpSets))]
|
ifcMaterialProfileSets = [None for _ in range(len(mpSets))]
|
||||||
for i, mpSet in enumerate(mpSets):
|
for i, mpSet in enumerate(mpSets):
|
||||||
materialIndex = [mat["ifcName"] for mat in self.data["db"]["materials"]].index(mpSet.split("-")[0])
|
materialIndex = [mat["referenceName"] for mat in self.data["db"]["materials"]].index(mpSet.split("-")[0])
|
||||||
profileIndex = [prof["ifcName"] for prof in self.data["db"]["profiles"]].index(mpSet.split("-")[1])
|
profileIndex = [prof["referenceName"] for prof in self.data["db"]["profiles"]].index(mpSet.split("-")[1])
|
||||||
material = ifcMaterials[materialIndex]
|
material = ifcMaterials[materialIndex]
|
||||||
profile = ifcProfiles[profileIndex]
|
profile = ifcProfiles[profileIndex]
|
||||||
matProf = self.f.createIfcMaterialProfile(
|
matProf = self.f.createIfcMaterialProfile(
|
||||||
@@ -218,7 +218,7 @@ class CA2IFC:
|
|||||||
for i, mat in enumerate(self.data["db"]["materials"]):
|
for i, mat in enumerate(self.data["db"]["materials"]):
|
||||||
groupOfElements = []
|
groupOfElements = []
|
||||||
for j, el in enumerate(self.data["elements"]):
|
for j, el in enumerate(self.data["elements"]):
|
||||||
if el["geometryType"] == "surface" and el["material"] == mat["ifcName"]:
|
if el["geometryType"] == "surface" and el["material"] == mat["referenceName"]:
|
||||||
groupOfElements.append(ifcElements[j])
|
groupOfElements.append(ifcElements[j])
|
||||||
if groupOfElements:
|
if groupOfElements:
|
||||||
self.f.createIfcRelAssociatesMaterial(
|
self.f.createIfcRelAssociatesMaterial(
|
||||||
@@ -228,7 +228,7 @@ class CA2IFC:
|
|||||||
# create connections with elements
|
# create connections with elements
|
||||||
for i, el in enumerate(self.data["elements"]):
|
for i, el in enumerate(self.data["elements"]):
|
||||||
for conn in el["connections"]:
|
for conn in el["connections"]:
|
||||||
j = [c["ifcName"] for c in self.data["connections"]].index(conn["relatedConnection"])
|
j = [c["referenceName"] for c in self.data["connections"]].index(conn["relatedConnection"])
|
||||||
geometryType = self.data["connections"][j]["geometryType"]
|
geometryType = self.data["connections"][j]["geometryType"]
|
||||||
|
|
||||||
if conn["appliedCondition"]:
|
if conn["appliedCondition"]:
|
||||||
|
|||||||
+11
-11
@@ -46,7 +46,7 @@ class IFC2CA:
|
|||||||
id = int(mat.split("|")[1])
|
id = int(mat.split("|")[1])
|
||||||
material = self.get_material_properties(self.file.by_id(id))
|
material = self.get_material_properties(self.file.by_id(id))
|
||||||
material["relatedElements"] = [
|
material["relatedElements"] = [
|
||||||
e["ifcName"]
|
e["referenceName"]
|
||||||
for e in elements
|
for e in elements
|
||||||
if "material" in e and e["material"] == mat
|
if "material" in e and e["material"] == mat
|
||||||
]
|
]
|
||||||
@@ -60,14 +60,14 @@ class IFC2CA:
|
|||||||
id = int(prof.split("|")[1])
|
id = int(prof.split("|")[1])
|
||||||
profile = self.get_profile_properties(self.file.by_id(id))
|
profile = self.get_profile_properties(self.file.by_id(id))
|
||||||
profile["relatedElements"] = [
|
profile["relatedElements"] = [
|
||||||
e["ifcName"]
|
e["referenceName"]
|
||||||
for e in elements
|
for e in elements
|
||||||
if "profile" in e and e["profile"] == prof
|
if "profile" in e and e["profile"] == prof
|
||||||
]
|
]
|
||||||
profiledb.append(profile)
|
profiledb.append(profile)
|
||||||
|
|
||||||
self.result = {
|
self.result = {
|
||||||
"ifcName": model.is_a() + "|" + str(model.id()),
|
"referenceName": model.is_a() + "|" + str(model.id()),
|
||||||
"name": model.Name,
|
"name": model.Name,
|
||||||
"id": model.GlobalId,
|
"id": model.GlobalId,
|
||||||
"elements": elements,
|
"elements": elements,
|
||||||
@@ -157,7 +157,7 @@ class IFC2CA:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": f"{item.is_a()}|{item.id()}",
|
"referenceName": f"{item.is_a()}|{item.id()}",
|
||||||
"name": item.Name,
|
"name": item.Name,
|
||||||
"id": item.GlobalId,
|
"id": item.GlobalId,
|
||||||
"geometryType": "line",
|
"geometryType": "line",
|
||||||
@@ -200,7 +200,7 @@ class IFC2CA:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": f"{item.is_a()}|{item.id()}",
|
"referenceName": f"{item.is_a()}|{item.id()}",
|
||||||
"name": item.Name,
|
"name": item.Name,
|
||||||
"id": item.GlobalId,
|
"id": item.GlobalId,
|
||||||
"geometryType": "surface",
|
"geometryType": "surface",
|
||||||
@@ -231,7 +231,7 @@ class IFC2CA:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": f"{item.is_a()}|{item.id()}",
|
"referenceName": f"{item.is_a()}|{item.id()}",
|
||||||
"name": item.Name,
|
"name": item.Name,
|
||||||
"id": item.GlobalId,
|
"id": item.GlobalId,
|
||||||
"geometryType": "point",
|
"geometryType": "point",
|
||||||
@@ -262,7 +262,7 @@ class IFC2CA:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": f"{item.is_a()}|{item.id()}",
|
"referenceName": f"{item.is_a()}|{item.id()}",
|
||||||
"name": item.Name,
|
"name": item.Name,
|
||||||
"id": item.GlobalId,
|
"id": item.GlobalId,
|
||||||
"geometryType": "line",
|
"geometryType": "line",
|
||||||
@@ -460,7 +460,7 @@ class IFC2CA:
|
|||||||
commonProps = self.get_pset_properties(psets, None)
|
commonProps = self.get_pset_properties(psets, None)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": material.is_a() + "|" + str(material.id()),
|
"referenceName": material.is_a() + "|" + str(material.id()),
|
||||||
"name": material.Name,
|
"name": material.Name,
|
||||||
"category": material.Category,
|
"category": material.Category,
|
||||||
"mechProps": mechProps,
|
"mechProps": mechProps,
|
||||||
@@ -486,7 +486,7 @@ class IFC2CA:
|
|||||||
def get_profile_properties(self, profile):
|
def get_profile_properties(self, profile):
|
||||||
if profile.is_a("IfcRectangleProfileDef"):
|
if profile.is_a("IfcRectangleProfileDef"):
|
||||||
return {
|
return {
|
||||||
"ifcName": profile.is_a() + "|" + str(profile.id()),
|
"referenceName": profile.is_a() + "|" + str(profile.id()),
|
||||||
"profileName": profile.ProfileName,
|
"profileName": profile.ProfileName,
|
||||||
"profileType": profile.ProfileType,
|
"profileType": profile.ProfileType,
|
||||||
"profileShape": "rectangular",
|
"profileShape": "rectangular",
|
||||||
@@ -503,7 +503,7 @@ class IFC2CA:
|
|||||||
mechProps = self.get_i_section_properties(profile, "iSymmetrical")
|
mechProps = self.get_i_section_properties(profile, "iSymmetrical")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ifcName": f"{profile.is_a()}|{profile.id()}",
|
"referenceName": f"{profile.is_a()}|{profile.id()}",
|
||||||
"profileName": profile.ProfileName,
|
"profileName": profile.ProfileName,
|
||||||
"profileType": profile.ProfileType,
|
"profileType": profile.ProfileType,
|
||||||
"profileShape": "iSymmetrical",
|
"profileShape": "iSymmetrical",
|
||||||
@@ -520,7 +520,7 @@ class IFC2CA:
|
|||||||
def get_connection_data(self, itemList):
|
def get_connection_data(self, itemList):
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"ifcName": f"{rel.is_a()}|{rel.id()}",
|
"referenceName": f"{rel.is_a()}|{rel.id()}",
|
||||||
"id": rel.GlobalId,
|
"id": rel.GlobalId,
|
||||||
"relatingElement": f"{rel.RelatingStructuralMember.is_a()}|{rel.RelatingStructuralMember.id()}",
|
"relatingElement": f"{rel.RelatingStructuralMember.is_a()}|{rel.RelatingStructuralMember.id()}",
|
||||||
"relatedConnection": f"{rel.RelatedStructuralConnection.is_a()}|{rel.RelatedStructuralConnection.id()}",
|
"relatedConnection": f"{rel.RelatedStructuralConnection.is_a()}|{rel.RelatedStructuralConnection.id()}",
|
||||||
|
|||||||
@@ -32,9 +32,12 @@ class COMMANDFILE:
|
|||||||
self.create()
|
self.create()
|
||||||
|
|
||||||
def getGroupName(self, name):
|
def getGroupName(self, name):
|
||||||
info = name.split("|")
|
if "|" in name:
|
||||||
sortName = "".join(c for c in info[0] if c.isupper())
|
info = name.split("|")
|
||||||
return f"{sortName[2:]}_{info[1]}"
|
sortName = "".join(c for c in info[0] if c.isupper())
|
||||||
|
return f"{sortName[2:]}_{info[1]}"
|
||||||
|
else:
|
||||||
|
return name
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
|
|
||||||
@@ -54,7 +57,7 @@ class COMMANDFILE:
|
|||||||
for el in elements:
|
for el in elements:
|
||||||
for rel in el["connections"]:
|
for rel in el["connections"]:
|
||||||
conn = [
|
conn = [
|
||||||
c for c in connections if c["ifcName"] == rel["relatedConnection"]
|
c for c in connections if c["referenceName"] == rel["relatedConnection"]
|
||||||
][0]
|
][0]
|
||||||
rel["conn_string"] = None
|
rel["conn_string"] = None
|
||||||
if conn["geometryType"] == "point":
|
if conn["geometryType"] == "point":
|
||||||
@@ -98,21 +101,21 @@ class COMMANDFILE:
|
|||||||
|
|
||||||
edgeGroupNames = tuple(
|
edgeGroupNames = tuple(
|
||||||
[
|
[
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
for el in elements
|
for el in elements
|
||||||
if el["geometryType"] == "line"
|
if el["geometryType"] == "line"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
faceGroupNames = tuple(
|
faceGroupNames = tuple(
|
||||||
[
|
[
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
for el in elements
|
for el in elements
|
||||||
if el["geometryType"] == "surface"
|
if el["geometryType"] == "surface"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
point0DGroupNames = tuple(
|
point0DGroupNames = tuple(
|
||||||
[
|
[
|
||||||
self.getGroupName(el["ifcName"]) + "_0D"
|
self.getGroupName(el["referenceName"]) + "_0D"
|
||||||
for el in connections
|
for el in connections
|
||||||
if el["geometryType"] == "point"
|
if el["geometryType"] == "point"
|
||||||
]
|
]
|
||||||
@@ -132,7 +135,7 @@ class COMMANDFILE:
|
|||||||
)
|
)
|
||||||
point1DGroupNames = tuple(
|
point1DGroupNames = tuple(
|
||||||
[
|
[
|
||||||
self.getGroupName(el["ifcName"]) + "_0D"
|
self.getGroupName(el["referenceName"]) + "_0D"
|
||||||
for el in connections
|
for el in connections
|
||||||
if el["geometryType"] == "line"
|
if el["geometryType"] == "line"
|
||||||
]
|
]
|
||||||
@@ -153,14 +156,14 @@ class COMMANDFILE:
|
|||||||
# 'dz': True
|
# 'dz': True
|
||||||
# }
|
# }
|
||||||
if len(conn["unifiedGroupNames"]) >= 1:
|
if len(conn["unifiedGroupNames"]) >= 1:
|
||||||
conn["unifiedGroupNames"].insert(0, self.getGroupName(conn["ifcName"]))
|
conn["unifiedGroupNames"].insert(0, self.getGroupName(conn["referenceName"]))
|
||||||
conn["unifiedGroupNames"] = tuple(conn["unifiedGroupNames"])
|
conn["unifiedGroupNames"] = tuple(conn["unifiedGroupNames"])
|
||||||
unifiedConnection = True
|
unifiedConnection = True
|
||||||
rigidLinkGroupNames.extend(
|
rigidLinkGroupNames.extend(
|
||||||
[
|
[
|
||||||
self.getGroupName(rel["relatingElement"])
|
self.getGroupName(rel["relatingElement"])
|
||||||
+ "_1DR_"
|
+ "_1DR_"
|
||||||
+ self.getGroupName(conn["ifcName"])
|
+ self.getGroupName(conn["referenceName"])
|
||||||
for rel in conn["relatedElements"]
|
for rel in conn["relatedElements"]
|
||||||
if rel["eccentricity"]
|
if rel["eccentricity"]
|
||||||
]
|
]
|
||||||
@@ -442,7 +445,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(el["ifcName"]),
|
"groupName": self.getGroupName(el["referenceName"]),
|
||||||
"thickness": el["thickness"],
|
"thickness": el["thickness"],
|
||||||
"localAxisX": tuple(el["orientation"][0]),
|
"localAxisX": tuple(el["orientation"][0]),
|
||||||
}
|
}
|
||||||
@@ -469,7 +472,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(conn["ifcName"]) + "_0D",
|
"groupName": self.getGroupName(conn["referenceName"]) + "_0D",
|
||||||
"stiffnesses": conn["stiffnesses"],
|
"stiffnesses": conn["stiffnesses"],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +507,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(conn["ifcName"]) + "_0D",
|
"groupName": self.getGroupName(conn["referenceName"]) + "_0D",
|
||||||
"stiffnesses": conn["stiffnesses"],
|
"stiffnesses": conn["stiffnesses"],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +533,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(el["ifcName"]),
|
"groupName": self.getGroupName(el["referenceName"]),
|
||||||
"localAxisY": tuple(el["orientation"][1]),
|
"localAxisY": tuple(el["orientation"][1]),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +549,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(conn["ifcName"]) + "_0D",
|
"groupName": self.getGroupName(conn["referenceName"]) + "_0D",
|
||||||
"localAxesXY": tuple(conn["orientation"][0] + conn["orientation"][1]),
|
"localAxesXY": tuple(conn["orientation"][0] + conn["orientation"][1]),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,7 +584,7 @@ element = AFFE_CARA_ELEM(
|
|||||||
),"""
|
),"""
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"groupName": self.getGroupName(conn["ifcName"]) + "_0D",
|
"groupName": self.getGroupName(conn["referenceName"]) + "_0D",
|
||||||
"localAxesXY": tuple(conn["orientation"][0] + conn["orientation"][1]),
|
"localAxesXY": tuple(conn["orientation"][0] + conn["orientation"][1]),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -999,7 +1002,7 @@ FIN()
|
|||||||
rel["stiffnesses"] = tuple(stiffnesses)
|
rel["stiffnesses"] = tuple(stiffnesses)
|
||||||
|
|
||||||
def calculateRestraints(self, conn):
|
def calculateRestraints(self, conn):
|
||||||
group = self.getGroupName(conn["ifcName"])
|
group = self.getGroupName(conn["referenceName"])
|
||||||
o = np.array(conn["orientation"]).transpose().tolist()
|
o = np.array(conn["orientation"]).transpose().tolist()
|
||||||
liaisons = {"groupNames": (group, group, group), "coeffs": [], "dofs": []}
|
liaisons = {"groupNames": (group, group, group), "coeffs": [], "dofs": []}
|
||||||
stiffnesses = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
stiffnesses = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||||
|
|||||||
+40
-37
@@ -42,9 +42,12 @@ class MODEL:
|
|||||||
self.create()
|
self.create()
|
||||||
|
|
||||||
def getGroupName(self, name):
|
def getGroupName(self, name):
|
||||||
info = name.split("|")
|
if "|" in name:
|
||||||
sortName = "".join(c for c in info[0] if c.isupper())
|
info = name.split("|")
|
||||||
return f"{sortName[2:]}_{info[1]}"
|
sortName = "".join(c for c in info[0] if c.isupper())
|
||||||
|
return f"{sortName[2:]}_{info[1]}"
|
||||||
|
else:
|
||||||
|
return name
|
||||||
|
|
||||||
def makePoint(self, pl):
|
def makePoint(self, pl):
|
||||||
"""Function to define a Point from
|
"""Function to define a Point from
|
||||||
@@ -179,7 +182,7 @@ class MODEL:
|
|||||||
el["linkPointObjs"] = [[None, None] for _ in el["connections"]]
|
el["linkPointObjs"] = [[None, None] for _ in el["connections"]]
|
||||||
for j, rel in enumerate(el["connections"]):
|
for j, rel in enumerate(el["connections"]):
|
||||||
conn = [
|
conn = [
|
||||||
c for c in connections if c["ifcName"] == rel["relatedConnection"]
|
c for c in connections if c["referenceName"] == rel["relatedConnection"]
|
||||||
][0]
|
][0]
|
||||||
if rel["eccentricity"]:
|
if rel["eccentricity"]:
|
||||||
rel["index"] = len(conn["relatedElements"]) + 1
|
rel["index"] = len(conn["relatedElements"]) + 1
|
||||||
@@ -237,13 +240,13 @@ class MODEL:
|
|||||||
|
|
||||||
# Loop 2
|
# Loop 2
|
||||||
for el in elements:
|
for el in elements:
|
||||||
# geompy.addToStudy(el['partObj'], self.getGroupName(el['ifcName']))
|
# geompy.addToStudy(el['partObj'], self.getGroupName(el['referenceName']))
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
el["partObj"], el["elemObj"], self.getGroupName(el["ifcName"])
|
el["partObj"], el["elemObj"], self.getGroupName(el["referenceName"])
|
||||||
)
|
)
|
||||||
for j, rel in enumerate(el["connections"]):
|
for j, rel in enumerate(el["connections"]):
|
||||||
conn = [
|
conn = [
|
||||||
c for c in connections if c["ifcName"] == rel["relatedConnection"]
|
c for c in connections if c["referenceName"] == rel["relatedConnection"]
|
||||||
][0]
|
][0]
|
||||||
rel["conn_string"] = None
|
rel["conn_string"] = None
|
||||||
if conn["geometryType"] == "point":
|
if conn["geometryType"] == "point":
|
||||||
@@ -255,20 +258,20 @@ class MODEL:
|
|||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
el["partObj"],
|
el["partObj"],
|
||||||
el["connObjs"][j],
|
el["connObjs"][j],
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ rel["conn_string"]
|
+ rel["conn_string"]
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
if rel["eccentricity"]:
|
if rel["eccentricity"]:
|
||||||
pass
|
pass
|
||||||
# geompy.addToStudy(el['linkObjs'][j], self.getGroupName(el['ifcName']) + '_1DR_' + self.getGroupName(rel['relatedConnection']))
|
# geompy.addToStudy(el['linkObjs'][j], self.getGroupName(el['referenceName']) + '_1DR_' + self.getGroupName(rel['relatedConnection']))
|
||||||
# geompy.addToStudyInFather(el['linkObjs'][j], el['linkPointObjs'][j][0], self.getGroupName(rel['relatedConnection']) + '_0DC_' + self.getGroupName(el['ifcName']))
|
# geompy.addToStudyInFather(el['linkObjs'][j], el['linkPointObjs'][j][0], self.getGroupName(rel['relatedConnection']) + '_0DC_' + self.getGroupName(el['referenceName']))
|
||||||
# geompy.addToStudyInFather(el['linkObjs'][j], el['linkPointObjs'][j][0], self.getGroupName(rel['relatedConnection']) + '_0DC_%g' % rel['index'])
|
# geompy.addToStudyInFather(el['linkObjs'][j], el['linkPointObjs'][j][0], self.getGroupName(rel['relatedConnection']) + '_0DC_%g' % rel['index'])
|
||||||
|
|
||||||
for conn in connections:
|
for conn in connections:
|
||||||
# geompy.addToStudy(conn['connObj'], self.getGroupName(conn['ifcName']))
|
# geompy.addToStudy(conn['connObj'], self.getGroupName(conn['referenceName']))
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
conn["connObj"], conn["connObj"], self.getGroupName(conn["ifcName"])
|
conn["connObj"], conn["connObj"], self.getGroupName(conn["referenceName"])
|
||||||
)
|
)
|
||||||
|
|
||||||
elapsed_time = time.time() - init_time
|
elapsed_time = time.time() - init_time
|
||||||
@@ -298,14 +301,14 @@ class MODEL:
|
|||||||
for el in elements:
|
for el in elements:
|
||||||
# el['partObj'] = geompy.RestoreGivenSubShapes(bldComp, [el['partObj']], GEOM.FSM_GetInPlace, False, False)[0]
|
# el['partObj'] = geompy.RestoreGivenSubShapes(bldComp, [el['partObj']], GEOM.FSM_GetInPlace, False, False)[0]
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
bldComp, el["elemObj"], self.getGroupName(el["ifcName"])
|
bldComp, el["elemObj"], self.getGroupName(el["referenceName"])
|
||||||
)
|
)
|
||||||
|
|
||||||
for j, rel in enumerate(el["connections"]):
|
for j, rel in enumerate(el["connections"]):
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
bldComp,
|
bldComp,
|
||||||
el["connObjs"][j],
|
el["connObjs"][j],
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ rel["conn_string"]
|
+ rel["conn_string"]
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
@@ -313,7 +316,7 @@ class MODEL:
|
|||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
bldComp,
|
bldComp,
|
||||||
el["linkObjs"][j],
|
el["linkObjs"][j],
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ "_1DR_"
|
+ "_1DR_"
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
@@ -322,7 +325,7 @@ class MODEL:
|
|||||||
el["linkPointObjs"][j][0],
|
el["linkPointObjs"][j][0],
|
||||||
self.getGroupName(rel["relatedConnection"])
|
self.getGroupName(rel["relatedConnection"])
|
||||||
+ "_0DC_"
|
+ "_0DC_"
|
||||||
+ self.getGroupName(el["ifcName"]),
|
+ self.getGroupName(el["referenceName"]),
|
||||||
)
|
)
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
bldComp,
|
bldComp,
|
||||||
@@ -334,7 +337,7 @@ class MODEL:
|
|||||||
for conn in connections:
|
for conn in connections:
|
||||||
# conn['connObj'] = geompy.RestoreGivenSubShapes(bldComp, [conn['connObj']], GEOM.FSM_GetInPlace, False, False)[0]
|
# conn['connObj'] = geompy.RestoreGivenSubShapes(bldComp, [conn['connObj']], GEOM.FSM_GetInPlace, False, False)[0]
|
||||||
geompy.addToStudyInFather(
|
geompy.addToStudyInFather(
|
||||||
bldComp, conn["connObj"], self.getGroupName(conn["ifcName"])
|
bldComp, conn["connObj"], self.getGroupName(conn["referenceName"])
|
||||||
)
|
)
|
||||||
|
|
||||||
elapsed_time = time.time() - init_time
|
elapsed_time = time.time() - init_time
|
||||||
@@ -402,21 +405,21 @@ class MODEL:
|
|||||||
if el["geometryType"] == "surface":
|
if el["geometryType"] == "surface":
|
||||||
shapeType = SMESH.FACE
|
shapeType = SMESH.FACE
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
el["elemObj"], self.getGroupName(el["ifcName"]), shapeType
|
el["elemObj"], self.getGroupName(el["referenceName"]), shapeType
|
||||||
)
|
)
|
||||||
smesh.SetName(tempgroup, self.getGroupName(el["ifcName"]))
|
smesh.SetName(tempgroup, self.getGroupName(el["referenceName"]))
|
||||||
|
|
||||||
for j, rel in enumerate(el["connections"]):
|
for j, rel in enumerate(el["connections"]):
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
el["connObjs"][j],
|
el["connObjs"][j],
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ rel["conn_string"]
|
+ rel["conn_string"]
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
SMESH.NODE,
|
SMESH.NODE,
|
||||||
)
|
)
|
||||||
smesh.SetName(
|
smesh.SetName(
|
||||||
tempgroup,
|
tempgroup,
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ rel["conn_string"]
|
+ rel["conn_string"]
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
@@ -426,14 +429,14 @@ class MODEL:
|
|||||||
if rel["eccentricity"]:
|
if rel["eccentricity"]:
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
el["linkObjs"][j],
|
el["linkObjs"][j],
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ "_1DR_"
|
+ "_1DR_"
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
SMESH.EDGE,
|
SMESH.EDGE,
|
||||||
)
|
)
|
||||||
smesh.SetName(
|
smesh.SetName(
|
||||||
tempgroup,
|
tempgroup,
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ "_1DR_"
|
+ "_1DR_"
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
@@ -442,14 +445,14 @@ class MODEL:
|
|||||||
el["linkPointObjs"][j][0],
|
el["linkPointObjs"][j][0],
|
||||||
self.getGroupName(rel["relatedConnection"])
|
self.getGroupName(rel["relatedConnection"])
|
||||||
+ "_0DC_"
|
+ "_0DC_"
|
||||||
+ self.getGroupName(el["ifcName"]),
|
+ self.getGroupName(el["referenceName"]),
|
||||||
SMESH.NODE,
|
SMESH.NODE,
|
||||||
)
|
)
|
||||||
smesh.SetName(
|
smesh.SetName(
|
||||||
tempgroup,
|
tempgroup,
|
||||||
self.getGroupName(rel["relatedConnection"])
|
self.getGroupName(rel["relatedConnection"])
|
||||||
+ "_0DC_"
|
+ "_0DC_"
|
||||||
+ self.getGroupName(el["ifcName"]),
|
+ self.getGroupName(el["referenceName"]),
|
||||||
)
|
)
|
||||||
rel["eccNode"] = (
|
rel["eccNode"] = (
|
||||||
bldMesh.GetIDSource(tempgroup.GetNodeIDs(), SMESH.NODE)
|
bldMesh.GetIDSource(tempgroup.GetNodeIDs(), SMESH.NODE)
|
||||||
@@ -470,43 +473,43 @@ class MODEL:
|
|||||||
|
|
||||||
for conn in connections:
|
for conn in connections:
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
conn["connObj"], self.getGroupName(conn["ifcName"]), SMESH.NODE
|
conn["connObj"], self.getGroupName(conn["referenceName"]), SMESH.NODE
|
||||||
)
|
)
|
||||||
smesh.SetName(tempgroup, self.getGroupName(conn["ifcName"]))
|
smesh.SetName(tempgroup, self.getGroupName(conn["referenceName"]))
|
||||||
nodesId = bldMesh.GetIDSource(tempgroup.GetNodeIDs(), SMESH.NODE)
|
nodesId = bldMesh.GetIDSource(tempgroup.GetNodeIDs(), SMESH.NODE)
|
||||||
tempgroup = bldMesh.Add0DElementsToAllNodes(
|
tempgroup = bldMesh.Add0DElementsToAllNodes(
|
||||||
nodesId, self.getGroupName(conn["ifcName"])
|
nodesId, self.getGroupName(conn["referenceName"])
|
||||||
)
|
)
|
||||||
smesh.SetName(tempgroup, self.getGroupName(conn["ifcName"] + "_0D"))
|
smesh.SetName(tempgroup, self.getGroupName(conn["referenceName"] + "_0D"))
|
||||||
if conn["geometryType"] == "point":
|
if conn["geometryType"] == "point":
|
||||||
conn["node"] = nodesId.GetIDs()[0]
|
conn["node"] = nodesId.GetIDs()[0]
|
||||||
if conn["geometryType"] == "line":
|
if conn["geometryType"] == "line":
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
conn["connObj"], self.getGroupName(conn["ifcName"]), SMESH.EDGE
|
conn["connObj"], self.getGroupName(conn["referenceName"]), SMESH.EDGE
|
||||||
)
|
)
|
||||||
smesh.SetName(tempgroup, self.getGroupName(conn["ifcName"]))
|
smesh.SetName(tempgroup, self.getGroupName(conn["referenceName"]))
|
||||||
if conn["geometryType"] == "surface":
|
if conn["geometryType"] == "surface":
|
||||||
tempgroup = bldMesh.GroupOnGeom(
|
tempgroup = bldMesh.GroupOnGeom(
|
||||||
conn["connObj"], self.getGroupName(conn["ifcName"]), SMESH.FACE
|
conn["connObj"], self.getGroupName(conn["referenceName"]), SMESH.FACE
|
||||||
)
|
)
|
||||||
smesh.SetName(tempgroup, self.getGroupName(conn["ifcName"]))
|
smesh.SetName(tempgroup, self.getGroupName(conn["referenceName"]))
|
||||||
|
|
||||||
# create 1D SEG2 spring elements
|
# create 1D SEG2 spring elements
|
||||||
for el in elements:
|
for el in elements:
|
||||||
for j, rel in enumerate(el["connections"]):
|
for j, rel in enumerate(el["connections"]):
|
||||||
conn = [
|
conn = [
|
||||||
c for c in connections if c["ifcName"] == rel["relatedConnection"]
|
c for c in connections if c["referenceName"] == rel["relatedConnection"]
|
||||||
][0]
|
][0]
|
||||||
if conn["geometryType"] == "point":
|
if conn["geometryType"] == "point":
|
||||||
grpName = bldMesh.CreateEmptyGroup(
|
grpName = bldMesh.CreateEmptyGroup(
|
||||||
SMESH.EDGE,
|
SMESH.EDGE,
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ "_1DS_"
|
+ "_1DS_"
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
smesh.SetName(
|
smesh.SetName(
|
||||||
grpName,
|
grpName,
|
||||||
self.getGroupName(el["ifcName"])
|
self.getGroupName(el["referenceName"])
|
||||||
+ "_1DS_"
|
+ "_1DS_"
|
||||||
+ self.getGroupName(rel["relatedConnection"]),
|
+ self.getGroupName(rel["relatedConnection"]),
|
||||||
)
|
)
|
||||||
@@ -514,7 +517,7 @@ class MODEL:
|
|||||||
conn = [
|
conn = [
|
||||||
conn
|
conn
|
||||||
for conn in connections
|
for conn in connections
|
||||||
if conn["ifcName"] == rel["relatedConnection"]
|
if conn["referenceName"] == rel["relatedConnection"]
|
||||||
][0]
|
][0]
|
||||||
grpName.Add([bldMesh.AddEdge([conn["node"], rel["node"]])])
|
grpName.Add([bldMesh.AddEdge([conn["node"], rel["node"]])])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user