ifc2ca - possibility to exclude zero length springs in point connections

This commit is contained in:
Jesusbill
2021-12-17 16:27:41 +01:00
parent a1fe68a17e
commit dd6912bdaa
+15 -2
View File
@@ -23,6 +23,7 @@ from pathlib import Path
flatten = itertools.chain.from_iterable flatten = itertools.chain.from_iterable
includeZeroLength1DSprings = True
class COMMANDFILE: class COMMANDFILE:
def __init__(self, dataFilename, asterFilename): def __init__(self, dataFilename, asterFilename):
@@ -116,6 +117,7 @@ class COMMANDFILE:
if el["geometryType"] == "point" if el["geometryType"] == "point"
] ]
) )
if includeZeroLength1DSprings:
spring1DGroupNames = tuple( spring1DGroupNames = tuple(
flatten( flatten(
[ [
@@ -238,7 +240,14 @@ model = AFFE_MODELE(
),""" ),"""
context = { context = {
"groupNames": tuple(flatten([point0DGroupNames, spring1DGroupNames])) "groupNames": tuple(
flatten(
[
point0DGroupNames,
spring1DGroupNames if includeZeroLength1DSprings else [],
]
)
)
} }
f.write(template.format(**context)) f.write(template.format(**context))
@@ -466,6 +475,7 @@ element = AFFE_CARA_ELEM(
f.write(template.format(**context)) f.write(template.format(**context))
if includeZeroLength1DSprings:
for rel in conn["relatedElements"]: for rel in conn["relatedElements"]:
template = """ template = """
@@ -542,6 +552,7 @@ element = AFFE_CARA_ELEM(
f.write(template.format(**context)) f.write(template.format(**context))
if includeZeroLength1DSprings:
for rel in conn["relatedElements"]: for rel in conn["relatedElements"]:
template = """ template = """
@@ -553,7 +564,9 @@ element = AFFE_CARA_ELEM(
context = { context = {
"groupName": rel["springGroupName"], "groupName": rel["springGroupName"],
"localAxesXY": tuple(rel["orientation"][0] + rel["orientation"][1]), "localAxesXY": tuple(
rel["orientation"][0] + rel["orientation"][1]
),
} }
f.write(template.format(**context)) f.write(template.format(**context))