mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Fix reuse of representation maps. See #724
This commit is contained in:
@@ -1004,8 +1004,6 @@ class IfcExporter():
|
|||||||
information['attributes']['Publisher'] = self.owner_history.OwningUser
|
information['attributes']['Publisher'] = self.owner_history.OwningUser
|
||||||
information['ifc'] = self.file.create_entity('IfcLibraryInformation',
|
information['ifc'] = self.file.create_entity('IfcLibraryInformation',
|
||||||
**information['attributes'])
|
**information['attributes'])
|
||||||
print(information['ifc'])
|
|
||||||
print(self.ifc_parser.project['ifc'])
|
|
||||||
self.file.createIfcRelAssociatesLibrary(
|
self.file.createIfcRelAssociatesLibrary(
|
||||||
ifcopenshell.guid.new(),
|
ifcopenshell.guid.new(),
|
||||||
self.owner_history,
|
self.owner_history,
|
||||||
@@ -1414,27 +1412,31 @@ class IfcExporter():
|
|||||||
def get_product_shape_representations(self, product):
|
def get_product_shape_representations(self, product):
|
||||||
results = []
|
results = []
|
||||||
for representation_name in product['representations']:
|
for representation_name in product['representations']:
|
||||||
shape_representation = self.ifc_parser.representations[representation_name]['ifc']
|
results.append(self.get_product_mapped_geometry(product, representation_name))
|
||||||
if product['has_scale']:
|
|
||||||
results.append(self.get_product_mapped_geometry(product, shape_representation))
|
|
||||||
else:
|
|
||||||
results.append(shape_representation)
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_product_mapped_geometry(self, product, shape_representation):
|
def get_product_mapped_geometry(self, product, representation_name):
|
||||||
mapping_source = self.file.createIfcRepresentationMap(self.origin, shape_representation)
|
mapping_source = self.ifc_parser.representations[representation_name]['ifc']
|
||||||
mapping_target = self.file.createIfcCartesianTransformationOperator3DnonUniform(
|
shape_representation = mapping_source.MappedRepresentation
|
||||||
self.create_direction(product['forward_axis']),
|
if product['has_scale']:
|
||||||
self.create_direction(product['right_axis']),
|
mapping_target = self.file.createIfcCartesianTransformationOperator3DnonUniform(
|
||||||
self.create_cartesian_point(
|
self.create_direction(product['forward_axis']),
|
||||||
product['location'].x,
|
self.create_direction(product['right_axis']),
|
||||||
product['location'].y,
|
self.create_cartesian_point(
|
||||||
product['location'].z
|
product['location'].x,
|
||||||
),
|
product['location'].y,
|
||||||
product['scale'].x,
|
product['location'].z
|
||||||
self.create_direction(product['up_axis']),
|
),
|
||||||
product['scale'].y,
|
abs(product['scale'].x),
|
||||||
product['scale'].z)
|
self.create_direction(product['up_axis']),
|
||||||
|
abs(product['scale'].y),
|
||||||
|
abs(product['scale'].z))
|
||||||
|
else:
|
||||||
|
mapping_target = self.file.createIfcCartesianTransformationOperator3D(
|
||||||
|
self.create_direction(Vector((1, 0, 0))),
|
||||||
|
self.create_direction(Vector((0, 1, 0))),
|
||||||
|
self.create_cartesian_point(0, 0, 0),
|
||||||
|
1, self.create_direction(Vector((0, 0, 1))))
|
||||||
mapped_item = self.file.createIfcMappedItem(mapping_source, mapping_target)
|
mapped_item = self.file.createIfcMappedItem(mapping_source, mapping_target)
|
||||||
return self.file.createIfcShapeRepresentation(
|
return self.file.createIfcShapeRepresentation(
|
||||||
shape_representation.ContextOfItems,
|
shape_representation.ContextOfItems,
|
||||||
@@ -1479,21 +1481,27 @@ class IfcExporter():
|
|||||||
self.ifc_faces = []
|
self.ifc_faces = []
|
||||||
if representation['is_generated'] \
|
if representation['is_generated'] \
|
||||||
and representation['subcontext'] == 'Box':
|
and representation['subcontext'] == 'Box':
|
||||||
return self.create_box_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_box_representation(representation))
|
||||||
elif representation['subcontext'] == 'CoG':
|
elif representation['subcontext'] == 'CoG':
|
||||||
return self.create_cog_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_cog_representation(representation))
|
||||||
elif representation['context'] == 'Plan' \
|
elif representation['context'] == 'Plan' \
|
||||||
or representation['subcontext'] == 'Axis' \
|
or representation['subcontext'] == 'Axis' \
|
||||||
or representation['is_wireframe']:
|
or representation['is_wireframe']:
|
||||||
return self.create_wireframe_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_wireframe_representation(representation))
|
||||||
elif representation['subcontext'] == 'SurveyPoints':
|
elif representation['subcontext'] == 'SurveyPoints':
|
||||||
return self.create_geometric_curve_set_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_geometric_curve_set_representation(representation))
|
||||||
elif representation['is_curve']:
|
elif representation['is_curve']:
|
||||||
return self.create_curve_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_curve_representation(representation))
|
||||||
elif representation['is_swept_solid']:
|
elif representation['is_swept_solid']:
|
||||||
return self.create_swept_solid_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
else:
|
self.create_swept_solid_representation(representation))
|
||||||
return self.create_solid_representation(representation)
|
return self.file.createIfcRepresentationMap(self.origin,
|
||||||
|
self.create_solid_representation(representation))
|
||||||
|
|
||||||
def create_box_representation(self, representation):
|
def create_box_representation(self, representation):
|
||||||
obj = representation['raw_object']
|
obj = representation['raw_object']
|
||||||
|
|||||||
Reference in New Issue
Block a user