Users can now configure clash tolerance distance and results show the greatest distance

This commit is contained in:
Dion Moult
2020-05-17 14:40:48 +10:00
parent ca4b257188
commit 1ac37d9110
+12 -1
View File
@@ -50,7 +50,11 @@ class IfcClasher:
b = self.get_element('b', b_global_id)
if contact.raw.penetration_depth < self.tolerance:
continue
self.clashes[f'{a_global_id}-{b_global_id}'] = {
key = f'{a_global_id}-{b_global_id}'
if key in self.clashes \
and self.clashes[key]['penetration_depth'] > contact.raw.penetration_depth:
continue
self.clashes[key] = {
'a_global_id': a_global_id,
'b_global_id': b_global_id,
'a_ifc_class': a.is_a(),
@@ -177,6 +181,12 @@ if __name__ == '__main__':
type=str,
nargs='+',
help='The IFC file containing group B of objects to clash')
parser.add_argument(
'-t',
'--tolerance',
type=float,
help='The distance tolerance that clashes should exceed',
default=0.01)
parser.add_argument(
'-o',
'--output',
@@ -195,5 +205,6 @@ if __name__ == '__main__':
ifc_clasher = IfcClasher(settings)
ifc_clasher.a.extend([{'file': a, 'meshes': {}} for a in args.a])
ifc_clasher.b.extend([{'file': b, 'meshes': {}} for b in args.b])
ifc_clasher.tolerance = args.tolerance
ifc_clasher.clash()
ifc_clasher.export()