File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
Speckle.Importers.Ifc.Tester2
Speckle.Importers.Ifc/Converters Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 10
10
using Speckle . Sdk . Models ;
11
11
12
12
// Settings
13
- // var filePath = new FilePath(@"C:\Users\Jedd\Desktop\GRAPHISOFT_Archicad_Sample_Project-S-Office_v1.0_AC25.ifc");
14
- var filePath = new FilePath ( @"C:\Users\Jedd\Desktop\BIM_Projekt_Golden_Nugget-Architektur_und_Ingenieurbau.ifc" ) ;
13
+ var filePath = new FilePath ( @"C:\Users\Jedd\Desktop\KLY-ZHQ-B-CPL1_CPL4-0-ELV-SD-210.ifc" ) ;
14
+
15
+ // var filePath = new FilePath(@"C:\Users\Jedd\Desktop\BIM_Projekt_Golden_Nugget-Architektur_und_Ingenieurbau.ifc");
15
16
const string PROJECT_ID = "f3a42bdf24" ;
16
17
17
18
// Setup
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ public static class NodeExtensions
10
10
var result = new Dictionary < string , object ? > ( ) ;
11
11
foreach ( var p in node . GetPropSets ( ) )
12
12
{
13
- if ( p . NumProperties <= 0 )
14
- continue ;
15
-
16
13
var name = p . Name ;
17
14
if ( string . IsNullOrWhiteSpace ( name ) )
18
15
name = $ "#{ p . Id } ";
19
- result [ name ] = ToSpeckleDictionary ( p ) ;
16
+
17
+ var dict = ToSpeckleDictionary ( p ) ;
18
+ if ( dict . Count > 0 ) //Ignore any empty psets, since they can bloat the data size
19
+ result [ name ] = dict ;
20
20
}
21
21
22
22
return result ;
@@ -26,7 +26,16 @@ public static class NodeExtensions
26
26
{
27
27
var d = new Dictionary < string , object ? > ( ) ;
28
28
foreach ( var p in ps . GetProperties ( ) )
29
- d [ p . Name ] = p . Value . ToJsonObject ( ) ;
29
+ {
30
+ var value = p . Value . ToJsonObject ( ) ;
31
+
32
+ if ( value is not null )
33
+ {
34
+ // Ignoring null values since they'd otherwise bloat the data size of speckle models.
35
+ // Semantically, "null valued" and "not there" are different, but very few users care about the distinction.
36
+ d [ p . Name ] = value ;
37
+ }
38
+ }
30
39
return d ;
31
40
}
32
41
}
You can’t perform that action at this time.
0 commit comments