-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry.php
65 lines (51 loc) · 1.97 KB
/
entry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
spl_autoload_register(function ($className) {
$filename = "./classes/{$className}.php";
if (is_readable($filename)) {
require $filename;
}
});
$filename = 'pontsteiger_afbouw_laagbouw-adapted.ifc';
$doors = [];
if ($file = fopen($filename, "r")) {
while (!feof($file)) {
$line = fgets($file);
// Case IFCDOOR
if (str_contains($line, '=IFCDOOR(')) {
$matches = [];
preg_match('/(#\d*).*?\((.*?)\);/', $line, $matches);
$doors[$matches[1]] = $door = IfcDoor::fromIfcData($matches[2]);
IfcRoot::registerIfcLine($matches[1], $door);
}
// Case IFCRELDEFINESBYPROPERTIES
if (str_contains($line, '=IFCRELDEFINESBYPROPERTIES(')) {
$matches = [];
preg_match('/(#\d*).*?\((.*?)\);/', $line, $matches);
$rel = IfcRelDefinesByProperties::fromIfcData($matches[2]);
IfcRoot::registerIfcLine($matches[1], $rel);
}
if (str_contains($line, 'IFCPROPERTYSET')) {
$propSet = IfcPropertySet::fromIfcData($line);
}
// #6=IFCPROPERTYSINGLEVALUE('IsExternal',$,IFCBOOLEAN(.F.),$);
if (str_contains($line, 'IFCPROPERTYSINGLEVALUE')) {
$matches = [];
preg_match('/(#\d*).*?\((.*?)\);/', $line, $matches);
$prop = IfcPropertySingleValue::fromIfcData($matches[2]);
IfcPropertyAbstraction::registerIfcLine($matches[1], $prop);
}
}
fclose($file);
}
IfcRoot::initAllIfcs();
// print count($doors) . " deuren \n";
// $subset = array_slice($doors, 0, 10, true);
$hsldEntrees = array_filter($doors, function (IfcDoor $door) {
return $door->objectType === 'HSLD_woningentree';
});
array_walk($hsldEntrees, fn (IfcDoor $door) => print_r($door->getData()));
// $subset = array_slice($relDefs, 0, 10, true);
// print_r($subset);
// print implode(",", array_map(function(IfcDoor $door) {
// return $door->lineId;
// }, $hsldEntrees));