I would like to find the length between two points from an IFC model.This is an example of an IfcWall from the IFC model.
#26322= IFCWALL('3vpWoB_K1EZ8RCaYmNGsB2',#42,'Basiswand:Bestand 08.0:162343',$,'Basiswand:Bestand 08.0:161894',#25861,#26318,'162343',.NOTDEFINED.);
#26325= IFCPROPERTYSET('3vpWoB_K1EZ8RCcT4NGsB2',#42,'Pset_WallCommon',$,(#787,#788,#848,#25851));
#26327= IFCRELDEFINESBYPROPERTIES('0rDc6OePf5NBrNT2GfJ3hm',#42,$,$,(#26322),#26325);
#26331= IFCCARTESIANPOINT((12.5832056790716,5.54096330043285,0.));
#26333= IFCAXIS2PLACEMENT3D(#26331,#20,#18);
#26334= IFCLOCALPLACEMENT(#140,#26333);
#26335= IFCCARTESIANPOINT((4.24,0.));
#26337= IFCPOLYLINE((#10,#26335));
#26339= IFCSHAPEREPRESENTATION(#102,'Axis','Curve2D',(#26337));
The IFCPOLYLINE has two Points (#10=0,0 and #26335=4.24,0.) and i would like to find out the distance between these two points.
The other walls have a length deposited, but this one wall does not. Here is an example of the other walls:
#730= IFCWALL('1ZwJH$85D3YQG5AK5ER10a',#42,'Basiswand:Bestand 50.0:148105',$,'Basiswand:Bestand 50.0:150882',#701,#726,'148105',.NOTDEFINED.);
#745= IFCQUANTITYLENGTH('Height',$,$,4.99,$);
#746= IFCQUANTITYLENGTH('Length',$,$,16.675,$);
This is my code example:
import ifcopenshell
walls = ifc_file.by_type('IfcWall')
print(len(walls))
import math
p1 = [0.,0.]
p2 = [16.765,0.]
distance = math.sqrt( ((p1[0]-p2[0])**2)+((p1[1]-p2[1])**2) )
print(distance)
To apply the mathematical formula, I have to extract the coordinates from the wall for p1 and p2. I am not getting further here.
thank you in advance!