mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 03:37:21 +00:00
ifc2ca - possibility to exclude zero length springs in point connections
This commit is contained in:
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user