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
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
// The contents of this file are automatically generated and should not be modified directly.  See the `build` directory.

use ::{
    CodePair,
    Color,
    DataTableValue,
    DxfError,
    DxfResult,
    ExtensionGroup,
    GeoMeshPoint,
    MLineStyleElement,
    Point,
    SectionTypeSettings,
    TableCellStyle,
    TransformationMatrix,
    Vector,
    XData,
};
use ::code_pair_writer::CodePairWriter;
use ::extension_data;
use ::helper_functions::*;
use ::x_data;

use enums::*;
use enum_primitive::FromPrimitive;
use itertools::PutBack;
use std::collections::HashMap;
use std::io::Write;

extern crate chrono;
use self::chrono::{DateTime, Local};

#[derive(Clone)]
pub struct ObjectCommon {
    pub handle: u32,
    pub extension_data_groups: Vec<ExtensionGroup>,
    pub x_data: Vec<XData>,
    pub owner_handle: u32,
}

#[derive(Clone)]
pub struct Object {
    pub common: ObjectCommon,
    pub specific: ObjectType,
}

impl Default for ObjectCommon {
    fn default() -> ObjectCommon {
        ObjectCommon {
            handle: 0,
            extension_data_groups: vec![],
            x_data: vec![],
            owner_handle: 0,
        }
    }
}

impl ObjectCommon {
    #[doc(hidden)]
    pub fn apply_individual_pair<I>(&mut self, pair: &CodePair, iter: &mut PutBack<I>) -> DxfResult<bool>
        where I: Iterator<Item = DxfResult<CodePair>> {

        match pair.code {
            5 => { self.handle = try!(as_u32(try!(pair.value.assert_string()))) },
            extension_data::EXTENSION_DATA_GROUP => {
                let group = try!(ExtensionGroup::read_group(try!(pair.value.assert_string()), iter));
                self.extension_data_groups.push(group);
            },
            330 => { self.owner_handle = try!(as_u32(try!(pair.value.assert_string()))) },
            x_data::XDATA_APPLICATIONNAME => {
                let x = try!(XData::read_item(try!(pair.value.assert_string()), iter));
                self.x_data.push(x);
            },
            _ => return Ok(false), // unknown code
        }
        Ok(true)
    }
    #[doc(hidden)]
    pub fn write<T>(&self, version: &AcadVersion, writer: &mut CodePairWriter<T>) -> DxfResult<()>
        where T: Write {

        let obj = self;
        try!(writer.write_code_pair(&CodePair::new_string(5, &as_handle(obj.handle))));
        if *version >= AcadVersion::R14 {
            for group in &self.extension_data_groups {
                try!(group.write(writer));
            }
        }
        try!(writer.write_code_pair(&CodePair::new_string(330, &as_handle(obj.owner_handle))));
        Ok(())
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum ObjectType {
    AcadProxyObject(AcadProxyObject),
    DictionaryWithDefault(DictionaryWithDefault),
    PlaceHolder(PlaceHolder),
    DataTable(DataTable),
    Dictionary(Dictionary),
    DictionaryVariable(DictionaryVariable),
    DimensionAssoc(DimensionAssoc),
    Field(Field),
    GeoData(GeoData),
    Group(Group),
    IdBuffer(IdBuffer),
    ImageDefinition(ImageDefinition),
    ImageDefinitionReactor(ImageDefinitionReactor),
    LayerFilter(LayerFilter),
    LayerIndex(LayerIndex),
    Layout(Layout),
    LightList(LightList),
    Material(Material),
    MLeaderStyle(MLeaderStyle),
    MLineStyle(MLineStyle),
    ObjectPointer(ObjectPointer),
    PlotSettings(PlotSettings),
    RasterVariables(RasterVariables),
    MentalRayRenderSettings(MentalRayRenderSettings),
    RenderEnvironment(RenderEnvironment),
    RenderGlobal(RenderGlobal),
    SectionManager(SectionManager),
    SectionSettings(SectionSettings),
    SortentsTable(SortentsTable),
    SpatialFilter(SpatialFilter),
    SpatialIndex(SpatialIndex),
    SunStudy(SunStudy),
    TableStyle(TableStyle),
    UnderlayDefinition(UnderlayDefinition),
    VbaProject(VbaProject),
    VisualStyle(VisualStyle),
    WipeoutVariables(WipeoutVariables),
    XRecordObject(XRecordObject),
}

#[derive(Clone, Debug, PartialEq)]
pub struct AcadProxyObject {
    pub proxy_object_class_id: i32,
    pub application_object_class_id: i32,
    pub size_in_bits: i32,
    pub binary_object_data: Vec<String>,
    pub object_ids: Vec<String>,
    #[doc(hidden)]
    pub _object_ids_a: Vec<String>,
    #[doc(hidden)]
    pub _object_ids_b: Vec<String>,
    #[doc(hidden)]
    pub _object_ids_c: Vec<String>,
    #[doc(hidden)]
    pub _object_ids_d: Vec<String>,
    _object_drawing_format: u32,
    pub is_original_object_format: bool,
}

impl Default for AcadProxyObject {
    fn default() -> AcadProxyObject {
        AcadProxyObject {
            proxy_object_class_id: 499,
            application_object_class_id: 500,
            size_in_bits: 0,
            binary_object_data: vec![],
            object_ids: vec![],
            _object_ids_a: vec![],
            _object_ids_b: vec![],
            _object_ids_c: vec![],
            _object_ids_d: vec![],
            _object_drawing_format: 0,
            is_original_object_format: false,
        }
    }
}

impl AcadProxyObject {
}

#[derive(Clone, Debug, PartialEq)]
pub struct DictionaryWithDefault {
    pub duplicate_record_handling: DictionaryDuplicateRecordHandling,
    pub default_handle: u32,
    pub value_handles: HashMap<String, u32>,
}

impl Default for DictionaryWithDefault {
    fn default() -> DictionaryWithDefault {
        DictionaryWithDefault {
            duplicate_record_handling: DictionaryDuplicateRecordHandling::NotApplicable,
            default_handle: 0,
            value_handles: HashMap::new(),
        }
    }
}

impl DictionaryWithDefault {
}

#[derive(Clone, Debug, PartialEq)]
pub struct PlaceHolder {
}

impl Default for PlaceHolder {
    fn default() -> PlaceHolder {
        PlaceHolder {
        }
    }
}

impl PlaceHolder {
}

#[derive(Clone, Debug, PartialEq)]
pub struct DataTable {
    pub field: i16,
    pub column_count: usize,
    pub row_count: usize,
    pub name: String,
    pub column_names: Vec<String>,
    pub values: Vec<Vec<Option<DataTableValue>>>,
}

impl Default for DataTable {
    fn default() -> DataTable {
        DataTable {
            field: 0,
            column_count: 0,
            row_count: 0,
            name: String::new(),
            column_names: vec![],
            values: vec![],
        }
    }
}

impl DataTable {
}

#[derive(Clone, Debug, PartialEq)]
pub struct Dictionary {
    pub is_hard_owner: bool,
    pub duplicate_record_handling: DictionaryDuplicateRecordHandling,
    pub value_handles: HashMap<String, u32>,
}

impl Default for Dictionary {
    fn default() -> Dictionary {
        Dictionary {
            is_hard_owner: false,
            duplicate_record_handling: DictionaryDuplicateRecordHandling::NotApplicable,
            value_handles: HashMap::new(),
        }
    }
}

impl Dictionary {
}

#[derive(Clone, Debug, PartialEq)]
pub struct DictionaryVariable {
    pub object_schema_number: i16,
    pub value: String,
}

impl Default for DictionaryVariable {
    fn default() -> DictionaryVariable {
        DictionaryVariable {
            object_schema_number: 0,
            value: String::new(),
        }
    }
}

impl DictionaryVariable {
}

#[derive(Clone, Debug, PartialEq)]
pub struct DimensionAssoc {
    pub dimension: u32,
    pub associativity_flags: i32,
    pub is_trans_space: bool,
    pub rotated_dimension_type: RotatedDimensionType,
    pub class_name: String,
    pub object_osnap_type: ObjectOsnapType,
    pub main_object: u32,
    pub main_object_subentity_type: SubentityType,
    pub main_object_gs_marker_index: i32,
    pub main_object_xref_handle: String,
    pub near_osnap_geometry_parameter: f64,
    pub osnap_point: Point,
    pub intersection_object: u32,
    pub intersection_subentity_type: SubentityType,
    pub intersection_object_gs_marker_index: i32,
    pub intersection_object_xref_handle: String,
    pub has_last_point_reference: bool,
}

impl Default for DimensionAssoc {
    fn default() -> DimensionAssoc {
        DimensionAssoc {
            dimension: 0,
            associativity_flags: 0,
            is_trans_space: true,
            rotated_dimension_type: RotatedDimensionType::Parallel,
            class_name: String::from("AcDbOsnapPointRef"),
            object_osnap_type: ObjectOsnapType::None,
            main_object: 0,
            main_object_subentity_type: SubentityType::Edge,
            main_object_gs_marker_index: 0,
            main_object_xref_handle: String::new(),
            near_osnap_geometry_parameter: 0.0,
            osnap_point: Point::origin(),
            intersection_object: 0,
            intersection_subentity_type: SubentityType::Edge,
            intersection_object_gs_marker_index: 0,
            intersection_object_xref_handle: String::new(),
            has_last_point_reference: false,
        }
    }
}

impl DimensionAssoc {
    pub fn get_is_first_point_reference(&self) -> bool {
        self.associativity_flags & 1 != 0
    }
    pub fn set_is_first_point_reference(&mut self, val: bool) {
        if val {
            self.associativity_flags |= 1;
        }
        else {
            self.associativity_flags &= !1;
        }
    }
    pub fn get_is_second_point_reference(&self) -> bool {
        self.associativity_flags & 2 != 0
    }
    pub fn set_is_second_point_reference(&mut self, val: bool) {
        if val {
            self.associativity_flags |= 2;
        }
        else {
            self.associativity_flags &= !2;
        }
    }
    pub fn get_is_third_point_reference(&self) -> bool {
        self.associativity_flags & 4 != 0
    }
    pub fn set_is_third_point_reference(&mut self, val: bool) {
        if val {
            self.associativity_flags |= 4;
        }
        else {
            self.associativity_flags &= !4;
        }
    }
    pub fn get_is_fourth_point_reference(&self) -> bool {
        self.associativity_flags & 8 != 0
    }
    pub fn set_is_fourth_point_reference(&mut self, val: bool) {
        if val {
            self.associativity_flags |= 8;
        }
        else {
            self.associativity_flags &= !8;
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct Field {
    pub evaluator_id: String,
    pub field_code_string: String,
    pub field_code_string_overflow: String,
    format_string: String,
    pub evaluation_error_message: String,
    _child_field_count: i32,
    pub child_fields: Vec<u32>,
    pub evaluation_option: i32,
    pub filling_option: i32,
    pub field_state: i32,
    pub evaluation_status: i32,
    pub evaluation_error_code: i32,
    _object_id_count: i32,
    pub objects: Vec<u32>,
    _data_set_count: i32,
    pub field_data_keys: Vec<String>,
    pub evaluated_cache_key: String,
    _value_type_code: i32,
    _long_value: i32,
    _double_value: f64,
    _id_value: u32,
    _binary_data_buffer_size: i32,
    _binary_data: String,
    _format_string_code301: String,
    _format_string_overflow: String,
    _format_string_length: i32,
    _child_field_count_value_type_code: Vec<i32>,
}

impl Default for Field {
    fn default() -> Field {
        Field {
            evaluator_id: String::new(),
            field_code_string: String::new(),
            field_code_string_overflow: String::new(),
            format_string: String::new(),
            evaluation_error_message: String::new(),
            _child_field_count: 0,
            child_fields: vec![],
            evaluation_option: 0,
            filling_option: 0,
            field_state: 0,
            evaluation_status: 0,
            evaluation_error_code: 0,
            _object_id_count: 0,
            objects: vec![],
            _data_set_count: 0,
            field_data_keys: vec![],
            evaluated_cache_key: String::from("ACFD_FIELD_VALUE"),
            _value_type_code: 0,
            _long_value: 0,
            _double_value: 0.0,
            _id_value: 0,
            _binary_data_buffer_size: 0,
            _binary_data: String::new(),
            _format_string_code301: String::new(),
            _format_string_overflow: String::new(),
            _format_string_length: 0,
            _child_field_count_value_type_code: vec![],
        }
    }
}

impl Field {
}

#[derive(Clone, Debug, PartialEq)]
pub struct GeoData {
    pub version: GeoDataVersion,
    pub coordinate_type: DesignCoordinateType,
    pub design_point: Point,
    pub reference_point: Point,
    pub north_vector: Vector,
    pub horizontal_unit_scale: f64,
    pub vertical_unit_scale: f64,
    pub horizontal_units: Units,
    pub vertical_units: Units,
    pub up_direction: Vector,
    pub scale_estimation_method: ScaleEstimationMethod,
    pub use_sea_level_correction: bool,
    pub user_specified_scale_factor: f64,
    pub sea_level_elevation: f64,
    pub coordinate_projection_radius: f64,
    pub coordinate_system_definition: String,
    pub geo_rss_tag: String,
    pub observation_from_tag: String,
    pub observation_to_tag: String,
    pub observation_coverage_tag: String,
    pub geo_mesh_points: Vec<GeoMeshPoint>,
    _geo_mesh_point_count: i32,
    #[doc(hidden)]
    pub _source_mesh_x_points: Vec<f64>,
    #[doc(hidden)]
    pub _source_mesh_y_points: Vec<f64>,
    #[doc(hidden)]
    pub _destination_mesh_x_points: Vec<f64>,
    #[doc(hidden)]
    pub _destination_mesh_y_points: Vec<f64>,
    pub face_indices: Vec<Point>,
    _faces_count: i32,
    #[doc(hidden)]
    pub _face_point_index_x: Vec<f64>,
    #[doc(hidden)]
    pub _face_point_index_y: Vec<f64>,
    #[doc(hidden)]
    pub _face_point_index_z: Vec<f64>,
}

impl Default for GeoData {
    fn default() -> GeoData {
        GeoData {
            version: GeoDataVersion::R2009,
            coordinate_type: DesignCoordinateType::Unknown,
            design_point: Point::origin(),
            reference_point: Point::origin(),
            north_vector: Vector::z_axis(),
            horizontal_unit_scale: 1.0,
            vertical_unit_scale: 1.0,
            horizontal_units: Units::Unitless,
            vertical_units: Units::Unitless,
            up_direction: Vector::z_axis(),
            scale_estimation_method: ScaleEstimationMethod::None,
            use_sea_level_correction: false,
            user_specified_scale_factor: 1.0,
            sea_level_elevation: 0.0,
            coordinate_projection_radius: 0.0,
            coordinate_system_definition: String::new(),
            geo_rss_tag: String::new(),
            observation_from_tag: String::new(),
            observation_to_tag: String::new(),
            observation_coverage_tag: String::new(),
            geo_mesh_points: vec![],
            _geo_mesh_point_count: 0,
            _source_mesh_x_points: vec![],
            _source_mesh_y_points: vec![],
            _destination_mesh_x_points: vec![],
            _destination_mesh_y_points: vec![],
            face_indices: vec![],
            _faces_count: 0,
            _face_point_index_x: vec![],
            _face_point_index_y: vec![],
            _face_point_index_z: vec![],
        }
    }
}

impl GeoData {
}

#[derive(Clone, Debug, PartialEq)]
pub struct Group {
    pub description: String,
    pub is_named: bool,
    pub is_selectable: bool,
    pub entities: Vec<u32>,
}

impl Default for Group {
    fn default() -> Group {
        Group {
            description: String::new(),
            is_named: true,
            is_selectable: true,
            entities: vec![],
        }
    }
}

impl Group {
}

#[derive(Clone, Debug, PartialEq)]
pub struct IdBuffer {
    pub entities: Vec<u32>,
}

impl Default for IdBuffer {
    fn default() -> IdBuffer {
        IdBuffer {
            entities: vec![],
        }
    }
}

impl IdBuffer {
}

#[derive(Clone, Debug, PartialEq)]
pub struct ImageDefinition {
    pub class_version: i32,
    pub file_path: String,
    pub image_width: i32,
    pub image_height: i32,
    pub pixel_width: f64,
    pub pixel_height: f64,
    pub is_image_loaded: bool,
    pub resolution_units: ImageResolutionUnits,
}

impl Default for ImageDefinition {
    fn default() -> ImageDefinition {
        ImageDefinition {
            class_version: 0,
            file_path: String::new(),
            image_width: 0,
            image_height: 0,
            pixel_width: 0.0,
            pixel_height: 0.0,
            is_image_loaded: true,
            resolution_units: ImageResolutionUnits::NoUnits,
        }
    }
}

impl ImageDefinition {
}

#[derive(Clone, Debug, PartialEq)]
pub struct ImageDefinitionReactor {
    pub class_version: i32,
}

impl Default for ImageDefinitionReactor {
    fn default() -> ImageDefinitionReactor {
        ImageDefinitionReactor {
            class_version: 0,
        }
    }
}

impl ImageDefinitionReactor {
}

#[derive(Clone, Debug, PartialEq)]
pub struct LayerFilter {
    pub layer_names: Vec<String>,
}

impl Default for LayerFilter {
    fn default() -> LayerFilter {
        LayerFilter {
            layer_names: vec![],
        }
    }
}

impl LayerFilter {
}

#[derive(Clone, Debug, PartialEq)]
pub struct LayerIndex {
    pub time_stamp: DateTime<Local>,
    pub layer_names: Vec<String>,
    pub id_buffers: Vec<u32>,
    pub id_buffer_counts: Vec<i32>,
}

impl Default for LayerIndex {
    fn default() -> LayerIndex {
        LayerIndex {
            time_stamp: Local::now(),
            layer_names: vec![],
            id_buffers: vec![],
            id_buffer_counts: vec![],
        }
    }
}

impl LayerIndex {
}

#[derive(Clone, Debug, PartialEq)]
pub struct Layout {
    pub layout_name: String,
    pub layout_flags: i32,
    pub tab_order: i32,
    pub minimum_limits: Point,
    pub maximum_limits: Point,
    pub insertion_base_point: Point,
    pub minimum_extents: Point,
    pub maximum_extents: Point,
    pub elevation: f64,
    pub ucs_origin: Point,
    pub ucs_x_axis: Vector,
    pub ucs_y_axis: Vector,
    pub ucs_orthographic_type: UcsOrthographicType,
    pub viewport: u32,
    pub table_record: u32,
    pub table_record_base: u32,
}

impl Default for Layout {
    fn default() -> Layout {
        Layout {
            layout_name: String::new(),
            layout_flags: 0,
            tab_order: 0,
            minimum_limits: Point::origin(),
            maximum_limits: Point::origin(),
            insertion_base_point: Point::origin(),
            minimum_extents: Point::origin(),
            maximum_extents: Point::origin(),
            elevation: 0.0,
            ucs_origin: Point::origin(),
            ucs_x_axis: Vector::x_axis(),
            ucs_y_axis: Vector::y_axis(),
            ucs_orthographic_type: UcsOrthographicType::NotOrthographic,
            viewport: 0,
            table_record: 0,
            table_record_base: 0,
        }
    }
}

impl Layout {
    pub fn get_is_ps_lt_scale(&self) -> bool {
        self.layout_flags & 1 != 0
    }
    pub fn set_is_ps_lt_scale(&mut self, val: bool) {
        if val {
            self.layout_flags |= 1;
        }
        else {
            self.layout_flags &= !1;
        }
    }
    pub fn get_is_lim_check(&self) -> bool {
        self.layout_flags & 2 != 0
    }
    pub fn set_is_lim_check(&mut self, val: bool) {
        if val {
            self.layout_flags |= 2;
        }
        else {
            self.layout_flags &= !2;
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct LightList {
    pub version: i32,
    pub lights: Vec<u32>,
}

impl Default for LightList {
    fn default() -> LightList {
        LightList {
            version: 0,
            lights: vec![],
        }
    }
}

impl LightList {
}

#[derive(Clone, Debug, PartialEq)]
pub struct Material {
    pub name: String,
    pub description: String,
    pub override_ambient_color: bool,
    pub ambient_color_factor: f64,
    pub ambient_color_value: i32,
    pub override_diffuse_color: bool,
    pub diffuse_color_factor: f64,
    pub diffuse_color_value: i32,
    pub diffuse_map_blend_factor: f64,
    pub use_image_file_for_diffuse_map: bool,
    pub diffuse_map_file_name: String,
    pub diffuse_map_projection_method: MapProjectionMethod,
    pub diffuse_map_tiling_method: MapTilingMethod,
    pub diffuse_map_auto_transform_method: MapAutoTransformMethod,
    pub diffuse_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _diffuse_map_transformation_matrix_values: Vec<f64>,
    pub specular_gloss_factor: f64,
    pub override_specular_color: bool,
    pub specular_color_factor: f64,
    pub specular_color_value: i32,
    pub specular_map_blend_factor: f64,
    pub use_image_file_for_specular_map: bool,
    pub specular_map_file_name: String,
    pub specular_map_projection_method: MapProjectionMethod,
    pub specular_map_tiling_method: MapTilingMethod,
    pub specular_map_auto_transform_method: MapAutoTransformMethod,
    pub specular_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _specular_map_transformation_matrix_values: Vec<f64>,
    pub reflection_map_blend_factor: f64,
    pub use_image_file_for_reflection_map: bool,
    pub reflection_map_file_name: String,
    pub reflection_map_projection_method: MapProjectionMethod,
    pub reflection_map_tiling_method: MapTilingMethod,
    pub reflection_map_auto_transform_method: MapAutoTransformMethod,
    pub reflection_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _reflection_map_transformation_matrix_values: Vec<f64>,
    pub opacity_factor: f64,
    pub opacity_map_blend_factor: f64,
    pub use_image_file_for_opacity_map: bool,
    pub opacity_map_file_name: String,
    pub opacity_map_projection_method: MapProjectionMethod,
    pub opacity_map_tiling_method: MapTilingMethod,
    pub opacity_map_auto_transform_method: MapAutoTransformMethod,
    pub opacity_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _opacity_map_transformation_matrix_values: Vec<f64>,
    pub bump_map_blend_factor: f64,
    pub use_image_file_for_bump_map: bool,
    pub bump_map_file_name: String,
    pub bump_map_projection_method: MapProjectionMethod,
    pub bump_map_tiling_method: MapTilingMethod,
    pub bump_map_auto_transform_method: MapAutoTransformMethod,
    pub bump_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _bump_map_transformation_matrix_values: Vec<f64>,
    pub refraction_index: f64,
    pub refraction_map_blend_factor: f64,
    pub use_image_file_for_refraction_map: bool,
    pub refraction_map_file_name: String,
    pub refraction_map_projection_method: MapProjectionMethod,
    pub refraction_map_tiling_method: MapTilingMethod,
    pub refraction_map_auto_transform_method: MapAutoTransformMethod,
    pub refraction_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _refraction_map_transformation_matrix_values: Vec<f64>,
    pub color_bleed_scale: f64,
    pub indirect_dump_scale: f64,
    pub reflectance_scale: f64,
    pub transmittance_scale: f64,
    pub is_two_sided: bool,
    pub luminance: f64,
    pub luminance_mode: i16,
    pub normal_map_method: i16,
    pub normal_map_strength: f64,
    pub normal_map_blend_factor: f64,
    pub use_image_file_for_normal_map: bool,
    pub normal_map_file_name: String,
    pub normal_map_projection_method: MapProjectionMethod,
    pub normal_map_tiling_method: MapTilingMethod,
    pub normal_map_auto_transform_method: MapAutoTransformMethod,
    pub normal_map_transformation_matrix: TransformationMatrix,
    #[doc(hidden)]
    pub _normal_map_transformation_matrix_values: Vec<f64>,
    pub is_anonymous: bool,
    pub global_illumination_mode: i16,
    pub final_gather_mode: i16,
    pub gen_proc_name: String,
    pub gen_proc_boolean_value: bool,
    pub gen_proc_integer_value: i16,
    pub gen_proc_real_value: f64,
    pub gen_proc_text_value: String,
    pub gen_proc_table_end: bool,
    pub gen_proc_color_index_value: Color,
    pub gen_proc_color_rgb_value: i32,
    pub gen_proc_color_name: String,
    pub map_u_tile: i16,
    pub map_v_tile: i16,
    pub translucence: f64,
    pub self_illumination: i32,
    pub reflectivity: f64,
    pub illumination_model: i32,
    pub channel_flags: i32,
}

impl Default for Material {
    fn default() -> Material {
        Material {
            name: String::new(),
            description: String::new(),
            override_ambient_color: false,
            ambient_color_factor: 1.0,
            ambient_color_value: 0,
            override_diffuse_color: false,
            diffuse_color_factor: 1.0,
            diffuse_color_value: 0,
            diffuse_map_blend_factor: 1.0,
            use_image_file_for_diffuse_map: false,
            diffuse_map_file_name: String::new(),
            diffuse_map_projection_method: MapProjectionMethod::Planar,
            diffuse_map_tiling_method: MapTilingMethod::Tile,
            diffuse_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            diffuse_map_transformation_matrix: TransformationMatrix::identity(),
            _diffuse_map_transformation_matrix_values: vec![],
            specular_gloss_factor: 0.5,
            override_specular_color: false,
            specular_color_factor: 1.0,
            specular_color_value: 0,
            specular_map_blend_factor: 1.0,
            use_image_file_for_specular_map: false,
            specular_map_file_name: String::new(),
            specular_map_projection_method: MapProjectionMethod::Planar,
            specular_map_tiling_method: MapTilingMethod::Tile,
            specular_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            specular_map_transformation_matrix: TransformationMatrix::identity(),
            _specular_map_transformation_matrix_values: vec![],
            reflection_map_blend_factor: 1.0,
            use_image_file_for_reflection_map: false,
            reflection_map_file_name: String::new(),
            reflection_map_projection_method: MapProjectionMethod::Planar,
            reflection_map_tiling_method: MapTilingMethod::Tile,
            reflection_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            reflection_map_transformation_matrix: TransformationMatrix::identity(),
            _reflection_map_transformation_matrix_values: vec![],
            opacity_factor: 1.0,
            opacity_map_blend_factor: 1.0,
            use_image_file_for_opacity_map: false,
            opacity_map_file_name: String::new(),
            opacity_map_projection_method: MapProjectionMethod::Planar,
            opacity_map_tiling_method: MapTilingMethod::Tile,
            opacity_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            opacity_map_transformation_matrix: TransformationMatrix::identity(),
            _opacity_map_transformation_matrix_values: vec![],
            bump_map_blend_factor: 1.0,
            use_image_file_for_bump_map: false,
            bump_map_file_name: String::new(),
            bump_map_projection_method: MapProjectionMethod::Planar,
            bump_map_tiling_method: MapTilingMethod::Tile,
            bump_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            bump_map_transformation_matrix: TransformationMatrix::identity(),
            _bump_map_transformation_matrix_values: vec![],
            refraction_index: 1.0,
            refraction_map_blend_factor: 1.0,
            use_image_file_for_refraction_map: false,
            refraction_map_file_name: String::new(),
            refraction_map_projection_method: MapProjectionMethod::Planar,
            refraction_map_tiling_method: MapTilingMethod::Tile,
            refraction_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            refraction_map_transformation_matrix: TransformationMatrix::identity(),
            _refraction_map_transformation_matrix_values: vec![],
            color_bleed_scale: 0.0,
            indirect_dump_scale: 0.0,
            reflectance_scale: 0.0,
            transmittance_scale: 0.0,
            is_two_sided: false,
            luminance: 0.0,
            luminance_mode: 0,
            normal_map_method: 0,
            normal_map_strength: 1.0,
            normal_map_blend_factor: 1.0,
            use_image_file_for_normal_map: false,
            normal_map_file_name: String::new(),
            normal_map_projection_method: MapProjectionMethod::Planar,
            normal_map_tiling_method: MapTilingMethod::Tile,
            normal_map_auto_transform_method: MapAutoTransformMethod::NoAutoTransform,
            normal_map_transformation_matrix: TransformationMatrix::identity(),
            _normal_map_transformation_matrix_values: vec![],
            is_anonymous: false,
            global_illumination_mode: 0,
            final_gather_mode: 0,
            gen_proc_name: String::new(),
            gen_proc_boolean_value: false,
            gen_proc_integer_value: 0,
            gen_proc_real_value: 0.0,
            gen_proc_text_value: String::new(),
            gen_proc_table_end: false,
            gen_proc_color_index_value: Color::by_layer(),
            gen_proc_color_rgb_value: 0,
            gen_proc_color_name: String::new(),
            map_u_tile: 0,
            map_v_tile: 0,
            translucence: 0.0,
            self_illumination: 0,
            reflectivity: 0.0,
            illumination_model: 0,
            channel_flags: 0,
        }
    }
}

impl Material {
}

#[derive(Clone, Debug, PartialEq)]
pub struct MLeaderStyle {
    pub content_type: i16,
    pub draw_m_leader_order_type: i16,
    pub draw_leader_order_type: i16,
    pub max_leader_segment_count: i32,
    pub first_segment_angle_constraint: f64,
    pub second_segment_angle_constraint: f64,
    pub leader_line_type: i16,
    pub leader_line_color: i32,
    pub line_leader_type: u32,
    pub leader_line_weight: i32,
    pub enable_landing: bool,
    pub landing_gap: f64,
    pub enable_dogleg: bool,
    pub dogleg_length: f64,
    pub m_leader_style_description: String,
    pub arrowhead: u32,
    pub arrowhead_size: f64,
    pub default_m_text_contents: String,
    pub m_text_style: u32,
    pub text_left_attachment_type: i16,
    pub text_angle_type: i16,
    pub text_alignment_type: i16,
    pub text_right_attachment_type: i16,
    pub text_color: i32,
    pub text_height: f64,
    pub enable_frame_text: bool,
    pub always_align_text_left: bool,
    pub align_gap: f64,
    pub block_content: u32,
    pub block_content_color: i32,
    pub block_content_x_scale: f64,
    pub block_content_y_scale: f64,
    pub block_content_z_scale: f64,
    pub enable_block_content_scale: bool,
    pub block_content_rotation: f64,
    pub enable_block_content_rotation: bool,
    pub block_content_connection_type: i16,
    pub scale: f64,
    pub overwrite_field_value: bool,
    pub is_annotative: bool,
    pub break_gap_size: f64,
    pub text_attachment_direction: TextAttachmentDirection,
    pub bottom_text_attachment_direction: BottomTextAttachmentDirection,
    pub top_text_attachment_direction: TopTextAttachmentDirection,
}

impl Default for MLeaderStyle {
    fn default() -> MLeaderStyle {
        MLeaderStyle {
            content_type: 0,
            draw_m_leader_order_type: 0,
            draw_leader_order_type: 0,
            max_leader_segment_count: 0,
            first_segment_angle_constraint: 0.0,
            second_segment_angle_constraint: 0.0,
            leader_line_type: 0,
            leader_line_color: 0,
            line_leader_type: 0,
            leader_line_weight: 0,
            enable_landing: true,
            landing_gap: 0.0,
            enable_dogleg: true,
            dogleg_length: 0.0,
            m_leader_style_description: String::new(),
            arrowhead: 0,
            arrowhead_size: 0.0,
            default_m_text_contents: String::new(),
            m_text_style: 0,
            text_left_attachment_type: 0,
            text_angle_type: 0,
            text_alignment_type: 0,
            text_right_attachment_type: 0,
            text_color: 0,
            text_height: 0.0,
            enable_frame_text: true,
            always_align_text_left: true,
            align_gap: 0.0,
            block_content: 0,
            block_content_color: 0,
            block_content_x_scale: 1.0,
            block_content_y_scale: 1.0,
            block_content_z_scale: 1.0,
            enable_block_content_scale: true,
            block_content_rotation: 0.0,
            enable_block_content_rotation: true,
            block_content_connection_type: 0,
            scale: 1.0,
            overwrite_field_value: false,
            is_annotative: true,
            break_gap_size: 0.0,
            text_attachment_direction: TextAttachmentDirection::Horizontal,
            bottom_text_attachment_direction: BottomTextAttachmentDirection::Center,
            top_text_attachment_direction: TopTextAttachmentDirection::Center,
        }
    }
}

impl MLeaderStyle {
}

#[derive(Clone, Debug, PartialEq)]
pub struct MLineStyle {
    pub style_name: String,
    #[doc(hidden)]
    pub _flags: i32,
    pub description: String,
    pub fill_color: Color,
    pub start_angle: f64,
    pub end_angle: f64,
    pub elements: Vec<MLineStyleElement>,
    #[doc(hidden)]
    pub _element_count: i32,
    #[doc(hidden)]
    pub _element_offsets: Vec<f64>,
    #[doc(hidden)]
    pub _element_colors: Vec<Color>,
    #[doc(hidden)]
    pub _element_line_types: Vec<String>,
}

impl Default for MLineStyle {
    fn default() -> MLineStyle {
        MLineStyle {
            style_name: String::new(),
            _flags: 0,
            description: String::new(),
            fill_color: Color::by_layer(),
            start_angle: 90.0,
            end_angle: 90.0,
            elements: vec![],
            _element_count: 0,
            _element_offsets: vec![],
            _element_colors: vec![],
            _element_line_types: vec![],
        }
    }
}

impl MLineStyle {
    pub fn get_fill_on(&self) -> bool {
        self._flags & 1 != 0
    }
    pub fn set_fill_on(&mut self, val: bool) {
        if val {
            self._flags |= 1;
        }
        else {
            self._flags &= !1;
        }
    }
    pub fn get_display_miters(&self) -> bool {
        self._flags & 2 != 0
    }
    pub fn set_display_miters(&mut self, val: bool) {
        if val {
            self._flags |= 2;
        }
        else {
            self._flags &= !2;
        }
    }
    pub fn get_start_square_end_cap(&self) -> bool {
        self._flags & 16 != 0
    }
    pub fn set_start_square_end_cap(&mut self, val: bool) {
        if val {
            self._flags |= 16;
        }
        else {
            self._flags &= !16;
        }
    }
    pub fn get_start_inner_arcs_cap(&self) -> bool {
        self._flags & 32 != 0
    }
    pub fn set_start_inner_arcs_cap(&mut self, val: bool) {
        if val {
            self._flags |= 32;
        }
        else {
            self._flags &= !32;
        }
    }
    pub fn get_start_round_cap(&self) -> bool {
        self._flags & 64 != 0
    }
    pub fn set_start_round_cap(&mut self, val: bool) {
        if val {
            self._flags |= 64;
        }
        else {
            self._flags &= !64;
        }
    }
    pub fn get_end_square_cap(&self) -> bool {
        self._flags & 256 != 0
    }
    pub fn set_end_square_cap(&mut self, val: bool) {
        if val {
            self._flags |= 256;
        }
        else {
            self._flags &= !256;
        }
    }
    pub fn get_end_inner_arcs_cap(&self) -> bool {
        self._flags & 512 != 0
    }
    pub fn set_end_inner_arcs_cap(&mut self, val: bool) {
        if val {
            self._flags |= 512;
        }
        else {
            self._flags &= !512;
        }
    }
    pub fn get_end_round_cap(&self) -> bool {
        self._flags & 1024 != 0
    }
    pub fn set_end_round_cap(&mut self, val: bool) {
        if val {
            self._flags |= 1024;
        }
        else {
            self._flags &= !1024;
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPointer {
}

impl Default for ObjectPointer {
    fn default() -> ObjectPointer {
        ObjectPointer {
        }
    }
}

impl ObjectPointer {
}

#[derive(Clone, Debug, PartialEq)]
pub struct PlotSettings {
    pub page_setup_name: String,
    pub printer_name: String,
    pub paper_size: String,
    pub plot_view_name: String,
    pub unprintable_left_margin_size: f64,
    pub unprintable_bottom_margin_size: f64,
    pub unprintable_right_margin_size: f64,
    pub unprintable_top_margin_size: f64,
    pub paper_width: f64,
    pub paper_height: f64,
    pub plot_origin_x_value: f64,
    pub plot_origin_y_value: f64,
    pub plot_window_lower_left_x_value: f64,
    pub plot_window_lower_left_y_value: f64,
    pub plot_window_upper_right_x_value: f64,
    pub plot_window_upper_right_y_value: f64,
    pub custom_print_scale_numerator: f64,
    pub custom_print_scale_denominator: f64,
    pub plot_layout_flags: i32,
    pub plot_paper_units: PlotPaperUnits,
    pub plot_rotation: PlotRotation,
    pub plot_type: PlotType,
    pub current_style_sheet: String,
    pub standard_scale: StandardScale,
    pub shade_plot_mode: ShadePlotMode,
    pub shade_plot_resolution_level: ShadePlotResolutionLevel,
    pub shade_plot_custom_dpi: i32,
    pub standard_scale_value: f64,
    pub paper_image_origin_x: f64,
    pub paper_image_origin_y: f64,
    pub shade_plot_object: u32,
}

impl Default for PlotSettings {
    fn default() -> PlotSettings {
        PlotSettings {
            page_setup_name: String::new(),
            printer_name: String::new(),
            paper_size: String::new(),
            plot_view_name: String::new(),
            unprintable_left_margin_size: 0.0,
            unprintable_bottom_margin_size: 0.0,
            unprintable_right_margin_size: 0.0,
            unprintable_top_margin_size: 0.0,
            paper_width: 0.0,
            paper_height: 0.0,
            plot_origin_x_value: 0.0,
            plot_origin_y_value: 0.0,
            plot_window_lower_left_x_value: 0.0,
            plot_window_lower_left_y_value: 0.0,
            plot_window_upper_right_x_value: 0.0,
            plot_window_upper_right_y_value: 0.0,
            custom_print_scale_numerator: 0.0,
            custom_print_scale_denominator: 0.0,
            plot_layout_flags: 0,
            plot_paper_units: PlotPaperUnits::Inches,
            plot_rotation: PlotRotation::NoRotation,
            plot_type: PlotType::DrawingExtents,
            current_style_sheet: String::new(),
            standard_scale: StandardScale::ScaledToFit,
            shade_plot_mode: ShadePlotMode::AsDisplayed,
            shade_plot_resolution_level: ShadePlotResolutionLevel::Normal,
            shade_plot_custom_dpi: 100,
            standard_scale_value: 1.0,
            paper_image_origin_x: 0.0,
            paper_image_origin_y: 0.0,
            shade_plot_object: 0,
        }
    }
}

impl PlotSettings {
    pub fn get_plot_viewport_borders(&self) -> bool {
        self.plot_layout_flags & 1 != 0
    }
    pub fn set_plot_viewport_borders(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 1;
        }
        else {
            self.plot_layout_flags &= !1;
        }
    }
    pub fn get_show_plot_styles(&self) -> bool {
        self.plot_layout_flags & 2 != 0
    }
    pub fn set_show_plot_styles(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 2;
        }
        else {
            self.plot_layout_flags &= !2;
        }
    }
    pub fn get_plot_centered(&self) -> bool {
        self.plot_layout_flags & 4 != 0
    }
    pub fn set_plot_centered(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 4;
        }
        else {
            self.plot_layout_flags &= !4;
        }
    }
    pub fn get_plot_hidden(&self) -> bool {
        self.plot_layout_flags & 8 != 0
    }
    pub fn set_plot_hidden(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 8;
        }
        else {
            self.plot_layout_flags &= !8;
        }
    }
    pub fn get_use_standard_scale(&self) -> bool {
        self.plot_layout_flags & 16 != 0
    }
    pub fn set_use_standard_scale(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 16;
        }
        else {
            self.plot_layout_flags &= !16;
        }
    }
    pub fn get_plot_plot_styles(&self) -> bool {
        self.plot_layout_flags & 32 != 0
    }
    pub fn set_plot_plot_styles(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 32;
        }
        else {
            self.plot_layout_flags &= !32;
        }
    }
    pub fn get_scale_line_weights(&self) -> bool {
        self.plot_layout_flags & 64 != 0
    }
    pub fn set_scale_line_weights(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 64;
        }
        else {
            self.plot_layout_flags &= !64;
        }
    }
    pub fn get_print_line_weights(&self) -> bool {
        self.plot_layout_flags & 128 != 0
    }
    pub fn set_print_line_weights(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 128;
        }
        else {
            self.plot_layout_flags &= !128;
        }
    }
    pub fn get_draw_viewports_first(&self) -> bool {
        self.plot_layout_flags & 512 != 0
    }
    pub fn set_draw_viewports_first(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 512;
        }
        else {
            self.plot_layout_flags &= !512;
        }
    }
    pub fn get_model_type(&self) -> bool {
        self.plot_layout_flags & 1024 != 0
    }
    pub fn set_model_type(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 1024;
        }
        else {
            self.plot_layout_flags &= !1024;
        }
    }
    pub fn get_update_paper(&self) -> bool {
        self.plot_layout_flags & 2048 != 0
    }
    pub fn set_update_paper(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 2048;
        }
        else {
            self.plot_layout_flags &= !2048;
        }
    }
    pub fn get_zoom_to_paper_on_update(&self) -> bool {
        self.plot_layout_flags & 4096 != 0
    }
    pub fn set_zoom_to_paper_on_update(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 4096;
        }
        else {
            self.plot_layout_flags &= !4096;
        }
    }
    pub fn get_initializing(&self) -> bool {
        self.plot_layout_flags & 8192 != 0
    }
    pub fn set_initializing(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 8192;
        }
        else {
            self.plot_layout_flags &= !8192;
        }
    }
    pub fn get_prev_plot_init(&self) -> bool {
        self.plot_layout_flags & 16384 != 0
    }
    pub fn set_prev_plot_init(&mut self, val: bool) {
        if val {
            self.plot_layout_flags |= 16384;
        }
        else {
            self.plot_layout_flags &= !16384;
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct RasterVariables {
    pub class_version: i32,
    pub is_display_frame_image: bool,
    pub is_high_display_quality: bool,
    pub image_units: RasterImageUnits,
}

impl Default for RasterVariables {
    fn default() -> RasterVariables {
        RasterVariables {
            class_version: 0,
            is_display_frame_image: false,
            is_high_display_quality: false,
            image_units: RasterImageUnits::None,
        }
    }
}

impl RasterVariables {
}

#[derive(Clone, Debug, PartialEq)]
pub struct MentalRayRenderSettings {
    pub class_version_1: i32,
    pub preset_name: String,
    pub render_materials: bool,
    pub texture_sampling_quality: i32,
    pub render_back_faces: bool,
    pub render_shadows: bool,
    pub preview_file_name: String,
    pub class_version_2: i32,
    pub minimum_sampling_rate: i32,
    pub maximum_sampling_rate: i32,
    pub sampling_filter_type: SamplingFilterType,
    pub filter_width: f64,
    pub filter_height: f64,
    pub sampling_contrast_color_red: f64,
    pub sampling_contrast_color_green: f64,
    pub sampling_contrast_color_blue: f64,
    pub sampling_contrast_color_alpha: f64,
    pub shadow_mode: RenderShadowMode,
    pub map_shadows: bool,
    pub ray_tracing: bool,
    pub ray_tracing_depth_reflections: i32,
    pub ray_tracing_depth_refractions: i32,
    pub ray_tracing_depth_maximum: i32,
    pub use_global_illumination: bool,
    pub sample_count: i32,
    pub use_global_illumination_radius: bool,
    pub global_illumination_radius: f64,
    pub photons_per_light: i32,
    pub global_illumination_depth_reflections: i32,
    pub global_illumination_depth_refractions: i32,
    pub global_illumination_depth_maximum: i32,
    pub use_final_gather: bool,
    pub final_gather_ray_count: i32,
    pub use_final_gather_minimum_radius: bool,
    pub use_final_gather_maximum_radius: bool,
    pub use_final_gather_pixels: bool,
    pub final_gather_sample_radius_minimum: f64,
    pub final_gather_sample_radius_maximum: f64,
    pub luminance_scale: f64,
    pub diagnostic_mode: RenderDiagnosticMode,
    pub diagnostic_grid_mode: RenderDiagnosticGridMode,
    pub grid_size: f64,
    pub diagnostic_photon_mode: DiagnosticPhotonMode,
    pub diagnostic_bsp_mode: DiagnosticBSPMode,
    pub export_mi_statistics: bool,
    pub mi_statistics_file_name: String,
    pub tile_size: i32,
    pub tile_order: TileOrder,
    pub memory_limit: i32,
}

impl Default for MentalRayRenderSettings {
    fn default() -> MentalRayRenderSettings {
        MentalRayRenderSettings {
            class_version_1: 1,
            preset_name: String::new(),
            render_materials: false,
            texture_sampling_quality: 0,
            render_back_faces: false,
            render_shadows: false,
            preview_file_name: String::new(),
            class_version_2: 1,
            minimum_sampling_rate: 0,
            maximum_sampling_rate: 0,
            sampling_filter_type: SamplingFilterType::Box,
            filter_width: 0.0,
            filter_height: 0.0,
            sampling_contrast_color_red: 0.0,
            sampling_contrast_color_green: 0.0,
            sampling_contrast_color_blue: 0.0,
            sampling_contrast_color_alpha: 0.0,
            shadow_mode: RenderShadowMode::Simple,
            map_shadows: false,
            ray_tracing: false,
            ray_tracing_depth_reflections: 0,
            ray_tracing_depth_refractions: 0,
            ray_tracing_depth_maximum: 0,
            use_global_illumination: false,
            sample_count: 0,
            use_global_illumination_radius: false,
            global_illumination_radius: 0.0,
            photons_per_light: 0,
            global_illumination_depth_reflections: 0,
            global_illumination_depth_refractions: 0,
            global_illumination_depth_maximum: 0,
            use_final_gather: false,
            final_gather_ray_count: 0,
            use_final_gather_minimum_radius: false,
            use_final_gather_maximum_radius: false,
            use_final_gather_pixels: false,
            final_gather_sample_radius_minimum: 0.0,
            final_gather_sample_radius_maximum: 0.0,
            luminance_scale: 1.0,
            diagnostic_mode: RenderDiagnosticMode::Off,
            diagnostic_grid_mode: RenderDiagnosticGridMode::Object,
            grid_size: 1.0,
            diagnostic_photon_mode: DiagnosticPhotonMode::Density,
            diagnostic_bsp_mode: DiagnosticBSPMode::Depth,
            export_mi_statistics: false,
            mi_statistics_file_name: String::new(),
            tile_size: 0,
            tile_order: TileOrder::Hilbert,
            memory_limit: 0,
        }
    }
}

impl MentalRayRenderSettings {
}

#[derive(Clone, Debug, PartialEq)]
pub struct RenderEnvironment {
    pub class_version: i32,
    pub is_fog_enabled: bool,
    pub is_background_fog_enabled: bool,
    pub fog_color_red: i32,
    pub fog_color_green: i32,
    pub fog_color_blue: i32,
    pub near_fog_density_percent: f64,
    pub far_fog_density_percent: f64,
    pub near_clipping_plane_distance_percent: f64,
    pub far_clipping_plane_distance_percent: f64,
    pub use_environment_image: bool,
    pub environment_image_file_name: String,
}

impl Default for RenderEnvironment {
    fn default() -> RenderEnvironment {
        RenderEnvironment {
            class_version: 1,
            is_fog_enabled: false,
            is_background_fog_enabled: false,
            fog_color_red: 0,
            fog_color_green: 0,
            fog_color_blue: 0,
            near_fog_density_percent: 0.0,
            far_fog_density_percent: 0.0,
            near_clipping_plane_distance_percent: 0.0,
            far_clipping_plane_distance_percent: 1.0,
            use_environment_image: false,
            environment_image_file_name: String::new(),
        }
    }
}

impl RenderEnvironment {
}

#[derive(Clone, Debug, PartialEq)]
pub struct RenderGlobal {
    pub class_version: i32,
    pub render_procedure: RenderProcedure,
    pub render_destination: RenderDestination,
    pub save_to_file: bool,
    pub save_to_file_name: String,
    pub image_width: i32,
    pub image_height: i32,
    pub use_predefined_presets_first: bool,
    pub use_high_info_level: bool,
}

impl Default for RenderGlobal {
    fn default() -> RenderGlobal {
        RenderGlobal {
            class_version: 2,
            render_procedure: RenderProcedure::View,
            render_destination: RenderDestination::RenderWindow,
            save_to_file: false,
            save_to_file_name: String::new(),
            image_width: 0,
            image_height: 0,
            use_predefined_presets_first: false,
            use_high_info_level: false,
        }
    }
}

impl RenderGlobal {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SectionManager {
    pub requires_full_update: bool,
    _section_count: i32,
    pub section_entities: Vec<u32>,
}

impl Default for SectionManager {
    fn default() -> SectionManager {
        SectionManager {
            requires_full_update: false,
            _section_count: 0,
            section_entities: vec![],
        }
    }
}

impl SectionManager {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SectionSettings {
    pub section_type: i32,
    pub is_generation_option: bool,
    pub source_object_handles: Vec<u32>,
    pub destination_object_handle: u32,
    pub destination_file_name: String,
    pub geometry_settings: Vec<SectionTypeSettings>,
}

impl Default for SectionSettings {
    fn default() -> SectionSettings {
        SectionSettings {
            section_type: 0,
            is_generation_option: false,
            source_object_handles: vec![],
            destination_object_handle: 0,
            destination_file_name: String::new(),
            geometry_settings: vec![],
        }
    }
}

impl SectionSettings {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SortentsTable {
    pub entities: Vec<u32>,
    pub sort_items: Vec<u32>,
}

impl Default for SortentsTable {
    fn default() -> SortentsTable {
        SortentsTable {
            entities: vec![],
            sort_items: vec![],
        }
    }
}

impl SortentsTable {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SpatialFilter {
    pub clip_boundary_definition_points: Vec<Point>,
    pub clip_boundary_normal: Vector,
    pub clip_boundary_origin: Point,
    pub is_clip_boundary_enabled: bool,
    pub is_front_clipping_plane: bool,
    pub front_clipping_plane_distance: f64,
    pub is_back_clipping_plane: bool,
    pub back_clipping_plane_distance: f64,
    pub inverse_transformation_matrix: TransformationMatrix,
    pub transformation_matrix: TransformationMatrix,
}

impl Default for SpatialFilter {
    fn default() -> SpatialFilter {
        SpatialFilter {
            clip_boundary_definition_points: vec![],
            clip_boundary_normal: Vector::z_axis(),
            clip_boundary_origin: Point::origin(),
            is_clip_boundary_enabled: false,
            is_front_clipping_plane: true,
            front_clipping_plane_distance: 0.0,
            is_back_clipping_plane: false,
            back_clipping_plane_distance: 0.0,
            inverse_transformation_matrix: TransformationMatrix::identity(),
            transformation_matrix: TransformationMatrix::identity(),
        }
    }
}

impl SpatialFilter {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SpatialIndex {
    pub timestamp: DateTime<Local>,
}

impl Default for SpatialIndex {
    fn default() -> SpatialIndex {
        SpatialIndex {
            timestamp: Local::now(),
        }
    }
}

impl SpatialIndex {
}

#[derive(Clone, Debug, PartialEq)]
pub struct SunStudy {
    pub version: i32,
    pub sun_setup_name: String,
    pub description: String,
    pub output_type: i16,
    pub sheet_set_name: String,
    pub use_subset: bool,
    pub sheet_subset_name: String,
    pub select_dates_from_calendar: bool,
    pub dates: Vec<DateTime<Local>>,
    pub select_range_of_dates: bool,
    pub start_time_seconds_past_midnight: i32,
    pub end_time_seconds_past_midnight: i32,
    pub interval_in_seconds: i32,
    pub hours: Vec<i32>,
    pub page_setup_wizard: u32,
    pub view: u32,
    pub visual_style: u32,
    pub shade_plot_type: i16,
    pub viewports_per_page: i32,
    pub viewport_distribution_row_count: i32,
    pub viewport_distribution_column_count: i32,
    pub spacing: f64,
    pub lock_viewports: bool,
    pub label_viewports: bool,
    pub text_style: u32,
}

impl Default for SunStudy {
    fn default() -> SunStudy {
        SunStudy {
            version: 0,
            sun_setup_name: String::new(),
            description: String::new(),
            output_type: 0,
            sheet_set_name: String::new(),
            use_subset: false,
            sheet_subset_name: String::new(),
            select_dates_from_calendar: false,
            dates: vec![],
            select_range_of_dates: false,
            start_time_seconds_past_midnight: 0,
            end_time_seconds_past_midnight: 0,
            interval_in_seconds: 0,
            hours: vec![],
            page_setup_wizard: 0,
            view: 0,
            visual_style: 0,
            shade_plot_type: 0,
            viewports_per_page: 0,
            viewport_distribution_row_count: 0,
            viewport_distribution_column_count: 0,
            spacing: 0.0,
            lock_viewports: false,
            label_viewports: false,
            text_style: 0,
        }
    }
}

impl SunStudy {
}

#[derive(Clone, Debug, PartialEq)]
pub struct TableStyle {
    pub version: Version,
    pub description: String,
    pub flow_direction: FlowDirection,
    pub flags: i32,
    pub horizontal_cell_margin: f64,
    pub vertical_cell_margin: f64,
    pub is_title_suppressed: bool,
    pub is_column_heading_suppressed: bool,
    pub cell_styles: Vec<TableCellStyle>,
}

impl Default for TableStyle {
    fn default() -> TableStyle {
        TableStyle {
            version: Version::R2010,
            description: String::new(),
            flow_direction: FlowDirection::Down,
            flags: 0,
            horizontal_cell_margin: 0.06,
            vertical_cell_margin: 0.06,
            is_title_suppressed: false,
            is_column_heading_suppressed: false,
            cell_styles: vec![],
        }
    }
}

impl TableStyle {
}

#[derive(Clone, Debug, PartialEq)]
pub struct UnderlayDefinition {
    pub file_name: String,
    pub name: String,
}

impl Default for UnderlayDefinition {
    fn default() -> UnderlayDefinition {
        UnderlayDefinition {
            file_name: String::new(),
            name: String::new(),
        }
    }
}

impl UnderlayDefinition {
}

#[derive(Clone, Debug, PartialEq)]
pub struct VbaProject {
    pub data: Vec<u8>,
    #[doc(hidden)]
    pub _hex_data: Vec<String>,
}

impl Default for VbaProject {
    fn default() -> VbaProject {
        VbaProject {
            data: vec![],
            _hex_data: vec![],
        }
    }
}

impl VbaProject {
}

#[derive(Clone, Debug, PartialEq)]
pub struct VisualStyle {
    pub description: String,
    pub type_code: i16,
    pub face_lighting_model: FaceLightingModel,
    pub face_lighting_quality: FaceLightingQuality,
    pub face_color_mode: FaceColorMode,
    pub face_modifier: FaceModifier,
    pub face_opacity_level: f64,
    pub face_specular_level: f64,
    pub color1: Color,
    pub color2: Color,
    pub face_style_mono_color: i32,
    pub edge_style_model: EdgeStyleModel,
    pub edge_style: i32,
    pub edge_intersection_color: Color,
    pub edge_obscured_color: Color,
    pub edge_obscured_line_type: i16,
    pub edge_intersection_line_type: i16,
    pub edge_crease_angle: f64,
    pub edge_modifiers: i32,
    pub edge_color: Color,
    pub edge_opacity_level: f64,
    pub edge_width: i16,
    pub edge_overhang: i16,
    pub edge_jitter: i16,
    pub edge_silhouette_color: Color,
    pub edge_silhouette_width: i16,
    pub edge_halo_gap: i16,
    pub edge_iso_line_count: i32,
    pub hide_edge_line_precision: bool,
    pub edge_style_apply_flags: i32,
    pub display_style_settings: i32,
    pub brightness: f64,
    pub shadow_type: i16,
    pub internal_flag: bool,
}

impl Default for VisualStyle {
    fn default() -> VisualStyle {
        VisualStyle {
            description: String::new(),
            type_code: 0,
            face_lighting_model: FaceLightingModel::Visible,
            face_lighting_quality: FaceLightingQuality::PerFace,
            face_color_mode: FaceColorMode::ObjectColor,
            face_modifier: FaceModifier::None,
            face_opacity_level: 0.0,
            face_specular_level: 0.0,
            color1: Color::by_block(),
            color2: Color::by_block(),
            face_style_mono_color: 0,
            edge_style_model: EdgeStyleModel::NoEdges,
            edge_style: 0,
            edge_intersection_color: Color::by_block(),
            edge_obscured_color: Color::by_block(),
            edge_obscured_line_type: 0,
            edge_intersection_line_type: 0,
            edge_crease_angle: 0.0,
            edge_modifiers: 0,
            edge_color: Color::by_block(),
            edge_opacity_level: 0.0,
            edge_width: 0,
            edge_overhang: 0,
            edge_jitter: 0,
            edge_silhouette_color: Color::by_block(),
            edge_silhouette_width: 0,
            edge_halo_gap: 0,
            edge_iso_line_count: 0,
            hide_edge_line_precision: false,
            edge_style_apply_flags: 0,
            display_style_settings: 0,
            brightness: 0.0,
            shadow_type: 0,
            internal_flag: false,
        }
    }
}

impl VisualStyle {
}

#[derive(Clone, Debug, PartialEq)]
pub struct WipeoutVariables {
    pub class_version: i32,
    pub display_image_frame: bool,
}

impl Default for WipeoutVariables {
    fn default() -> WipeoutVariables {
        WipeoutVariables {
            class_version: 0,
            display_image_frame: false,
        }
    }
}

impl WipeoutVariables {
}

#[derive(Clone, Debug, PartialEq)]
pub struct XRecordObject {
    pub duplicate_record_handling: DictionaryDuplicateRecordHandling,
    pub data_pairs: Vec<CodePair>,
}

impl Default for XRecordObject {
    fn default() -> XRecordObject {
        XRecordObject {
            duplicate_record_handling: DictionaryDuplicateRecordHandling::NotApplicable,
            data_pairs: vec![],
        }
    }
}

impl XRecordObject {
}

impl ObjectType {
    #[doc(hidden)]
    pub fn is_supported_on_version(&self, version: &AcadVersion) -> bool {
        match self {
            &ObjectType::AcadProxyObject(_) => { *version >= AcadVersion::R2000 },
            &ObjectType::DictionaryWithDefault(_) => { *version >= AcadVersion::R2000 },
            &ObjectType::PlaceHolder(_) => { *version >= AcadVersion::R2000 },
            &ObjectType::DataTable(_) => { *version >= AcadVersion::R2007 },
            &ObjectType::Dictionary(_) => { true },
            &ObjectType::DictionaryVariable(_) => { true },
            &ObjectType::DimensionAssoc(_) => { *version >= AcadVersion::R2004 },
            &ObjectType::Field(_) => { *version >= AcadVersion::R2004 },
            &ObjectType::GeoData(_) => { *version >= AcadVersion::R2010 },
            &ObjectType::Group(_) => { true },
            &ObjectType::IdBuffer(_) => { *version >= AcadVersion::R14 },
            &ObjectType::ImageDefinition(_) => { *version >= AcadVersion::R14 },
            &ObjectType::ImageDefinitionReactor(_) => { *version <= AcadVersion::R14 },
            &ObjectType::LayerFilter(_) => { *version <= AcadVersion::R2004 },
            &ObjectType::LayerIndex(_) => { *version <= AcadVersion::R14 },
            &ObjectType::Layout(_) => { *version <= AcadVersion::R2000 },
            &ObjectType::LightList(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::Material(_) => { *version <= AcadVersion::R2004 },
            &ObjectType::MLeaderStyle(_) => { *version >= AcadVersion::R2007 },
            &ObjectType::MLineStyle(_) => { true },
            &ObjectType::ObjectPointer(_) => { *version <= AcadVersion::R14 },
            &ObjectType::PlotSettings(_) => { *version <= AcadVersion::R2000 },
            &ObjectType::RasterVariables(_) => { *version <= AcadVersion::R14 },
            &ObjectType::MentalRayRenderSettings(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::RenderEnvironment(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::RenderGlobal(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::SectionManager(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::SectionSettings(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::SortentsTable(_) => { *version <= AcadVersion::R14 },
            &ObjectType::SpatialFilter(_) => { *version <= AcadVersion::R14 },
            &ObjectType::SpatialIndex(_) => { *version <= AcadVersion::R2000 },
            &ObjectType::SunStudy(_) => { *version >= AcadVersion::R2013 },
            &ObjectType::TableStyle(_) => { *version <= AcadVersion::R2004 },
            &ObjectType::UnderlayDefinition(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::VbaProject(_) => { *version <= AcadVersion::R2000 },
            &ObjectType::VisualStyle(_) => { *version <= AcadVersion::R2007 },
            &ObjectType::WipeoutVariables(_) => { *version <= AcadVersion::R2004 },
            &ObjectType::XRecordObject(_) => { *version >= AcadVersion::R14 },
        }
    }
    #[doc(hidden)]
    pub fn from_type_string(type_string: &str) -> Option<ObjectType> {
        match type_string {
            "ACAD_PROXY_OBJECT" => Some(ObjectType::AcadProxyObject(Default::default())),
            "ACDBDICTIONARYWDFLT" => Some(ObjectType::DictionaryWithDefault(Default::default())),
            "ACDBPLACEHOLDER" => Some(ObjectType::PlaceHolder(Default::default())),
            "DATATABLE" => Some(ObjectType::DataTable(Default::default())),
            "DICTIONARY" => Some(ObjectType::Dictionary(Default::default())),
            "DICTIONARYVAR" => Some(ObjectType::DictionaryVariable(Default::default())),
            "DIMASSOC" => Some(ObjectType::DimensionAssoc(Default::default())),
            "FIELD" => Some(ObjectType::Field(Default::default())),
            "GEODATA" => Some(ObjectType::GeoData(Default::default())),
            "GROUP" => Some(ObjectType::Group(Default::default())),
            "IDBUFFER" => Some(ObjectType::IdBuffer(Default::default())),
            "IMAGEDEF" => Some(ObjectType::ImageDefinition(Default::default())),
            "IMAGEDEF_REACTOR" => Some(ObjectType::ImageDefinitionReactor(Default::default())),
            "LAYER_FILTER" => Some(ObjectType::LayerFilter(Default::default())),
            "LAYER_INDEX" => Some(ObjectType::LayerIndex(Default::default())),
            "LAYOUT" => Some(ObjectType::Layout(Default::default())),
            "LIGHTLIST" => Some(ObjectType::LightList(Default::default())),
            "MATERIAL" => Some(ObjectType::Material(Default::default())),
            "MLEADERSTYLE" => Some(ObjectType::MLeaderStyle(Default::default())),
            "MLINESTYLE" => Some(ObjectType::MLineStyle(Default::default())),
            "OBJECT_PTR" => Some(ObjectType::ObjectPointer(Default::default())),
            "PLOTSETTINGS" => Some(ObjectType::PlotSettings(Default::default())),
            "RASTERVARIABLES" => Some(ObjectType::RasterVariables(Default::default())),
            "MENTALRAYRENDERSETTINGS" => Some(ObjectType::MentalRayRenderSettings(Default::default())),
            "RENDERENVIRONMENT" => Some(ObjectType::RenderEnvironment(Default::default())),
            "RENDERGLOBAL" => Some(ObjectType::RenderGlobal(Default::default())),
            "SECTIONMANAGER" => Some(ObjectType::SectionManager(Default::default())),
            "SECTIONSETTINGS" => Some(ObjectType::SectionSettings(Default::default())),
            "SORTENTSTABLE" => Some(ObjectType::SortentsTable(Default::default())),
            "SPATIAL_FILTER" => Some(ObjectType::SpatialFilter(Default::default())),
            "SPATIAL_INDEX" => Some(ObjectType::SpatialIndex(Default::default())),
            "SUNSTUDY" => Some(ObjectType::SunStudy(Default::default())),
            "TABLESTYLE" => Some(ObjectType::TableStyle(Default::default())),
            "UNDERLAYDEFINITION" => Some(ObjectType::UnderlayDefinition(Default::default())),
            "VBA_PROJECT" => Some(ObjectType::VbaProject(Default::default())),
            "VISUALSTYLE" => Some(ObjectType::VisualStyle(Default::default())),
            "WIPEOUTVARIABLES" => Some(ObjectType::WipeoutVariables(Default::default())),
            "XRECORD" => Some(ObjectType::XRecordObject(Default::default())),
            _ => None,
        }
    }
    #[doc(hidden)]
    pub fn to_type_string(&self) -> &str {
        match self {
            &ObjectType::AcadProxyObject(_) => { "ACAD_PROXY_OBJECT" },
            &ObjectType::DictionaryWithDefault(_) => { "ACDBDICTIONARYWDFLT" },
            &ObjectType::PlaceHolder(_) => { "ACDBPLACEHOLDER" },
            &ObjectType::DataTable(_) => { "DATATABLE" },
            &ObjectType::Dictionary(_) => { "DICTIONARY" },
            &ObjectType::DictionaryVariable(_) => { "DICTIONARYVAR" },
            &ObjectType::DimensionAssoc(_) => { "DIMASSOC" },
            &ObjectType::Field(_) => { "FIELD" },
            &ObjectType::GeoData(_) => { "GEODATA" },
            &ObjectType::Group(_) => { "GROUP" },
            &ObjectType::IdBuffer(_) => { "IDBUFFER" },
            &ObjectType::ImageDefinition(_) => { "IMAGEDEF" },
            &ObjectType::ImageDefinitionReactor(_) => { "IMAGEDEF_REACTOR" },
            &ObjectType::LayerFilter(_) => { "LAYER_FILTER" },
            &ObjectType::LayerIndex(_) => { "LAYER_INDEX" },
            &ObjectType::Layout(_) => { "LAYOUT" },
            &ObjectType::LightList(_) => { "LIGHTLIST" },
            &ObjectType::Material(_) => { "MATERIAL" },
            &ObjectType::MLeaderStyle(_) => { "MLEADERSTYLE" },
            &ObjectType::MLineStyle(_) => { "MLINESTYLE" },
            &ObjectType::ObjectPointer(_) => { "OBJECT_PTR" },
            &ObjectType::PlotSettings(_) => { "PLOTSETTINGS" },
            &ObjectType::RasterVariables(_) => { "RASTERVARIABLES" },
            &ObjectType::MentalRayRenderSettings(_) => { "MENTALRAYRENDERSETTINGS" },
            &ObjectType::RenderEnvironment(_) => { "RENDERENVIRONMENT" },
            &ObjectType::RenderGlobal(_) => { "RENDERGLOBAL" },
            &ObjectType::SectionManager(_) => { "SECTIONMANAGER" },
            &ObjectType::SectionSettings(_) => { "SECTIONSETTINGS" },
            &ObjectType::SortentsTable(_) => { "SORTENTSTABLE" },
            &ObjectType::SpatialFilter(_) => { "SPATIAL_FILTER" },
            &ObjectType::SpatialIndex(_) => { "SPATIAL_INDEX" },
            &ObjectType::SunStudy(_) => { "SUNSTUDY" },
            &ObjectType::TableStyle(_) => { "TABLESTYLE" },
            &ObjectType::UnderlayDefinition(_) => { "UNDERLAYDEFINITION" },
            &ObjectType::VbaProject(_) => { "VBA_PROJECT" },
            &ObjectType::VisualStyle(_) => { "VISUALSTYLE" },
            &ObjectType::WipeoutVariables(_) => { "WIPEOUTVARIABLES" },
            &ObjectType::XRecordObject(_) => { "XRECORD" },
        }
    }
    #[doc(hidden)]
    pub fn try_apply_code_pair(&mut self, pair: &CodePair) -> DxfResult<bool> {
        match self {
            &mut ObjectType::AcadProxyObject(ref mut obj) => {
                match pair.code {
                    90 => { obj.proxy_object_class_id = try!(pair.value.assert_i32()); },
                    91 => { obj.application_object_class_id = try!(pair.value.assert_i32()); },
                    93 => { obj.size_in_bits = try!(pair.value.assert_i32()); },
                    310 => { obj.binary_object_data.push(try!(pair.value.assert_string())); },
                    330 => { obj._object_ids_a.push(try!(pair.value.assert_string())); },
                    340 => { obj._object_ids_b.push(try!(pair.value.assert_string())); },
                    350 => { obj._object_ids_c.push(try!(pair.value.assert_string())); },
                    360 => { obj._object_ids_d.push(try!(pair.value.assert_string())); },
                    95 => { obj._object_drawing_format = try!(pair.value.assert_i32()) as u32; },
                    70 => { obj.is_original_object_format = as_bool(try!(pair.value.assert_i16())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::DictionaryWithDefault(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::PlaceHolder(ref mut _obj) => {
                match pair.code {
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::DataTable(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::Dictionary(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::DictionaryVariable(ref mut obj) => {
                match pair.code {
                    280 => { obj.object_schema_number = try!(pair.value.assert_i16()); },
                    1 => { obj.value = try!(pair.value.assert_string()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::DimensionAssoc(ref mut obj) => {
                match pair.code {
                    330 => { obj.dimension = try!(as_u32(try!(pair.value.assert_string()))); },
                    90 => { obj.associativity_flags = try!(pair.value.assert_i32()); },
                    70 => { obj.is_trans_space = as_bool(try!(pair.value.assert_i16())); },
                    71 => { obj.rotated_dimension_type = try_result!(RotatedDimensionType::from_i16(try!(pair.value.assert_i16()))); },
                    1 => { obj.class_name = try!(pair.value.assert_string()); },
                    72 => { obj.object_osnap_type = try_result!(ObjectOsnapType::from_i16(try!(pair.value.assert_i16()))); },
                    331 => { obj.main_object = try!(as_u32(try!(pair.value.assert_string()))); },
                    73 => { obj.main_object_subentity_type = try_result!(SubentityType::from_i16(try!(pair.value.assert_i16()))); },
                    91 => { obj.main_object_gs_marker_index = try!(pair.value.assert_i32()); },
                    301 => { obj.main_object_xref_handle = try!(pair.value.assert_string()); },
                    40 => { obj.near_osnap_geometry_parameter = try!(pair.value.assert_f64()); },
                    10 => { obj.osnap_point.x = try!(pair.value.assert_f64()); },
                    20 => { obj.osnap_point.y = try!(pair.value.assert_f64()); },
                    30 => { obj.osnap_point.z = try!(pair.value.assert_f64()); },
                    332 => { obj.intersection_object = try!(as_u32(try!(pair.value.assert_string()))); },
                    74 => { obj.intersection_subentity_type = try_result!(SubentityType::from_i16(try!(pair.value.assert_i16()))); },
                    92 => { obj.intersection_object_gs_marker_index = try!(pair.value.assert_i32()); },
                    302 => { obj.intersection_object_xref_handle = try!(pair.value.assert_string()); },
                    75 => { obj.has_last_point_reference = as_bool(try!(pair.value.assert_i16())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::Field(ref mut obj) => {
                match pair.code {
                    1 => { obj.evaluator_id = try!(pair.value.assert_string()); },
                    2 => { obj.field_code_string = try!(pair.value.assert_string()); },
                    3 => { obj.field_code_string_overflow = try!(pair.value.assert_string()); },
                    4 => { obj.format_string = try!(pair.value.assert_string()); },
                    300 => { obj.evaluation_error_message = try!(pair.value.assert_string()); },
                    90 => { obj._child_field_count = try!(pair.value.assert_i32()); },
                    360 => { obj.child_fields.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    91 => { obj.evaluation_option = try!(pair.value.assert_i32()); },
                    92 => { obj.filling_option = try!(pair.value.assert_i32()); },
                    94 => { obj.field_state = try!(pair.value.assert_i32()); },
                    95 => { obj.evaluation_status = try!(pair.value.assert_i32()); },
                    96 => { obj.evaluation_error_code = try!(pair.value.assert_i32()); },
                    97 => { obj._object_id_count = try!(pair.value.assert_i32()); },
                    331 => { obj.objects.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    93 => { obj._data_set_count = try!(pair.value.assert_i32()); },
                    6 => { obj.field_data_keys.push(try!(pair.value.assert_string())); },
                    7 => { obj.evaluated_cache_key = try!(pair.value.assert_string()); },
                    140 => { obj._double_value = try!(pair.value.assert_f64()); },
                    330 => { obj._id_value = try!(as_u32(try!(pair.value.assert_string()))); },
                    310 => { obj._binary_data = try!(pair.value.assert_string()); },
                    301 => { obj._format_string_code301 = try!(pair.value.assert_string()); },
                    9 => { obj._format_string_overflow = try!(pair.value.assert_string()); },
                    98 => { obj._format_string_length = try!(pair.value.assert_i32()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::GeoData(ref mut obj) => {
                match pair.code {
                    90 => { obj.version = try_result!(GeoDataVersion::from_i32(try!(pair.value.assert_i32()))); },
                    70 => { obj.coordinate_type = try_result!(DesignCoordinateType::from_i16(try!(pair.value.assert_i16()))); },
                    10 => { obj.design_point.x = try!(pair.value.assert_f64()); },
                    20 => { obj.design_point.y = try!(pair.value.assert_f64()); },
                    30 => { obj.design_point.z = try!(pair.value.assert_f64()); },
                    11 => { obj.reference_point.x = try!(pair.value.assert_f64()); },
                    21 => { obj.reference_point.y = try!(pair.value.assert_f64()); },
                    31 => { obj.reference_point.z = try!(pair.value.assert_f64()); },
                    12 => { obj.north_vector.x = try!(pair.value.assert_f64()); },
                    22 => { obj.north_vector.y = try!(pair.value.assert_f64()); },
                    40 => { obj.horizontal_unit_scale = try!(pair.value.assert_f64()); },
                    41 => { obj.vertical_unit_scale = try!(pair.value.assert_f64()); },
                    91 => { obj.horizontal_units = try_result!(Units::from_i32(try!(pair.value.assert_i32()))); },
                    92 => { obj.vertical_units = try_result!(Units::from_i32(try!(pair.value.assert_i32()))); },
                    210 => { obj.up_direction.x = try!(pair.value.assert_f64()); },
                    220 => { obj.up_direction.y = try!(pair.value.assert_f64()); },
                    230 => { obj.up_direction.z = try!(pair.value.assert_f64()); },
                    95 => { obj.scale_estimation_method = try_result!(ScaleEstimationMethod::from_i32(try!(pair.value.assert_i32()))); },
                    294 => { obj.use_sea_level_correction = try!(pair.value.assert_bool()); },
                    141 => { obj.user_specified_scale_factor = try!(pair.value.assert_f64()); },
                    142 => { obj.sea_level_elevation = try!(pair.value.assert_f64()); },
                    143 => { obj.coordinate_projection_radius = try!(pair.value.assert_f64()); },
                    301 => { obj.coordinate_system_definition = try!(pair.value.assert_string()); },
                    302 => { obj.geo_rss_tag = try!(pair.value.assert_string()); },
                    305 => { obj.observation_from_tag = try!(pair.value.assert_string()); },
                    306 => { obj.observation_to_tag = try!(pair.value.assert_string()); },
                    307 => { obj.observation_coverage_tag = try!(pair.value.assert_string()); },
                    93 => { obj._geo_mesh_point_count = try!(pair.value.assert_i32()); },
                    13 => { obj._source_mesh_x_points.push(try!(pair.value.assert_f64())); },
                    23 => { obj._source_mesh_y_points.push(try!(pair.value.assert_f64())); },
                    14 => { obj._destination_mesh_x_points.push(try!(pair.value.assert_f64())); },
                    24 => { obj._destination_mesh_y_points.push(try!(pair.value.assert_f64())); },
                    96 => { obj._faces_count = try!(pair.value.assert_i32()); },
                    97 => { obj._face_point_index_x.push(try!(pair.value.assert_i32()) as f64); },
                    98 => { obj._face_point_index_y.push(try!(pair.value.assert_i32()) as f64); },
                    99 => { obj._face_point_index_z.push(try!(pair.value.assert_i32()) as f64); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::Group(ref mut obj) => {
                match pair.code {
                    300 => { obj.description = try!(pair.value.assert_string()); },
                    70 => { obj.is_named = !as_bool(try!(pair.value.assert_i16())); },
                    71 => { obj.is_selectable = as_bool(try!(pair.value.assert_i16())); },
                    340 => { obj.entities.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::IdBuffer(ref mut obj) => {
                match pair.code {
                    330 => { obj.entities.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::ImageDefinition(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    1 => { obj.file_path = try!(pair.value.assert_string()); },
                    10 => { obj.image_width = try!(pair.value.assert_f64()) as i32; },
                    20 => { obj.image_height = try!(pair.value.assert_f64()) as i32; },
                    11 => { obj.pixel_width = try!(pair.value.assert_f64()); },
                    12 => { obj.pixel_height = try!(pair.value.assert_f64()); },
                    280 => { obj.is_image_loaded = as_bool(try!(pair.value.assert_i16())); },
                    281 => { obj.resolution_units = try_result!(ImageResolutionUnits::from_i16(try!(pair.value.assert_i16()))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::ImageDefinitionReactor(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::LayerFilter(ref mut obj) => {
                match pair.code {
                    8 => { obj.layer_names.push(try!(pair.value.assert_string())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::LayerIndex(ref mut obj) => {
                match pair.code {
                    40 => { obj.time_stamp = as_datetime_local(try!(pair.value.assert_f64())); },
                    8 => { obj.layer_names.push(try!(pair.value.assert_string())); },
                    360 => { obj.id_buffers.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    90 => { obj.id_buffer_counts.push(try!(pair.value.assert_i32())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::Layout(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::LightList(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::Material(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::MLeaderStyle(ref mut obj) => {
                match pair.code {
                    170 => { obj.content_type = try!(pair.value.assert_i16()); },
                    171 => { obj.draw_m_leader_order_type = try!(pair.value.assert_i16()); },
                    172 => { obj.draw_leader_order_type = try!(pair.value.assert_i16()); },
                    90 => { obj.max_leader_segment_count = try!(pair.value.assert_i32()); },
                    40 => { obj.first_segment_angle_constraint = try!(pair.value.assert_f64()); },
                    41 => { obj.second_segment_angle_constraint = try!(pair.value.assert_f64()); },
                    173 => { obj.leader_line_type = try!(pair.value.assert_i16()); },
                    91 => { obj.leader_line_color = try!(pair.value.assert_i32()); },
                    340 => { obj.line_leader_type = try!(as_u32(try!(pair.value.assert_string()))); },
                    92 => { obj.leader_line_weight = try!(pair.value.assert_i32()); },
                    290 => { obj.enable_landing = try!(pair.value.assert_bool()); },
                    42 => { obj.landing_gap = try!(pair.value.assert_f64()); },
                    291 => { obj.enable_dogleg = try!(pair.value.assert_bool()); },
                    43 => { obj.dogleg_length = try!(pair.value.assert_f64()); },
                    3 => { obj.m_leader_style_description = try!(pair.value.assert_string()); },
                    341 => { obj.arrowhead = try!(as_u32(try!(pair.value.assert_string()))); },
                    44 => { obj.arrowhead_size = try!(pair.value.assert_f64()); },
                    300 => { obj.default_m_text_contents = try!(pair.value.assert_string()); },
                    342 => { obj.m_text_style = try!(as_u32(try!(pair.value.assert_string()))); },
                    174 => { obj.text_left_attachment_type = try!(pair.value.assert_i16()); },
                    175 => { obj.text_angle_type = try!(pair.value.assert_i16()); },
                    176 => { obj.text_alignment_type = try!(pair.value.assert_i16()); },
                    178 => { obj.text_right_attachment_type = try!(pair.value.assert_i16()); },
                    93 => { obj.text_color = try!(pair.value.assert_i32()); },
                    45 => { obj.text_height = try!(pair.value.assert_f64()); },
                    292 => { obj.enable_frame_text = try!(pair.value.assert_bool()); },
                    297 => { obj.always_align_text_left = try!(pair.value.assert_bool()); },
                    46 => { obj.align_gap = try!(pair.value.assert_f64()); },
                    343 => { obj.block_content = try!(as_u32(try!(pair.value.assert_string()))); },
                    94 => { obj.block_content_color = try!(pair.value.assert_i32()); },
                    47 => { obj.block_content_x_scale = try!(pair.value.assert_f64()); },
                    49 => { obj.block_content_y_scale = try!(pair.value.assert_f64()); },
                    140 => { obj.block_content_z_scale = try!(pair.value.assert_f64()); },
                    293 => { obj.enable_block_content_scale = try!(pair.value.assert_bool()); },
                    141 => { obj.block_content_rotation = try!(pair.value.assert_f64()); },
                    294 => { obj.enable_block_content_rotation = try!(pair.value.assert_bool()); },
                    177 => { obj.block_content_connection_type = try!(pair.value.assert_i16()); },
                    142 => { obj.scale = try!(pair.value.assert_f64()); },
                    295 => { obj.overwrite_field_value = try!(pair.value.assert_bool()); },
                    296 => { obj.is_annotative = try!(pair.value.assert_bool()); },
                    143 => { obj.break_gap_size = try!(pair.value.assert_f64()); },
                    271 => { obj.text_attachment_direction = try_result!(TextAttachmentDirection::from_i16(try!(pair.value.assert_i16()))); },
                    272 => { obj.bottom_text_attachment_direction = try_result!(BottomTextAttachmentDirection::from_i16(try!(pair.value.assert_i16()))); },
                    273 => { obj.top_text_attachment_direction = try_result!(TopTextAttachmentDirection::from_i16(try!(pair.value.assert_i16()))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::MLineStyle(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::ObjectPointer(ref mut _obj) => {
                match pair.code {
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::PlotSettings(ref mut obj) => {
                match pair.code {
                    1 => { obj.page_setup_name = try!(pair.value.assert_string()); },
                    2 => { obj.printer_name = try!(pair.value.assert_string()); },
                    4 => { obj.paper_size = try!(pair.value.assert_string()); },
                    6 => { obj.plot_view_name = try!(pair.value.assert_string()); },
                    40 => { obj.unprintable_left_margin_size = try!(pair.value.assert_f64()); },
                    41 => { obj.unprintable_bottom_margin_size = try!(pair.value.assert_f64()); },
                    42 => { obj.unprintable_right_margin_size = try!(pair.value.assert_f64()); },
                    43 => { obj.unprintable_top_margin_size = try!(pair.value.assert_f64()); },
                    44 => { obj.paper_width = try!(pair.value.assert_f64()); },
                    45 => { obj.paper_height = try!(pair.value.assert_f64()); },
                    46 => { obj.plot_origin_x_value = try!(pair.value.assert_f64()); },
                    47 => { obj.plot_origin_y_value = try!(pair.value.assert_f64()); },
                    48 => { obj.plot_window_lower_left_x_value = try!(pair.value.assert_f64()); },
                    49 => { obj.plot_window_lower_left_y_value = try!(pair.value.assert_f64()); },
                    140 => { obj.plot_window_upper_right_x_value = try!(pair.value.assert_f64()); },
                    141 => { obj.plot_window_upper_right_y_value = try!(pair.value.assert_f64()); },
                    142 => { obj.custom_print_scale_numerator = try!(pair.value.assert_f64()); },
                    143 => { obj.custom_print_scale_denominator = try!(pair.value.assert_f64()); },
                    70 => { obj.plot_layout_flags = try!(pair.value.assert_i16()) as i32; },
                    72 => { obj.plot_paper_units = try_result!(PlotPaperUnits::from_i16(try!(pair.value.assert_i16()))); },
                    73 => { obj.plot_rotation = try_result!(PlotRotation::from_i16(try!(pair.value.assert_i16()))); },
                    74 => { obj.plot_type = try_result!(PlotType::from_i16(try!(pair.value.assert_i16()))); },
                    7 => { obj.current_style_sheet = try!(pair.value.assert_string()); },
                    75 => { obj.standard_scale = try_result!(StandardScale::from_i16(try!(pair.value.assert_i16()))); },
                    76 => { obj.shade_plot_mode = try_result!(ShadePlotMode::from_i16(try!(pair.value.assert_i16()))); },
                    77 => { obj.shade_plot_resolution_level = try_result!(ShadePlotResolutionLevel::from_i16(try!(pair.value.assert_i16()))); },
                    78 => { obj.shade_plot_custom_dpi = try!(pair.value.assert_i16()) as i32; },
                    147 => { obj.standard_scale_value = try!(pair.value.assert_f64()); },
                    148 => { obj.paper_image_origin_x = try!(pair.value.assert_f64()); },
                    149 => { obj.paper_image_origin_y = try!(pair.value.assert_f64()); },
                    333 => { obj.shade_plot_object = try!(as_u32(try!(pair.value.assert_string()))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::RasterVariables(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    70 => { obj.is_display_frame_image = as_bool(try!(pair.value.assert_i16())); },
                    71 => { obj.is_high_display_quality = as_bool(try!(pair.value.assert_i16())); },
                    72 => { obj.image_units = try_result!(RasterImageUnits::from_i16(try!(pair.value.assert_i16()))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::MentalRayRenderSettings(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version_1 = try!(pair.value.assert_i32()); },
                    1 => { obj.preset_name = try!(pair.value.assert_string()); },
                    290 => { obj.render_materials = try!(pair.value.assert_bool()); },
                    70 => { obj.sampling_filter_type = try_result!(SamplingFilterType::from_i16(try!(pair.value.assert_i16()))); },
                    40 => { obj.filter_width = try!(pair.value.assert_f64()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::RenderEnvironment(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    290 => { obj.is_fog_enabled = try!(pair.value.assert_bool()); },
                    280 => { obj.fog_color_red = try!(pair.value.assert_i16()) as i32; },
                    40 => { obj.near_fog_density_percent = try!(pair.value.assert_f64()); },
                    1 => { obj.environment_image_file_name = try!(pair.value.assert_string()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::RenderGlobal(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    290 => { obj.save_to_file = try!(pair.value.assert_bool()); },
                    1 => { obj.save_to_file_name = try!(pair.value.assert_string()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::SectionManager(ref mut obj) => {
                match pair.code {
                    70 => { obj.requires_full_update = as_bool(try!(pair.value.assert_i16())); },
                    90 => { obj._section_count = try!(pair.value.assert_i32()); },
                    330 => { obj.section_entities.push(try!(as_u32(try!(pair.value.assert_string())))); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::SectionSettings(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::SortentsTable(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::SpatialFilter(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::SpatialIndex(ref mut obj) => {
                match pair.code {
                    40 => { obj.timestamp = as_datetime_local(try!(pair.value.assert_f64())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::SunStudy(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::TableStyle(_) => { panic!("this case should have been covered in a custom reader"); },
            &mut ObjectType::UnderlayDefinition(ref mut obj) => {
                match pair.code {
                    1 => { obj.file_name = try!(pair.value.assert_string()); },
                    2 => { obj.name = try!(pair.value.assert_string()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::VbaProject(ref mut obj) => {
                match pair.code {
                    310 => { obj._hex_data.push(try!(pair.value.assert_string())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::VisualStyle(ref mut obj) => {
                match pair.code {
                    2 => { obj.description = try!(pair.value.assert_string()); },
                    70 => { obj.type_code = try!(pair.value.assert_i16()); },
                    71 => { obj.face_lighting_model = try_result!(FaceLightingModel::from_i16(try!(pair.value.assert_i16()))); },
                    72 => { obj.face_lighting_quality = try_result!(FaceLightingQuality::from_i16(try!(pair.value.assert_i16()))); },
                    73 => { obj.face_color_mode = try_result!(FaceColorMode::from_i16(try!(pair.value.assert_i16()))); },
                    90 => { obj.face_modifier = try_result!(FaceModifier:: from_i32(try!(pair.value.assert_i32()))); },
                    40 => { obj.face_opacity_level = try!(pair.value.assert_f64()); },
                    41 => { obj.face_specular_level = try!(pair.value.assert_f64()); },
                    62 => { obj.color1 = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    63 => { obj.color2 = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    421 => { obj.face_style_mono_color = try!(pair.value.assert_i32()); },
                    74 => { obj.edge_style_model = try_result!(EdgeStyleModel::from_i16(try!(pair.value.assert_i16()))); },
                    91 => { obj.edge_style = try!(pair.value.assert_i32()); },
                    64 => { obj.edge_intersection_color = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    65 => { obj.edge_obscured_color = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    75 => { obj.edge_obscured_line_type = try!(pair.value.assert_i16()); },
                    175 => { obj.edge_intersection_line_type = try!(pair.value.assert_i16()); },
                    42 => { obj.edge_crease_angle = try!(pair.value.assert_f64()); },
                    92 => { obj.edge_modifiers = try!(pair.value.assert_i32()); },
                    66 => { obj.edge_color = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    43 => { obj.edge_opacity_level = try!(pair.value.assert_f64()); },
                    76 => { obj.edge_width = try!(pair.value.assert_i16()); },
                    77 => { obj.edge_overhang = try!(pair.value.assert_i16()); },
                    78 => { obj.edge_jitter = try!(pair.value.assert_i16()); },
                    67 => { obj.edge_silhouette_color = Color::from_raw_value(try!(pair.value.assert_i16())); },
                    79 => { obj.edge_silhouette_width = try!(pair.value.assert_i16()); },
                    170 => { obj.edge_halo_gap = try!(pair.value.assert_i16()); },
                    171 => { obj.edge_iso_line_count = try!(pair.value.assert_i16()) as i32; },
                    290 => { obj.hide_edge_line_precision = try!(pair.value.assert_bool()); },
                    174 => { obj.edge_style_apply_flags = try!(pair.value.assert_i16()) as i32; },
                    93 => { obj.display_style_settings = try!(pair.value.assert_i32()); },
                    44 => { obj.brightness = try!(pair.value.assert_f64()); },
                    173 => { obj.shadow_type = try!(pair.value.assert_i16()); },
                    291 => { obj.internal_flag = try!(pair.value.assert_bool()); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::WipeoutVariables(ref mut obj) => {
                match pair.code {
                    90 => { obj.class_version = try!(pair.value.assert_i32()); },
                    70 => { obj.display_image_frame = as_bool(try!(pair.value.assert_i16())); },
                    _ => return Ok(false),
                }
            },
            &mut ObjectType::XRecordObject(_) => { panic!("this case should have been covered in a custom reader"); },
        }
        return Ok(true);
    }
    #[doc(hidden)]
    pub fn write<T>(&self, version: &AcadVersion, writer: &mut CodePairWriter<T>) -> DxfResult<()>
        where T: Write {

        match self {
            &ObjectType::AcadProxyObject(ref obj) => {
                if *version >= AcadVersion::R13 {
                    try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbProxyObject"))));
                }
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.proxy_object_class_id)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.application_object_class_id)));
                try!(writer.write_code_pair(&CodePair::new_i32(93, obj.size_in_bits)));
                for v in &obj.binary_object_data {
                    try!(writer.write_code_pair(&CodePair::new_string(310, &&v)));
                }
                for item in &obj.object_ids {
                    try!(writer.write_code_pair(&CodePair::new_string(330, item)));
                }
                try!(writer.write_code_pair(&CodePair::new_i32(94, 0)));
                try!(writer.write_code_pair(&CodePair::new_i32(95, obj._object_drawing_format as i32)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.is_original_object_format))));
            },
            &ObjectType::DictionaryWithDefault(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::PlaceHolder(ref _obj) => {
            },
            &ObjectType::DataTable(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::Dictionary(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::DictionaryVariable(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "DictionaryVariables")));
                try!(writer.write_code_pair(&CodePair::new_i16(280, obj.object_schema_number)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.value)));
            },
            &ObjectType::DimensionAssoc(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbDimAssoc")));
                try!(writer.write_code_pair(&CodePair::new_string(330, &as_handle(obj.dimension))));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.associativity_flags)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.is_trans_space))));
                try!(writer.write_code_pair(&CodePair::new_i16(71, obj.rotated_dimension_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.class_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(72, obj.object_osnap_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_string(331, &as_handle(obj.main_object))));
                try!(writer.write_code_pair(&CodePair::new_i16(73, obj.main_object_subentity_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.main_object_gs_marker_index)));
                try!(writer.write_code_pair(&CodePair::new_string(301, &obj.main_object_xref_handle)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.near_osnap_geometry_parameter)));
                try!(writer.write_code_pair(&CodePair::new_f64(10, obj.osnap_point.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(20, obj.osnap_point.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(30, obj.osnap_point.z)));
                try!(writer.write_code_pair(&CodePair::new_string(332, &as_handle(obj.intersection_object))));
                try!(writer.write_code_pair(&CodePair::new_i16(74, obj.intersection_subentity_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(92, obj.intersection_object_gs_marker_index)));
                try!(writer.write_code_pair(&CodePair::new_string(302, &obj.intersection_object_xref_handle)));
                try!(writer.write_code_pair(&CodePair::new_i16(75, as_i16(obj.has_last_point_reference))));
            },
            &ObjectType::Field(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.evaluator_id)));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.field_code_string)));
                try!(writer.write_code_pair(&CodePair::new_string(3, &obj.field_code_string_overflow)));
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(4, &obj.format_string)));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(300, &obj.evaluation_error_message)));
                }
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.child_fields.len() as i32)));
                for v in &obj.child_fields {
                    try!(writer.write_code_pair(&CodePair::new_string(360, &as_handle(*v))));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(91, obj.evaluation_option)));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(92, obj.filling_option)));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(94, obj.field_state)));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(95, obj.evaluation_status)));
                }
                if *version <= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(96, obj.evaluation_error_code)));
                }
                try!(writer.write_code_pair(&CodePair::new_i32(97, obj.objects.len() as i32)));
                try!(writer.write_code_pair(&CodePair::new_i32(93, obj.field_data_keys.len() as i32)));
                for v in &obj.field_data_keys {
                    try!(writer.write_code_pair(&CodePair::new_string(6, &&v)));
                }
                try!(writer.write_code_pair(&CodePair::new_string(7, &obj.evaluated_cache_key)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj._value_type_code)));
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_string(301, &obj.format_string)));
                }
                try!(writer.write_code_pair(&CodePair::new_string(9, &obj._format_string_overflow)));
                try!(writer.write_code_pair(&CodePair::new_i32(98, obj.format_string.len() as i32)));
            },
            &ObjectType::GeoData(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.version as i32)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.coordinate_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(10, obj.design_point.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(20, obj.design_point.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(30, obj.design_point.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(11, obj.reference_point.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(21, obj.reference_point.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(31, obj.reference_point.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(12, obj.north_vector.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(22, obj.north_vector.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.horizontal_unit_scale)));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.vertical_unit_scale)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.horizontal_units as i32)));
                try!(writer.write_code_pair(&CodePair::new_i32(92, obj.vertical_units as i32)));
                try!(writer.write_code_pair(&CodePair::new_f64(210, obj.up_direction.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(220, obj.up_direction.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(230, obj.up_direction.z)));
                try!(writer.write_code_pair(&CodePair::new_i32(95, obj.scale_estimation_method as i32)));
                try!(writer.write_code_pair(&CodePair::new_bool(294, obj.use_sea_level_correction)));
                try!(writer.write_code_pair(&CodePair::new_f64(141, obj.user_specified_scale_factor)));
                try!(writer.write_code_pair(&CodePair::new_f64(142, obj.sea_level_elevation)));
                try!(writer.write_code_pair(&CodePair::new_f64(143, obj.coordinate_projection_radius)));
                try!(writer.write_code_pair(&CodePair::new_string(301, &obj.coordinate_system_definition)));
                try!(writer.write_code_pair(&CodePair::new_string(302, &obj.geo_rss_tag)));
                try!(writer.write_code_pair(&CodePair::new_string(305, &obj.observation_from_tag)));
                try!(writer.write_code_pair(&CodePair::new_string(306, &obj.observation_to_tag)));
                try!(writer.write_code_pair(&CodePair::new_string(307, &obj.observation_coverage_tag)));
                try!(writer.write_code_pair(&CodePair::new_i32(93, obj.geo_mesh_points.len() as i32)));
                for item in &obj.geo_mesh_points {
                    try!(writer.write_code_pair(&CodePair::new_f64(13, item.source.x)));
                    try!(writer.write_code_pair(&CodePair::new_f64(23, item.source.y)));
                    try!(writer.write_code_pair(&CodePair::new_f64(14, item.destination.x)));
                    try!(writer.write_code_pair(&CodePair::new_f64(24, item.destination.y)));
                }
                try!(writer.write_code_pair(&CodePair::new_i32(96, obj.face_indices.len() as i32)));
                for item in &obj.face_indices {
                    try!(writer.write_code_pair(&CodePair::new_i32(97, item.x as i32)));
                    try!(writer.write_code_pair(&CodePair::new_i32(98, item.y as i32)));
                    try!(writer.write_code_pair(&CodePair::new_i32(99, item.z as i32)));
                }
            },
            &ObjectType::Group(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbGroup")));
                try!(writer.write_code_pair(&CodePair::new_string(300, &obj.description)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(!obj.is_named))));
                try!(writer.write_code_pair(&CodePair::new_i16(71, as_i16(obj.is_selectable))));
                for v in &obj.entities {
                    try!(writer.write_code_pair(&CodePair::new_string(340, &as_handle(*v))));
                }
            },
            &ObjectType::IdBuffer(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbIdBuffer")));
                for v in &obj.entities {
                    try!(writer.write_code_pair(&CodePair::new_string(330, &as_handle(*v))));
                }
            },
            &ObjectType::ImageDefinition(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRasterImageDef")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.file_path)));
                try!(writer.write_code_pair(&CodePair::new_f64(10, obj.image_width as f64)));
                try!(writer.write_code_pair(&CodePair::new_f64(20, obj.image_height as f64)));
                try!(writer.write_code_pair(&CodePair::new_f64(11, obj.pixel_width)));
                try!(writer.write_code_pair(&CodePair::new_f64(12, obj.pixel_height)));
                try!(writer.write_code_pair(&CodePair::new_i16(280, as_i16(obj.is_image_loaded))));
                try!(writer.write_code_pair(&CodePair::new_i16(281, obj.resolution_units as i16)));
            },
            &ObjectType::ImageDefinitionReactor(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRasterImageDefReactor")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
            },
            &ObjectType::LayerFilter(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbFilter"))));
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbLayerFilter"))));
                for v in &obj.layer_names {
                    try!(writer.write_code_pair(&CodePair::new_string(8, &&v)));
                }
            },
            &ObjectType::LayerIndex(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbIndex"))));
                try!(writer.write_code_pair(&CodePair::new_f64(40, as_double_local(obj.time_stamp))));
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbLayerIndex"))));
                for v in &obj.layer_names {
                    try!(writer.write_code_pair(&CodePair::new_string(8, &&v)));
                }
                for v in &obj.id_buffers {
                    try!(writer.write_code_pair(&CodePair::new_string(360, &as_handle(*v))));
                }
                for v in &obj.id_buffer_counts {
                    try!(writer.write_code_pair(&CodePair::new_i32(90, *v)));
                }
            },
            &ObjectType::Layout(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbLayout")));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.layout_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.layout_flags as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, obj.tab_order as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(10, obj.minimum_limits.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(20, obj.minimum_limits.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(11, obj.maximum_limits.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(21, obj.maximum_limits.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(12, obj.insertion_base_point.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(22, obj.insertion_base_point.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(32, obj.insertion_base_point.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(14, obj.minimum_extents.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(24, obj.minimum_extents.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(34, obj.minimum_extents.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(15, obj.maximum_extents.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(25, obj.maximum_extents.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(35, obj.maximum_extents.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(146, obj.elevation)));
                try!(writer.write_code_pair(&CodePair::new_f64(13, obj.ucs_origin.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(23, obj.ucs_origin.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(33, obj.ucs_origin.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(16, obj.ucs_x_axis.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(26, obj.ucs_x_axis.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(36, obj.ucs_x_axis.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(17, obj.ucs_y_axis.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(27, obj.ucs_y_axis.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(37, obj.ucs_y_axis.z)));
                try!(writer.write_code_pair(&CodePair::new_i16(76, obj.ucs_orthographic_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_string(330, &as_handle(obj.viewport))));
                try!(writer.write_code_pair(&CodePair::new_string(345, &as_handle(obj.table_record))));
                try!(writer.write_code_pair(&CodePair::new_string(346, &as_handle(obj.table_record_base))));
            },
            &ObjectType::LightList(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::Material(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.name)));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.description)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.override_ambient_color))));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.ambient_color_factor)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.ambient_color_value)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, as_i16(obj.override_diffuse_color))));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.diffuse_color_factor)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.diffuse_color_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(42, obj.diffuse_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(72, as_i16(obj.use_image_file_for_diffuse_map))));
                try!(writer.write_code_pair(&CodePair::new_string(3, &obj.diffuse_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(73, obj.diffuse_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(74, obj.diffuse_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(75, obj.diffuse_map_auto_transform_method as i16)));
                for item in &obj.diffuse_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(43, *item)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(45, obj.specular_color_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(76, as_i16(obj.override_specular_color))));
                try!(writer.write_code_pair(&CodePair::new_f64(45, obj.specular_color_factor)));
                try!(writer.write_code_pair(&CodePair::new_i32(92, obj.specular_color_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(46, obj.specular_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(77, as_i16(obj.use_image_file_for_specular_map))));
                try!(writer.write_code_pair(&CodePair::new_string(4, &obj.specular_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(78, obj.specular_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(79, obj.specular_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(170, obj.specular_map_auto_transform_method as i16)));
                for item in &obj.specular_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(47, *item)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(48, obj.reflection_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(171, as_i16(obj.use_image_file_for_reflection_map))));
                try!(writer.write_code_pair(&CodePair::new_string(6, &obj.reflection_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(172, obj.reflection_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(173, obj.reflection_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(174, obj.reflection_map_auto_transform_method as i16)));
                for item in &obj.reflection_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(49, *item)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(140, obj.opacity_factor)));
                try!(writer.write_code_pair(&CodePair::new_f64(141, obj.opacity_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(175, as_i16(obj.use_image_file_for_opacity_map))));
                try!(writer.write_code_pair(&CodePair::new_string(7, &obj.opacity_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(176, obj.opacity_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(177, obj.opacity_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(178, obj.opacity_map_auto_transform_method as i16)));
                for item in &obj.opacity_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(142, *item)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(143, obj.bump_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(179, as_i16(obj.use_image_file_for_bump_map))));
                try!(writer.write_code_pair(&CodePair::new_string(8, &obj.bump_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(270, obj.bump_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(271, obj.bump_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(272, obj.bump_map_auto_transform_method as i16)));
                for item in &obj.bump_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(144, *item)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(145, obj.refraction_index)));
                try!(writer.write_code_pair(&CodePair::new_f64(146, obj.refraction_map_blend_factor)));
                try!(writer.write_code_pair(&CodePair::new_i16(273, as_i16(obj.use_image_file_for_refraction_map))));
                try!(writer.write_code_pair(&CodePair::new_string(9, &obj.refraction_map_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(274, obj.refraction_map_projection_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(275, obj.refraction_map_tiling_method as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(276, obj.refraction_map_auto_transform_method as i16)));
                for item in &obj.refraction_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(147, *item)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(460, obj.color_bleed_scale)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(461, obj.indirect_dump_scale)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(462, obj.reflectance_scale)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(463, obj.transmittance_scale)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_bool(290, obj.is_two_sided)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(464, obj.luminance)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(270, obj.luminance_mode)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(271, obj.normal_map_method)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(465, obj.normal_map_strength)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(42, obj.normal_map_blend_factor)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(72, as_i16(obj.use_image_file_for_normal_map))));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(3, &obj.normal_map_file_name)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(73, obj.normal_map_projection_method as i16)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(74, obj.normal_map_tiling_method as i16)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(75, obj.normal_map_auto_transform_method as i16)));
                }
                for item in &obj.normal_map_transformation_matrix.get_values() {
                    try!(writer.write_code_pair(&CodePair::new_f64(43, *item)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_bool(293, obj.is_anonymous)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(272, obj.global_illumination_mode)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(273, obj.final_gather_mode)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(300, &obj.gen_proc_name)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_bool(291, obj.gen_proc_boolean_value)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(271, obj.gen_proc_integer_value)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_f64(469, obj.gen_proc_real_value)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(301, &obj.gen_proc_text_value)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_bool(292, obj.gen_proc_table_end)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(62, obj.gen_proc_color_index_value.get_raw_value())));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i32(420, obj.gen_proc_color_rgb_value)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_string(430, &obj.gen_proc_color_name)));
                }
                if *version >= AcadVersion::R2007 {
                    try!(writer.write_code_pair(&CodePair::new_i16(270, obj.map_u_tile)));
                }
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_f64(148, obj.translucence)));
                }
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_i32(90, obj.self_illumination)));
                }
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_f64(468, obj.reflectivity)));
                }
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_i32(93, obj.illumination_model)));
                }
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_i32(94, obj.channel_flags)));
                }
            },
            &ObjectType::MLeaderStyle(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbMLeaderStyle")));
                try!(writer.write_code_pair(&CodePair::new_i16(170, obj.content_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(171, obj.draw_m_leader_order_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(172, obj.draw_leader_order_type)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.max_leader_segment_count)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.first_segment_angle_constraint)));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.second_segment_angle_constraint)));
                try!(writer.write_code_pair(&CodePair::new_i16(173, obj.leader_line_type)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.leader_line_color)));
                try!(writer.write_code_pair(&CodePair::new_string(340, &as_handle(obj.line_leader_type))));
                try!(writer.write_code_pair(&CodePair::new_i32(92, obj.leader_line_weight)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.enable_landing)));
                try!(writer.write_code_pair(&CodePair::new_f64(42, obj.landing_gap)));
                try!(writer.write_code_pair(&CodePair::new_bool(291, obj.enable_dogleg)));
                try!(writer.write_code_pair(&CodePair::new_f64(43, obj.dogleg_length)));
                try!(writer.write_code_pair(&CodePair::new_string(3, &obj.m_leader_style_description)));
                try!(writer.write_code_pair(&CodePair::new_string(341, &as_handle(obj.arrowhead))));
                try!(writer.write_code_pair(&CodePair::new_f64(44, obj.arrowhead_size)));
                try!(writer.write_code_pair(&CodePair::new_string(300, &obj.default_m_text_contents)));
                try!(writer.write_code_pair(&CodePair::new_string(342, &as_handle(obj.m_text_style))));
                try!(writer.write_code_pair(&CodePair::new_i16(174, obj.text_left_attachment_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(175, obj.text_angle_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(176, obj.text_alignment_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(178, obj.text_right_attachment_type)));
                try!(writer.write_code_pair(&CodePair::new_i32(93, obj.text_color)));
                try!(writer.write_code_pair(&CodePair::new_f64(45, obj.text_height)));
                try!(writer.write_code_pair(&CodePair::new_bool(292, obj.enable_frame_text)));
                try!(writer.write_code_pair(&CodePair::new_bool(297, obj.always_align_text_left)));
                try!(writer.write_code_pair(&CodePair::new_f64(46, obj.align_gap)));
                try!(writer.write_code_pair(&CodePair::new_string(343, &as_handle(obj.block_content))));
                try!(writer.write_code_pair(&CodePair::new_i32(94, obj.block_content_color)));
                try!(writer.write_code_pair(&CodePair::new_f64(47, obj.block_content_x_scale)));
                try!(writer.write_code_pair(&CodePair::new_f64(49, obj.block_content_y_scale)));
                try!(writer.write_code_pair(&CodePair::new_f64(140, obj.block_content_z_scale)));
                try!(writer.write_code_pair(&CodePair::new_bool(293, obj.enable_block_content_scale)));
                try!(writer.write_code_pair(&CodePair::new_f64(141, obj.block_content_rotation)));
                try!(writer.write_code_pair(&CodePair::new_bool(294, obj.enable_block_content_rotation)));
                try!(writer.write_code_pair(&CodePair::new_i16(177, obj.block_content_connection_type)));
                try!(writer.write_code_pair(&CodePair::new_f64(142, obj.scale)));
                try!(writer.write_code_pair(&CodePair::new_bool(295, obj.overwrite_field_value)));
                try!(writer.write_code_pair(&CodePair::new_bool(296, obj.is_annotative)));
                try!(writer.write_code_pair(&CodePair::new_f64(143, obj.break_gap_size)));
                try!(writer.write_code_pair(&CodePair::new_i16(271, obj.text_attachment_direction as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(272, obj.bottom_text_attachment_direction as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(273, obj.top_text_attachment_direction as i16)));
            },
            &ObjectType::MLineStyle(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbMlineStyle"))));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.style_name)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj._flags as i16)));
                try!(writer.write_code_pair(&CodePair::new_string(3, &obj.description)));
                try!(writer.write_code_pair(&CodePair::new_i16(62, obj.fill_color.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_f64(51, obj.start_angle)));
                try!(writer.write_code_pair(&CodePair::new_f64(52, obj.end_angle)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, obj.elements.len() as i16)));
                for item in &obj.elements {
                    try!(writer.write_code_pair(&CodePair::new_f64(49, item.offset)));
                    try!(writer.write_code_pair(&CodePair::new_i16(62, item.color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_string(6, &item.line_type)));
                }
            },
            &ObjectType::ObjectPointer(ref _obj) => {
            },
            &ObjectType::PlotSettings(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbPlotSettings")));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.page_setup_name)));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.printer_name)));
                try!(writer.write_code_pair(&CodePair::new_string(4, &obj.paper_size)));
                try!(writer.write_code_pair(&CodePair::new_string(6, &obj.plot_view_name)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.unprintable_left_margin_size)));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.unprintable_bottom_margin_size)));
                try!(writer.write_code_pair(&CodePair::new_f64(42, obj.unprintable_right_margin_size)));
                try!(writer.write_code_pair(&CodePair::new_f64(43, obj.unprintable_top_margin_size)));
                try!(writer.write_code_pair(&CodePair::new_f64(44, obj.paper_width)));
                try!(writer.write_code_pair(&CodePair::new_f64(45, obj.paper_height)));
                try!(writer.write_code_pair(&CodePair::new_f64(46, obj.plot_origin_x_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(47, obj.plot_origin_y_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(48, obj.plot_window_lower_left_x_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(49, obj.plot_window_lower_left_y_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(140, obj.plot_window_upper_right_x_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(141, obj.plot_window_upper_right_y_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(142, obj.custom_print_scale_numerator)));
                try!(writer.write_code_pair(&CodePair::new_f64(143, obj.custom_print_scale_denominator)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.plot_layout_flags as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(72, obj.plot_paper_units as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(73, obj.plot_rotation as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(74, obj.plot_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_string(7, &obj.current_style_sheet)));
                try!(writer.write_code_pair(&CodePair::new_i16(75, obj.standard_scale as i16)));
                if *version >= AcadVersion::R2004 {
                    try!(writer.write_code_pair(&CodePair::new_i16(76, obj.shade_plot_mode as i16)));
                }
                if *version >= AcadVersion::R2004 {
                    try!(writer.write_code_pair(&CodePair::new_i16(77, obj.shade_plot_resolution_level as i16)));
                }
                if *version >= AcadVersion::R2004 {
                    try!(writer.write_code_pair(&CodePair::new_i16(78, obj.shade_plot_custom_dpi as i16)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(147, obj.standard_scale_value)));
                try!(writer.write_code_pair(&CodePair::new_f64(148, obj.paper_image_origin_x)));
                try!(writer.write_code_pair(&CodePair::new_f64(149, obj.paper_image_origin_y)));
                try!(writer.write_code_pair(&CodePair::new_string(333, &as_handle(obj.shade_plot_object))));
            },
            &ObjectType::RasterVariables(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRasterVariables")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.is_display_frame_image))));
                try!(writer.write_code_pair(&CodePair::new_i16(71, as_i16(obj.is_high_display_quality))));
                try!(writer.write_code_pair(&CodePair::new_i16(72, obj.image_units as i16)));
            },
            &ObjectType::MentalRayRenderSettings(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbRenderSettings"))));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version_1)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.preset_name)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.render_materials)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.texture_sampling_quality)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.render_back_faces)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.render_shadows)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.preview_file_name)));
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbMentalRayRenderSettings"))));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version_2)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.minimum_sampling_rate)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.maximum_sampling_rate)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.sampling_filter_type as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.filter_width)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.filter_height)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.sampling_contrast_color_red)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.sampling_contrast_color_green)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.sampling_contrast_color_blue)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.sampling_contrast_color_alpha)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.shadow_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.map_shadows)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.ray_tracing)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.ray_tracing_depth_reflections)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.ray_tracing_depth_refractions)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.ray_tracing_depth_maximum)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_global_illumination)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.sample_count)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_global_illumination_radius)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.global_illumination_radius)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.photons_per_light)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.global_illumination_depth_reflections)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.global_illumination_depth_refractions)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.global_illumination_depth_maximum)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_final_gather)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.final_gather_ray_count)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_final_gather_minimum_radius)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_final_gather_maximum_radius)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_final_gather_pixels)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.final_gather_sample_radius_minimum)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.final_gather_sample_radius_maximum)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.luminance_scale)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.diagnostic_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.diagnostic_grid_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.grid_size)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.diagnostic_photon_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.diagnostic_bsp_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.export_mi_statistics)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.mi_statistics_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.tile_size)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.tile_order as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.memory_limit)));
            },
            &ObjectType::RenderEnvironment(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRenderEnvironment")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.is_fog_enabled)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.is_background_fog_enabled)));
                try!(writer.write_code_pair(&CodePair::new_i16(280, obj.fog_color_red as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(280, obj.fog_color_green as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(280, obj.fog_color_blue as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.near_fog_density_percent)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.far_fog_density_percent)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.near_clipping_plane_distance_percent)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.far_clipping_plane_distance_percent)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_environment_image)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.environment_image_file_name)));
            },
            &ObjectType::RenderGlobal(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRenderGlobal")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.render_procedure as i32)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.render_destination as i32)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.save_to_file)));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.save_to_file_name)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.image_width)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.image_height)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_predefined_presets_first)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.use_high_info_level)));
            },
            &ObjectType::SectionManager(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbSectionManager"))));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.requires_full_update))));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.section_entities.len() as i32)));
                for v in &obj.section_entities {
                    try!(writer.write_code_pair(&CodePair::new_string(330, &as_handle(*v))));
                }
            },
            &ObjectType::SectionSettings(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::SortentsTable(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbSortentsTable")));
                for v in &obj.entities {
                    try!(writer.write_code_pair(&CodePair::new_string(331, &as_handle(*v))));
                }
                for v in &obj.sort_items {
                    try!(writer.write_code_pair(&CodePair::new_string(5, &as_handle(*v))));
                }
            },
            &ObjectType::SpatialFilter(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbFilter"))));
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbSpatialFilter"))));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.clip_boundary_definition_points.len() as i16)));
                for item in &obj.clip_boundary_definition_points {
                    try!(writer.write_code_pair(&CodePair::new_f64(10, item.x)));
                    try!(writer.write_code_pair(&CodePair::new_f64(20, item.y)));
                    try!(writer.write_code_pair(&CodePair::new_f64(30, item.z)));
                }
                try!(writer.write_code_pair(&CodePair::new_f64(210, obj.clip_boundary_normal.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(220, obj.clip_boundary_normal.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(230, obj.clip_boundary_normal.z)));
                try!(writer.write_code_pair(&CodePair::new_f64(11, obj.clip_boundary_origin.x)));
                try!(writer.write_code_pair(&CodePair::new_f64(21, obj.clip_boundary_origin.y)));
                try!(writer.write_code_pair(&CodePair::new_f64(31, obj.clip_boundary_origin.z)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, as_i16(obj.is_clip_boundary_enabled))));
                try!(writer.write_code_pair(&CodePair::new_i16(72, as_i16(obj.is_front_clipping_plane))));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.front_clipping_plane_distance)));
                try!(writer.write_code_pair(&CodePair::new_i16(73, as_i16(obj.is_back_clipping_plane))));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.back_clipping_plane_distance)));
                for item in &obj.inverse_transformation_matrix.get_4x3_values_row_major() {
                    try!(writer.write_code_pair(&CodePair::new_f64(40, *item)));
                }
                for item in &obj.transformation_matrix.get_4x3_values_row_major() {
                    try!(writer.write_code_pair(&CodePair::new_f64(40, *item)));
                }
            },
            &ObjectType::SpatialIndex(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbIndex"))));
                try!(writer.write_code_pair(&CodePair::new_f64(40, as_double_local(obj.timestamp))));
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbSpatialIndex"))));
            },
            &ObjectType::SunStudy(_) => { panic!("this case should have been covered in a custom writer"); },
            &ObjectType::TableStyle(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbTableStyle"))));
                if *version >= AcadVersion::R2010 {
                    try!(writer.write_code_pair(&CodePair::new_i16(280, obj.version as i16)));
                }
                try!(writer.write_code_pair(&CodePair::new_string(3, &obj.description)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.flow_direction as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, obj.flags as i16)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.horizontal_cell_margin)));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.vertical_cell_margin)));
                try!(writer.write_code_pair(&CodePair::new_i16(280, as_i16(obj.is_title_suppressed))));
                try!(writer.write_code_pair(&CodePair::new_i16(281, as_i16(obj.is_column_heading_suppressed))));
                for item in &obj.cell_styles {
                    try!(writer.write_code_pair(&CodePair::new_string(7, &item.name)));
                    try!(writer.write_code_pair(&CodePair::new_f64(140, item.text_height)));
                    try!(writer.write_code_pair(&CodePair::new_i16(170, item.cell_alignment)));
                    try!(writer.write_code_pair(&CodePair::new_i16(62, item.text_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(63, item.cell_fill_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(283, as_i16(item.is_background_color_enabled))));
                    try!(writer.write_code_pair(&CodePair::new_i32(90, item.cell_data_type)));
                    try!(writer.write_code_pair(&CodePair::new_i32(91, item.cell_unit_type)));
                    try!(writer.write_code_pair(&CodePair::new_i16(274, item.border_lineweight_1)));
                    try!(writer.write_code_pair(&CodePair::new_i16(275, item.border_lineweight_2)));
                    try!(writer.write_code_pair(&CodePair::new_i16(276, item.border_lineweight_3)));
                    try!(writer.write_code_pair(&CodePair::new_i16(277, item.border_lineweight_4)));
                    try!(writer.write_code_pair(&CodePair::new_i16(278, item.border_lineweight_5)));
                    try!(writer.write_code_pair(&CodePair::new_i16(279, item.border_lineweight_6)));
                    try!(writer.write_code_pair(&CodePair::new_i16(284, as_i16(item.is_border_1_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(285, as_i16(item.is_border_2_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(286, as_i16(item.is_border_3_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(287, as_i16(item.is_border_4_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(288, as_i16(item.is_border_5_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(289, as_i16(item.is_border_6_visible))));
                    try!(writer.write_code_pair(&CodePair::new_i16(64, item.border_1_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(65, item.border_2_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(66, item.border_3_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(67, item.border_4_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(68, item.border_5_color.get_raw_value())));
                    try!(writer.write_code_pair(&CodePair::new_i16(69, item.border_6_color.get_raw_value())));
                }
            },
            &ObjectType::UnderlayDefinition(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbUnderlayDefinition")));
                try!(writer.write_code_pair(&CodePair::new_string(1, &obj.file_name)));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.name)));
            },
            &ObjectType::VbaProject(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_string(100, &String::from("AcDbVbaProject"))));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.data.len() as i32)));
                for item in &try!(obj.get_hex_strings()) {
                    try!(writer.write_code_pair(&CodePair::new_string(310, item)));
                }
            },
            &ObjectType::VisualStyle(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbVisualStyle")));
                try!(writer.write_code_pair(&CodePair::new_string(2, &obj.description)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, obj.type_code)));
                try!(writer.write_code_pair(&CodePair::new_i16(71, obj.face_lighting_model as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(72, obj.face_lighting_quality as i16)));
                try!(writer.write_code_pair(&CodePair::new_i16(73, obj.face_color_mode as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.face_modifier as i32)));
                try!(writer.write_code_pair(&CodePair::new_f64(40, obj.face_opacity_level)));
                try!(writer.write_code_pair(&CodePair::new_f64(41, obj.face_specular_level)));
                try!(writer.write_code_pair(&CodePair::new_i16(62, obj.color1.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_i16(63, obj.color2.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_i32(421, obj.face_style_mono_color)));
                try!(writer.write_code_pair(&CodePair::new_i16(74, obj.edge_style_model as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(91, obj.edge_style)));
                try!(writer.write_code_pair(&CodePair::new_i16(64, obj.edge_intersection_color.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_i16(65, obj.edge_obscured_color.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_i16(75, obj.edge_obscured_line_type)));
                try!(writer.write_code_pair(&CodePair::new_i16(175, obj.edge_intersection_line_type)));
                try!(writer.write_code_pair(&CodePair::new_f64(42, obj.edge_crease_angle)));
                try!(writer.write_code_pair(&CodePair::new_i32(92, obj.edge_modifiers)));
                try!(writer.write_code_pair(&CodePair::new_i16(66, obj.edge_color.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_f64(43, obj.edge_opacity_level)));
                try!(writer.write_code_pair(&CodePair::new_i16(76, obj.edge_width)));
                try!(writer.write_code_pair(&CodePair::new_i16(77, obj.edge_overhang)));
                try!(writer.write_code_pair(&CodePair::new_i16(78, obj.edge_jitter)));
                try!(writer.write_code_pair(&CodePair::new_i16(67, obj.edge_silhouette_color.get_raw_value())));
                try!(writer.write_code_pair(&CodePair::new_i16(79, obj.edge_silhouette_width)));
                try!(writer.write_code_pair(&CodePair::new_i16(170, obj.edge_halo_gap)));
                try!(writer.write_code_pair(&CodePair::new_i16(171, obj.edge_iso_line_count as i16)));
                try!(writer.write_code_pair(&CodePair::new_bool(290, obj.hide_edge_line_precision)));
                try!(writer.write_code_pair(&CodePair::new_i16(174, obj.edge_style_apply_flags as i16)));
                try!(writer.write_code_pair(&CodePair::new_i32(93, obj.display_style_settings)));
                try!(writer.write_code_pair(&CodePair::new_f64(44, obj.brightness)));
                try!(writer.write_code_pair(&CodePair::new_i16(173, obj.shadow_type)));
                try!(writer.write_code_pair(&CodePair::new_bool(291, obj.internal_flag)));
            },
            &ObjectType::WipeoutVariables(ref obj) => {
                try!(writer.write_code_pair(&CodePair::new_str(100, "AcDbRasterVariables")));
                try!(writer.write_code_pair(&CodePair::new_i32(90, obj.class_version)));
                try!(writer.write_code_pair(&CodePair::new_i16(70, as_i16(obj.display_image_frame))));
            },
            &ObjectType::XRecordObject(_) => { panic!("this case should have been covered in a custom writer"); },
        }

        Ok(())
    }
}