@@ -370,24 +370,36 @@ def get_revisions_step_ids(cls) -> Union[STEP_IDS, None]:
370370 return step_ids
371371
372372 @classmethod
373- def get_modified_shape_object_step_ids (cls , step_ids : STEP_IDS ) -> STEP_IDS :
373+ def get_modified_step_ids (cls , step_ids : STEP_IDS ) -> STEP_IDS :
374374 model = tool .Ifc .get ()
375- modified_shape_object_step_ids = {"modified" : [] }
375+ modified_step_ids = {"modified" : set () }
376376
377- for step_id in step_ids ["modified" ]:
378- if model .by_id (step_id ).is_a () == "IfcProductDefinitionShape" :
379- product = model .by_id (step_id ).ShapeOfProduct [0 ]
380- modified_shape_object_step_ids ["modified" ].append (product .id ())
377+ for step_id in step_ids ["modified" ] | step_ids ["added" ]:
378+ try :
379+ entity = model .by_id (step_id )
380+ except :
381+ continue
382+ if entity .is_a ("IfcProductDefinitionShape" ):
383+ for product in entity .ShapeOfProduct :
384+ modified_step_ids ["modified" ].add (product .id ())
385+ elif entity .is_a ("IfcObjectPlacement" ):
386+ for product in entity .PlacesObject :
387+ modified_step_ids ["modified" ].add (product .id ())
388+ elif entity .is_a ("IfcTypeProduct" ) and entity .Types :
389+ for related_object in entity .Types [0 ].RelatedObjects :
390+ modified_step_ids ["modified" ].add (related_object .id ())
381391
382- return modified_shape_object_step_ids
392+ return modified_step_ids
383393
384394 @classmethod
385- def update_step_ids (cls , step_ids : STEP_IDS , modified_shape_object_step_ids : STEP_IDS ) -> STEP_IDS :
395+ def update_step_ids (cls , step_ids : STEP_IDS , modified_step_ids : STEP_IDS ) -> STEP_IDS :
386396
387397 final_step_ids = {}
388398 final_step_ids ["added" ] = step_ids ["added" ]
389399 final_step_ids ["removed" ] = step_ids ["removed" ]
390- final_step_ids ["modified" ] = step_ids ["modified" ].union (modified_shape_object_step_ids ["modified" ])
400+ final_step_ids ["modified" ] = (
401+ step_ids ["modified" ].union (modified_step_ids ["modified" ]).difference (step_ids ["added" ])
402+ )
391403 return final_step_ids
392404
393405 @classmethod
0 commit comments