XBIM how to calculate boundingbox dimensions (X,Y) flowfitting

18 views Asked by At

I am trying to calculate/get the boundingbox dimensions of a flowfitting/flowterminal, but i cant get further then the dimensions of 1 off the extruded solids with form the total representation off the object. My code get's me the value 125 , this is half off the value becaouse the total dimension is 250.

dimensions i want to get

dimensions i get

For Each item As IfcRepresentationItem In representation.Representations.SelectMany(Function(r) r.Items) If TypeOf item Is IfcMappedItem Then Dim mappedItem As IfcMappedItem = DirectCast(item, IfcMappedItem)

    ' Get the mapping source representation
    Dim mappingSource As IfcRepresentationMap = mappedItem.MappingSource
    
    ' Get the mapping target transformation
    Dim mappingTarget As IfcCartesianTransformationOperator3D = mappedItem.MappingTarget
    
    ' Process the source representation items
    For Each sourceItem As IfcRepresentationItem In mappingSource.MappedRepresentation.Items
        ' Here you can measure dimensions or perform other operations on the source representation items
        ' For example, you might calculate dimensions of geometric elements
        If TypeOf sourceItem Is IfcExtrudedAreaSolid Then
            Dim extrudedSolid As IfcExtrudedAreaSolid = DirectCast(sourceItem, IfcExtrudedAreaSolid)
            ' Get dimensions from the extruded solid, e.g., depth, width, height, etc.
            Dim depth As Double = extrudedSolid.Depth
            Dim width As Double = extrudedSolid.SweptArea.SizeInX
            Dim height As Double = mappingTarget.Scale(2) ' Assuming third dimension is scaled
            Console.WriteLine($"Dimensions: Depth = {depth}, Width = {width}, Height = {height}")
        End If
        ' You can handle other types of source representation items as needed
    Next
End If

Next

0

There are 0 answers