implement outer polygon offset and cutting outside contour
Stefan Schuermans

Stefan Schuermans commited on 2013-01-28 21:04:35
Showing 5 changed files, with 975 additions and 143 deletions.

... ...
@@ -903,7 +903,7 @@ LAYER
903 903
 100
904 904
 AcDbSymbolTable
905 905
  70
906
-4
906
+6
907 907
   0
908 908
 LAYER
909 909
   5
... ...
@@ -983,6 +983,46 @@ CONTINUOUS
983 983
 370
984 984
 13
985 985
 390
986
+F
987
+  0
988
+LAYER
989
+  5
990
+46
991
+100
992
+AcDbSymbolTableRecord
993
+100
994
+AcDbLayerTableRecord
995
+  2
996
+inner_test
997
+ 70
998
+0
999
+ 62
1000
+4
1001
+  6
1002
+CONTINUOUS
1003
+370
1004
+13
1005
+390
1006
+F
1007
+  0
1008
+LAYER
1009
+  5
1010
+47
1011
+100
1012
+AcDbSymbolTableRecord
1013
+100
1014
+AcDbLayerTableRecord
1015
+  2
1016
+outer_test
1017
+ 70
1018
+0
1019
+ 62
1020
+6
1021
+  6
1022
+CONTINUOUS
1023
+370
1024
+13
1025
+390
986 1026
 F
987 1027
   0
988 1028
 ENDTAB
... ...
@@ -1311,7 +1351,7 @@ ENTITIES
1311 1351
   0
1312 1352
 LINE
1313 1353
   5
1314
-46
1354
+48
1315 1355
 100
1316 1356
 AcDbEntity
1317 1357
 100
... ...
@@ -1339,7 +1379,7 @@ ByLayer
1339 1379
   0
1340 1380
 LINE
1341 1381
   5
1342
-47
1382
+49
1343 1383
 100
1344 1384
 AcDbEntity
1345 1385
 100
... ...
@@ -1367,7 +1407,7 @@ ByLayer
1367 1407
   0
1368 1408
 LINE
1369 1409
   5
1370
-48
1410
+4A
1371 1411
 100
1372 1412
 AcDbEntity
1373 1413
 100
... ...
@@ -1395,7 +1435,7 @@ ByLayer
1395 1435
   0
1396 1436
 LINE
1397 1437
   5
1398
-49
1438
+4B
1399 1439
 100
1400 1440
 AcDbEntity
1401 1441
 100
... ...
@@ -1423,7 +1463,7 @@ ByLayer
1423 1463
   0
1424 1464
 LINE
1425 1465
   5
1426
-4A
1466
+4C
1427 1467
 100
1428 1468
 AcDbEntity
1429 1469
 100
... ...
@@ -1451,7 +1491,7 @@ ByLayer
1451 1491
   0
1452 1492
 LINE
1453 1493
   5
1454
-4B
1494
+4D
1455 1495
 100
1456 1496
 AcDbEntity
1457 1497
 100
... ...
@@ -1479,7 +1519,7 @@ ByLayer
1479 1519
   0
1480 1520
 LINE
1481 1521
   5
1482
-4C
1522
+4E
1483 1523
 100
1484 1524
 AcDbEntity
1485 1525
 100
... ...
@@ -1507,7 +1547,7 @@ ByLayer
1507 1547
   0
1508 1548
 LINE
1509 1549
   5
1510
-4D
1550
+4F
1511 1551
 100
1512 1552
 AcDbEntity
1513 1553
 100
... ...
@@ -1535,7 +1575,7 @@ ByLayer
1535 1575
   0
1536 1576
 LINE
1537 1577
   5
1538
-4E
1578
+50
1539 1579
 100
1540 1580
 AcDbEntity
1541 1581
 100
... ...
@@ -1563,7 +1603,7 @@ ByLayer
1563 1603
   0
1564 1604
 LINE
1565 1605
   5
1566
-4F
1606
+51
1567 1607
 100
1568 1608
 AcDbEntity
1569 1609
 100
... ...
@@ -1591,7 +1631,7 @@ ByLayer
1591 1631
   0
1592 1632
 LINE
1593 1633
   5
1594
-50
1634
+52
1595 1635
 100
1596 1636
 AcDbEntity
1597 1637
 100
... ...
@@ -1619,7 +1659,7 @@ ByLayer
1619 1659
   0
1620 1660
 LINE
1621 1661
   5
1622
-51
1662
+53
1623 1663
 100
1624 1664
 AcDbEntity
1625 1665
 100
... ...
@@ -1647,7 +1687,7 @@ ByLayer
1647 1687
   0
1648 1688
 LINE
1649 1689
   5
1650
-52
1690
+54
1651 1691
 100
1652 1692
 AcDbEntity
1653 1693
 100
... ...
@@ -1675,7 +1715,7 @@ ByLayer
1675 1715
   0
1676 1716
 LINE
1677 1717
   5
1678
-53
1718
+55
1679 1719
 100
1680 1720
 AcDbEntity
1681 1721
 100
... ...
@@ -1703,7 +1743,7 @@ ByLayer
1703 1743
   0
1704 1744
 LINE
1705 1745
   5
1706
-54
1746
+56
1707 1747
 100
1708 1748
 AcDbEntity
1709 1749
 100
... ...
@@ -1731,7 +1771,7 @@ ByLayer
1731 1771
   0
1732 1772
 LINE
1733 1773
   5
1734
-55
1774
+57
1735 1775
 100
1736 1776
 AcDbEntity
1737 1777
 100
... ...
@@ -1759,7 +1799,7 @@ ByLayer
1759 1799
   0
1760 1800
 LINE
1761 1801
   5
1762
-56
1802
+58
1763 1803
 100
1764 1804
 AcDbEntity
1765 1805
 100
... ...
@@ -1787,7 +1827,7 @@ ByLayer
1787 1827
   0
1788 1828
 LINE
1789 1829
   5
1790
-57
1830
+59
1791 1831
 100
1792 1832
 AcDbEntity
1793 1833
 100
... ...
@@ -1815,7 +1855,7 @@ ByLayer
1815 1855
   0
1816 1856
 LINE
1817 1857
   5
1818
-58
1858
+5A
1819 1859
 100
1820 1860
 AcDbEntity
1821 1861
 100
... ...
@@ -1843,7 +1883,7 @@ ByLayer
1843 1883
   0
1844 1884
 LINE
1845 1885
   5
1846
-59
1886
+5B
1847 1887
 100
1848 1888
 AcDbEntity
1849 1889
 100
... ...
@@ -1871,7 +1911,7 @@ ByLayer
1871 1911
   0
1872 1912
 LINE
1873 1913
   5
1874
-5A
1914
+5C
1875 1915
 100
1876 1916
 AcDbEntity
1877 1917
 100
... ...
@@ -1899,7 +1939,7 @@ ByLayer
1899 1939
   0
1900 1940
 CIRCLE
1901 1941
   5
1902
-5B
1942
+5D
1903 1943
 100
1904 1944
 AcDbEntity
1905 1945
 100
... ...
@@ -1923,7 +1963,7 @@ ByLayer
1923 1963
   0
1924 1964
 LINE
1925 1965
   5
1926
-5C
1966
+5E
1927 1967
 100
1928 1968
 AcDbEntity
1929 1969
 100
... ...
@@ -1951,7 +1991,7 @@ ByLayer
1951 1991
   0
1952 1992
 LINE
1953 1993
   5
1954
-5D
1994
+5F
1955 1995
 100
1956 1996
 AcDbEntity
1957 1997
 100
... ...
@@ -1979,7 +2019,7 @@ ByLayer
1979 2019
   0
1980 2020
 LINE
1981 2021
   5
1982
-5E
2022
+60
1983 2023
 100
1984 2024
 AcDbEntity
1985 2025
 100
... ...
@@ -2007,7 +2047,7 @@ ByLayer
2007 2047
   0
2008 2048
 LINE
2009 2049
   5
2010
-5F
2050
+61
2011 2051
 100
2012 2052
 AcDbEntity
2013 2053
 100
... ...
@@ -2035,7 +2075,7 @@ ByLayer
2035 2075
   0
2036 2076
 LINE
2037 2077
   5
2038
-60
2078
+62
2039 2079
 100
2040 2080
 AcDbEntity
2041 2081
 100
... ...
@@ -2063,7 +2103,7 @@ ByLayer
2063 2103
   0
2064 2104
 LINE
2065 2105
   5
2066
-61
2106
+63
2067 2107
 100
2068 2108
 AcDbEntity
2069 2109
 100
... ...
@@ -2091,7 +2131,7 @@ ByLayer
2091 2131
   0
2092 2132
 LINE
2093 2133
   5
2094
-62
2134
+64
2095 2135
 100
2096 2136
 AcDbEntity
2097 2137
 100
... ...
@@ -2119,7 +2159,7 @@ ByLayer
2119 2159
   0
2120 2160
 LINE
2121 2161
   5
2122
-63
2162
+65
2123 2163
 100
2124 2164
 AcDbEntity
2125 2165
 100
... ...
@@ -2147,7 +2187,7 @@ ByLayer
2147 2187
   0
2148 2188
 LINE
2149 2189
   5
2150
-64
2190
+66
2151 2191
 100
2152 2192
 AcDbEntity
2153 2193
 100
... ...
@@ -2175,7 +2215,7 @@ ByLayer
2175 2215
   0
2176 2216
 LINE
2177 2217
   5
2178
-65
2218
+67
2179 2219
 100
2180 2220
 AcDbEntity
2181 2221
 100
... ...
@@ -2203,7 +2243,7 @@ ByLayer
2203 2243
   0
2204 2244
 LINE
2205 2245
   5
2206
-66
2246
+68
2207 2247
 100
2208 2248
 AcDbEntity
2209 2249
 100
... ...
@@ -2231,7 +2271,7 @@ ByLayer
2231 2271
   0
2232 2272
 LINE
2233 2273
   5
2234
-67
2274
+69
2235 2275
 100
2236 2276
 AcDbEntity
2237 2277
 100
... ...
@@ -2259,7 +2299,7 @@ ByLayer
2259 2299
   0
2260 2300
 LINE
2261 2301
   5
2262
-68
2302
+6A
2263 2303
 100
2264 2304
 AcDbEntity
2265 2305
 100
... ...
@@ -2287,7 +2327,7 @@ ByLayer
2287 2327
   0
2288 2328
 LINE
2289 2329
   5
2290
-69
2330
+6B
2291 2331
 100
2292 2332
 AcDbEntity
2293 2333
 100
... ...
@@ -2315,7 +2355,7 @@ ByLayer
2315 2355
   0
2316 2356
 LINE
2317 2357
   5
2318
-6A
2358
+6C
2319 2359
 100
2320 2360
 AcDbEntity
2321 2361
 100
... ...
@@ -2343,7 +2383,7 @@ ByLayer
2343 2383
   0
2344 2384
 LINE
2345 2385
   5
2346
-6B
2386
+6D
2347 2387
 100
2348 2388
 AcDbEntity
2349 2389
 100
... ...
@@ -2371,7 +2411,7 @@ ByLayer
2371 2411
   0
2372 2412
 LINE
2373 2413
   5
2374
-6C
2414
+6E
2375 2415
 100
2376 2416
 AcDbEntity
2377 2417
 100
... ...
@@ -2399,7 +2439,7 @@ ByLayer
2399 2439
   0
2400 2440
 LINE
2401 2441
   5
2402
-6D
2442
+6F
2403 2443
 100
2404 2444
 AcDbEntity
2405 2445
 100
... ...
@@ -2427,7 +2467,7 @@ ByLayer
2427 2467
   0
2428 2468
 LINE
2429 2469
   5
2430
-6E
2470
+70
2431 2471
 100
2432 2472
 AcDbEntity
2433 2473
 100
... ...
@@ -2455,7 +2495,7 @@ ByLayer
2455 2495
   0
2456 2496
 LINE
2457 2497
   5
2458
-6F
2498
+71
2459 2499
 100
2460 2500
 AcDbEntity
2461 2501
 100
... ...
@@ -2481,105 +2521,793 @@ ByLayer
2481 2521
  31
2482 2522
 0.0
2483 2523
   0
2484
-ENDSEC
2485
-  0
2486
-SECTION
2487
-  2
2488
-OBJECTS
2489
-  0
2490
-DICTIONARY
2524
+LINE
2491 2525
   5
2492
-C
2526
+72
2493 2527
 100
2494
-AcDbDictionary
2495
-280
2496
-0
2497
-281
2498
-1
2499
-  3
2500
-ACAD_GROUP
2501
-350
2502
-D
2503
-  3
2504
-ACAD_LAYOUT
2505
-350
2506
-1A
2507
-  3
2508
-ACAD_MLINESTYLE
2509
-350
2510
-17
2511
-  3
2512
-ACAD_PLOTSETTINGS
2513
-350
2514
-19
2515
-  3
2516
-ACAD_PLOTSTYLENAME
2517
-350
2518
-E
2519
-  3
2520
-AcDbVariableDictionary
2521
-350
2522
-70
2523
-  0
2524
-DICTIONARY
2525
-  5
2526
-D
2528
+AcDbEntity
2527 2529
 100
2528
-AcDbDictionary
2529
-280
2530
-0
2531
-281
2532
-1
2530
+AcDbLine
2531
+  8
2532
+inner_test
2533
+ 62
2534
+256
2535
+370
2536
+-1
2537
+  6
2538
+ByLayer
2539
+ 10
2540
+145.0
2541
+ 20
2542
+70.0
2543
+ 30
2544
+0.0
2545
+ 11
2546
+150.0
2547
+ 21
2548
+70.0
2549
+ 31
2550
+0.0
2533 2551
   0
2534
-ACDBDICTIONARYWDFLT
2552
+LINE
2535 2553
   5
2536
-E
2554
+73
2537 2555
 100
2538
-AcDbDictionary
2539
-281
2540
-1
2541
-  3
2542
-Normal
2543
-350
2544
-F
2556
+AcDbEntity
2545 2557
 100
2546
-AcDbDictionaryWithDefault
2547
-340
2548
-F
2549
-  0
2550
-ACDBPLACEHOLDER
2551
-  5
2552
-F
2558
+AcDbLine
2559
+  8
2560
+inner_test
2561
+ 62
2562
+256
2563
+370
2564
+-1
2565
+  6
2566
+ByLayer
2567
+ 10
2568
+140.0
2569
+ 20
2570
+75.0
2571
+ 30
2572
+0.0
2573
+ 11
2574
+140.0
2575
+ 21
2576
+80.0
2577
+ 31
2578
+0.0
2553 2579
   0
2554
-DICTIONARY
2580
+LINE
2555 2581
   5
2556
-17
2582
+74
2557 2583
 100
2558
-AcDbDictionary
2559
-280
2560
-0
2561
-281
2562
-1
2563
-  3
2564
-Standard
2565
-350
2566
-18
2567
-  0
2568
-MLINESTYLE
2569
-  5
2570
-18
2584
+AcDbEntity
2571 2585
 100
2572
-AcDbMlineStyle
2573
-  2
2574
-STANDARD
2575
- 70
2576
-0
2577
-  3
2578
-
2586
+AcDbLine
2587
+  8
2588
+inner_test
2579 2589
  62
2580 2590
 256
2581
- 51
2582
-90.0
2591
+370
2592
+-1
2593
+  6
2594
+ByLayer
2595
+ 10
2596
+140.0
2597
+ 20
2598
+80.0
2599
+ 30
2600
+0.0
2601
+ 11
2602
+145.0
2603
+ 21
2604
+80.0
2605
+ 31
2606
+0.0
2607
+  0
2608
+LINE
2609
+  5
2610
+75
2611
+100
2612
+AcDbEntity
2613
+100
2614
+AcDbLine
2615
+  8
2616
+inner_test
2617
+ 62
2618
+256
2619
+370
2620
+-1
2621
+  6
2622
+ByLayer
2623
+ 10
2624
+150.0
2625
+ 20
2626
+75.0
2627
+ 30
2628
+0.0
2629
+ 11
2630
+150.0
2631
+ 21
2632
+70.0
2633
+ 31
2634
+0.0
2635
+  0
2636
+LINE
2637
+  5
2638
+76
2639
+100
2640
+AcDbEntity
2641
+100
2642
+AcDbLine
2643
+  8
2644
+inner_test
2645
+ 62
2646
+256
2647
+370
2648
+-1
2649
+  6
2650
+ByLayer
2651
+ 10
2652
+130.0
2653
+ 20
2654
+60.0
2655
+ 30
2656
+0.0
2657
+ 11
2658
+155.0
2659
+ 21
2660
+60.0
2661
+ 31
2662
+0.0
2663
+  0
2664
+LINE
2665
+  5
2666
+77
2667
+100
2668
+AcDbEntity
2669
+100
2670
+AcDbLine
2671
+  8
2672
+inner_test
2673
+ 62
2674
+256
2675
+370
2676
+-1
2677
+  6
2678
+ByLayer
2679
+ 10
2680
+160.0
2681
+ 20
2682
+65.0
2683
+ 30
2684
+0.0
2685
+ 11
2686
+160.0
2687
+ 21
2688
+90.0
2689
+ 31
2690
+0.0
2691
+  0
2692
+LINE
2693
+  5
2694
+78
2695
+100
2696
+AcDbEntity
2697
+100
2698
+AcDbLine
2699
+  8
2700
+inner_test
2701
+ 62
2702
+256
2703
+370
2704
+-1
2705
+  6
2706
+ByLayer
2707
+ 10
2708
+130.0
2709
+ 20
2710
+85.0
2711
+ 30
2712
+0.0
2713
+ 11
2714
+130.0
2715
+ 21
2716
+60.0
2717
+ 31
2718
+0.0
2719
+  0
2720
+LINE
2721
+  5
2722
+79
2723
+100
2724
+AcDbEntity
2725
+100
2726
+AcDbLine
2727
+  8
2728
+inner_test
2729
+ 62
2730
+256
2731
+370
2732
+-1
2733
+  6
2734
+ByLayer
2735
+ 10
2736
+160.0
2737
+ 20
2738
+90.0
2739
+ 30
2740
+0.0
2741
+ 11
2742
+135.0
2743
+ 21
2744
+90.0
2745
+ 31
2746
+0.0
2747
+  0
2748
+ARC
2749
+  5
2750
+7A
2751
+100
2752
+AcDbEntity
2753
+  8
2754
+inner_test
2755
+ 62
2756
+256
2757
+370
2758
+-1
2759
+  6
2760
+ByLayer
2761
+100
2762
+AcDbCircle
2763
+ 10
2764
+145.0
2765
+ 20
2766
+75.0
2767
+ 30
2768
+0.0
2769
+ 40
2770
+5.0
2771
+100
2772
+AcDbArc
2773
+ 50
2774
+180.0
2775
+ 51
2776
+270.0
2777
+  0
2778
+ARC
2779
+  5
2780
+7B
2781
+100
2782
+AcDbEntity
2783
+  8
2784
+inner_test
2785
+ 62
2786
+256
2787
+370
2788
+-1
2789
+  6
2790
+ByLayer
2791
+100
2792
+AcDbCircle
2793
+ 10
2794
+145.0
2795
+ 20
2796
+75.0
2797
+ 30
2798
+0.0
2799
+ 40
2800
+5.0
2801
+100
2802
+AcDbArc
2803
+ 50
2804
+0.0
2805
+ 51
2806
+90.0
2807
+  0
2808
+ARC
2809
+  5
2810
+7C
2811
+100
2812
+AcDbEntity
2813
+  8
2814
+inner_test
2815
+ 62
2816
+256
2817
+370
2818
+-1
2819
+  6
2820
+ByLayer
2821
+100
2822
+AcDbCircle
2823
+ 10
2824
+155.0
2825
+ 20
2826
+65.0
2827
+ 30
2828
+0.0
2829
+ 40
2830
+5.0
2831
+100
2832
+AcDbArc
2833
+ 50
2834
+270.0
2835
+ 51
2836
+0.0
2837
+  0
2838
+ARC
2839
+  5
2840
+7D
2841
+100
2842
+AcDbEntity
2843
+  8
2844
+inner_test
2845
+ 62
2846
+256
2847
+370
2848
+-1
2849
+  6
2850
+ByLayer
2851
+100
2852
+AcDbCircle
2853
+ 10
2854
+135.0
2855
+ 20
2856
+85.0
2857
+ 30
2858
+0.0
2859
+ 40
2860
+5.0
2861
+100
2862
+AcDbArc
2863
+ 50
2864
+90.0
2865
+ 51
2866
+180.0
2867
+  0
2868
+LINE
2869
+  5
2870
+7E
2871
+100
2872
+AcDbEntity
2873
+100
2874
+AcDbLine
2875
+  8
2876
+outer_test
2877
+ 62
2878
+256
2879
+370
2880
+-1
2881
+  6
2882
+ByLayer
2883
+ 10
2884
+140.0
2885
+ 20
2886
+25.0
2887
+ 30
2888
+0.0
2889
+ 11
2890
+140.0
2891
+ 21
2892
+30.0
2893
+ 31
2894
+0.0
2895
+  0
2896
+LINE
2897
+  5
2898
+7F
2899
+100
2900
+AcDbEntity
2901
+100
2902
+AcDbLine
2903
+  8
2904
+outer_test
2905
+ 62
2906
+256
2907
+370
2908
+-1
2909
+  6
2910
+ByLayer
2911
+ 10
2912
+150.0
2913
+ 20
2914
+20.0
2915
+ 30
2916
+0.0
2917
+ 11
2918
+145.0
2919
+ 21
2920
+20.0
2921
+ 31
2922
+0.0
2923
+  0
2924
+ARC
2925
+  5
2926
+80
2927
+100
2928
+AcDbEntity
2929
+  8
2930
+outer_test
2931
+ 62
2932
+256
2933
+370
2934
+-1
2935
+  6
2936
+ByLayer
2937
+100
2938
+AcDbCircle
2939
+ 10
2940
+145.0
2941
+ 20
2942
+25.0
2943
+ 30
2944
+0.0
2945
+ 40
2946
+5.0
2947
+100
2948
+AcDbArc
2949
+ 50
2950
+180.0
2951
+ 51
2952
+270.0
2953
+  0
2954
+LINE
2955
+  5
2956
+81
2957
+100
2958
+AcDbEntity
2959
+100
2960
+AcDbLine
2961
+  8
2962
+outer_test
2963
+ 62
2964
+256
2965
+370
2966
+-1
2967
+  6
2968
+ByLayer
2969
+ 10
2970
+150.0
2971
+ 20
2972
+25.0
2973
+ 30
2974
+0.0
2975
+ 11
2976
+150.0
2977
+ 21
2978
+20.0
2979
+ 31
2980
+0.0
2981
+  0
2982
+LINE
2983
+  5
2984
+82
2985
+100
2986
+AcDbEntity
2987
+100
2988
+AcDbLine
2989
+  8
2990
+outer_test
2991
+ 62
2992
+256
2993
+370
2994
+-1
2995
+  6
2996
+ByLayer
2997
+ 10
2998
+140.0
2999
+ 20
3000
+30.0
3001
+ 30
3002
+0.0
3003
+ 11
3004
+145.0
3005
+ 21
3006
+30.0
3007
+ 31
3008
+0.0
3009
+  0
3010
+ARC
3011
+  5
3012
+83
3013
+100
3014
+AcDbEntity
3015
+  8
3016
+outer_test
3017
+ 62
3018
+256
3019
+370
3020
+-1
3021
+  6
3022
+ByLayer
3023
+100
3024
+AcDbCircle
3025
+ 10
3026
+145.0
3027
+ 20
3028
+25.0
3029
+ 30
3030
+0.0
3031
+ 40
3032
+5.0
3033
+100
3034
+AcDbArc
3035
+ 50
3036
+0.0
3037
+ 51
3038
+90.0
3039
+  0
3040
+LINE
3041
+  5
3042
+84
3043
+100
3044
+AcDbEntity
3045
+100
3046
+AcDbLine
3047
+  8
3048
+outer_test
3049
+ 62
3050
+256
3051
+370
3052
+-1
3053
+  6
3054
+ByLayer
3055
+ 10
3056
+135.0
3057
+ 20
3058
+40.0
3059
+ 30
3060
+0.0
3061
+ 11
3062
+160.0
3063
+ 21
3064
+40.0
3065
+ 31
3066
+0.0
3067
+  0
3068
+LINE
3069
+  5
3070
+85
3071
+100
3072
+AcDbEntity
3073
+100
3074
+AcDbLine
3075
+  8
3076
+outer_test
3077
+ 62
3078
+256
3079
+370
3080
+-1
3081
+  6
3082
+ByLayer
3083
+ 10
3084
+130.0
3085
+ 20
3086
+10.0
3087
+ 30
3088
+0.0
3089
+ 11
3090
+130.0
3091
+ 21
3092
+35.0
3093
+ 31
3094
+0.0
3095
+  0
3096
+ARC
3097
+  5
3098
+86
3099
+100
3100
+AcDbEntity
3101
+  8
3102
+outer_test
3103
+ 62
3104
+256
3105
+370
3106
+-1
3107
+  6
3108
+ByLayer
3109
+100
3110
+AcDbCircle
3111
+ 10
3112
+135.0
3113
+ 20
3114
+35.0
3115
+ 30
3116
+0.0
3117
+ 40
3118
+5.0
3119
+100
3120
+AcDbArc
3121
+ 50
3122
+90.0
3123
+ 51
3124
+180.0
3125
+  0
3126
+LINE
3127
+  5
3128
+87
3129
+100
3130
+AcDbEntity
3131
+100
3132
+AcDbLine
3133
+  8
3134
+outer_test
3135
+ 62
3136
+256
3137
+370
3138
+-1
3139
+  6
3140
+ByLayer
3141
+ 10
3142
+155.0
3143
+ 20
3144
+10.0
3145
+ 30
3146
+0.0
3147
+ 11
3148
+130.0
3149
+ 21
3150
+10.0
3151
+ 31
3152
+0.0
3153
+  0
3154
+LINE
3155
+  5
3156
+88
3157
+100
3158
+AcDbEntity
3159
+100
3160
+AcDbLine
3161
+  8
3162
+outer_test
3163
+ 62
3164
+256
3165
+370
3166
+-1
3167
+  6
3168
+ByLayer
3169
+ 10
3170
+160.0
3171
+ 20
3172
+40.0
3173
+ 30
3174
+0.0
3175
+ 11
3176
+160.0
3177
+ 21
3178
+15.0
3179
+ 31
3180
+0.0
3181
+  0
3182
+ARC
3183
+  5
3184
+89
3185
+100
3186
+AcDbEntity
3187
+  8
3188
+outer_test
3189
+ 62
3190
+256
3191
+370
3192
+-1
3193
+  6
3194
+ByLayer
3195
+100
3196
+AcDbCircle
3197
+ 10
3198
+155.0
3199
+ 20
3200
+15.0
3201
+ 30
3202
+0.0
3203
+ 40
3204
+5.0
3205
+100
3206
+AcDbArc
3207
+ 50
3208
+270.0
3209
+ 51
3210
+0.0
3211
+  0
3212
+ENDSEC
3213
+  0
3214
+SECTION
3215
+  2
3216
+OBJECTS
3217
+  0
3218
+DICTIONARY
3219
+  5
3220
+C
3221
+100
3222
+AcDbDictionary
3223
+280
3224
+0
3225
+281
3226
+1
3227
+  3
3228
+ACAD_GROUP
3229
+350
3230
+D
3231
+  3
3232
+ACAD_LAYOUT
3233
+350
3234
+1A
3235
+  3
3236
+ACAD_MLINESTYLE
3237
+350
3238
+17
3239
+  3
3240
+ACAD_PLOTSETTINGS
3241
+350
3242
+19
3243
+  3
3244
+ACAD_PLOTSTYLENAME
3245
+350
3246
+E
3247
+  3
3248
+AcDbVariableDictionary
3249
+350
3250
+8A
3251
+  0
3252
+DICTIONARY
3253
+  5
3254
+D
3255
+100
3256
+AcDbDictionary
3257
+280
3258
+0
3259
+281
3260
+1
3261
+  0
3262
+ACDBDICTIONARYWDFLT
3263
+  5
3264
+E
3265
+100
3266
+AcDbDictionary
3267
+281
3268
+1
3269
+  3
3270
+Normal
3271
+350
3272
+F
3273
+100
3274
+AcDbDictionaryWithDefault
3275
+340
3276
+F
3277
+  0
3278
+ACDBPLACEHOLDER
3279
+  5
3280
+F
3281
+  0
3282
+DICTIONARY
3283
+  5
3284
+17
3285
+100
3286
+AcDbDictionary
3287
+280
3288
+0
3289
+281
3290
+1
3291
+  3
3292
+Standard
3293
+350
3294
+18
3295
+  0
3296
+MLINESTYLE
3297
+  5
3298
+18
3299
+100
3300
+AcDbMlineStyle
3301
+  2
3302
+STANDARD
3303
+ 70
3304
+0
3305
+  3
3306
+
3307
+ 62
3308
+256
3309
+ 51
3310
+90.0
2583 3311
  52
2584 3312
 90.0
2585 3313
  71
... ...
@@ -2983,7 +3711,7 @@ Layout2
2983 3711
   0
2984 3712
 DICTIONARY
2985 3713
   5
2986
-70
3714
+8A
2987 3715
 100
2988 3716
 AcDbDictionary
2989 3717
 281
... ...
@@ -2991,15 +3719,15 @@ AcDbDictionary
2991 3719
   3
2992 3720
 DIMASSOC
2993 3721
 350
2994
-72
3722
+8C
2995 3723
   3
2996 3724
 HIDETEXT
2997 3725
 350
2998
-71
3726
+8B
2999 3727
   0
3000 3728
 DICTIONARYVAR
3001 3729
   5
3002
-71
3730
+8B
3003 3731
 100
3004 3732
 DictionaryVariables
3005 3733
 280
... ...
@@ -3009,7 +3737,7 @@ DictionaryVariables
3009 3737
   0
3010 3738
 DICTIONARYVAR
3011 3739
   5
3012
-72
3740
+8C
3013 3741
 100
3014 3742
 DictionaryVariables
3015 3743
 280
... ...
@@ -21,6 +21,12 @@ cut text
21 21
 set_cut_z -2
22 22
 cut_pocket pocket
23 23
 
24
+set_cut_z -2
25
+cut_inside inner_test
26
+
27
+set_cut_z -2
28
+cut_outside outer_test
29
+
24 30
 set_cut_z -3
25 31
 cut_inside inner
26 32
 
... ...
@@ -120,9 +120,12 @@ bool CmdParser::procCmd_cut_inside(std::istream &strm)
120 120
   if (!getLayerPolys(strm, layerName, layer, polys))
121 121
     return false;
122 122
 
123
-  // innner offset polygons
123
+  // inner offset polygons
124 124
   Polygons newPolys;
125
-  polys.createInnerOffset(mSettings.tool_diameter * 0.5, newPolys);
125
+  if (!polys.createInnerOffset(mSettings.tool_diameter * 0.5, newPolys)) {
126
+    std::cerr << "creating inner offset polygons failed" << std::endl;
127
+    return false;
128
+  }
126 129
 
127 130
   // convert polygons back to layer (containing paths)
128 131
   Layer newLayer;
... ...
@@ -148,10 +151,16 @@ bool CmdParser::procCmd_cut_outside(std::istream &strm)
148 151
   if (!getLayerPolys(strm, layerName, layer, polys))
149 152
     return false;
150 153
 
151
-  // TODO
152
-  std::cerr << "TODO: cut_outside" << std::endl;
154
+  // outer offset polygons
155
+  Polygons newPolys;
156
+  if (!polys.createOuterOffset(mSettings.tool_diameter * 0.5, newPolys)) {
157
+    std::cerr << "creating outer offset polygons failed" << std::endl;
158
+    return false;
159
+  }
160
+
161
+  // convert polygons back to layer (containing paths)
153 162
   Layer newLayer;
154
-  polys.writeToLayer(newLayer);
163
+  newPolys.writeToLayer(newLayer);
155 164
 
156 165
   // convert layer to G-code
157 166
   newLayer.toGCode(mSettings, mGCode);
... ...
@@ -155,14 +155,17 @@ bool Polygons::loadLayer(const Layer &layer, double eqDist)
155 155
  * @brief create inner offset polygons
156 156
  * @param[in] offset offset, > 0.0
157 157
  * @param[out] offsetPolys offset polygons (!= *this)
158
+ * @return if inner offset polygons could be constructed
158 159
  */
159
-void Polygons::createInnerOffset(double offset, Polygons &offsetPolys) const
160
+bool Polygons::createInnerOffset(double offset, Polygons &offsetPolys) const
160 161
 {
161 162
   // clear output polygons
162 163
   offsetPolys.mPolys.clear();
163 164
   // leave if tool diameter is invalid
164
-  if (offset <= 0.0)
165
-    return;
165
+  if (offset <= 0.0) {
166
+    std::cerr << "invalid polygon offset distance " << offset << std::endl;
167
+    return false;
168
+  }
166 169
 
167 170
   // process all polygons
168 171
   CgPolyHolesVec::const_iterator poly;
... ...
@@ -179,6 +182,34 @@ void Polygons::createInnerOffset(double offset, Polygons &offsetPolys) const
179 182
       offsetPolys.mPolys.push_back(**offPoly);
180 183
 
181 184
   } // for poly
185
+
186
+  return true;
187
+}
188
+
189
+/**
190
+ * @brief create outer offset polygons
191
+ * @param[in] offset offset, > 0.0
192
+ * @param[out] offsetPolys offset polygons (!= *this)
193
+ * @return if outer offset polygons could be constructed
194
+ */
195
+bool Polygons::createOuterOffset(double offset, Polygons &offsetPolys) const
196
+{
197
+  // clear output polygons
198
+  offsetPolys.mPolys.clear();
199
+  // leave if tool diameter is invalid
200
+  if (offset <= 0.0) {
201
+    std::cerr << "invalid polygon offset distance " << offset << std::endl;
202
+    return false;
203
+  }
204
+
205
+  // process all polygons
206
+  CgPolyHolesVec::const_iterator poly;
207
+  for (poly = mPolys.begin(); poly != mPolys.end(); ++poly) {
208
+    offsetPolys.mPolys.push_back(CgPolyHoles());
209
+    createOuterOffsetPoly(*poly, offset, offsetPolys.mPolys.back());
210
+  }
211
+
212
+  return true;
182 213
 }
183 214
 
184 215
 /**
... ...
@@ -202,6 +233,45 @@ void Polygons::writeToLayer(Layer &layer) const
202 233
   addToLayer(layer);
203 234
 }
204 235
 
236
+/**
237
+ * @brief create outer offset polygon
238
+ * @param[in] poly polygon to create outer offset of
239
+ * @param[in] offset offset, > 0.0
240
+ * @param[out] offsetPoly offset polygon (!= *this)
241
+ * @return if outer offset polygon could be constructed
242
+ */
243
+bool Polygons::createOuterOffsetPoly(const CgPolyHoles &poly, double offset,
244
+                                     CgPolyHoles &offsetPoly)
245
+{
246
+  // calculate outer offset of outer bondary
247
+  const CgPoly &outer = poly.outer_boundary();
248
+  CgPolyPtrVec outOffPolys =
249
+    CGAL::create_exterior_skeleton_and_offset_polygons_2(offset, outer);
250
+  /* outer Offset should now contain 2 polygons,
251
+     the artificially added very outer boundary and the offset polygon */
252
+  if (outOffPolys.size() != 2) {
253
+    std::cerr << "internal error during outer offset computation" << std::endl;
254
+    return false;
255
+  }
256
+  offsetPoly = CgPolyHoles(*outOffPolys.at(1)); // use offset polygon
257
+
258
+  // calculate inner offset of holes
259
+  CgPolyHoles::Hole_const_iterator hole;
260
+  for (hole = poly.holes_begin(); hole != poly.holes_end(); ++hole) {
261
+    CgPoly holeRev = *hole; // reverse orientation (make hole a normal poly)
262
+    holeRev.reverse_orientation();
263
+    CgPolyPtrVec inOffPolys =
264
+      CGAL::create_interior_skeleton_and_offset_polygons_2(offset, holeRev);
265
+    CgPolyPtrVec::iterator inOff; // add inner offset polys as new holes
266
+    for (inOff = inOffPolys.begin(); inOff != inOffPolys.end(); ++inOff) {
267
+      (*inOff)->reverse_orientation(); // re-reverse (make poly a hole again)
268
+      offsetPoly.add_hole(**inOff);
269
+    }
270
+  }
271
+
272
+  return true;
273
+}
274
+
205 275
 /**
206 276
  * @brief add a polygon as path to a layer
207 277
  * @param[in] poly polygon to add to layer
... ...
@@ -55,8 +55,17 @@ public:
55 55
    * @brief create inner offset polygons
56 56
    * @param[in] offset offset, > 0.0
57 57
    * @param[out] offsetPolys offset polygons (!= *this)
58
+   * @return if inner offset polygons could be constructed
58 59
    */
59
-  void createInnerOffset(double offset, Polygons &offsetPolys) const;
60
+  bool createInnerOffset(double offset, Polygons &offsetPolys) const;
61
+
62
+  /**
63
+   * @brief create outer offset polygons
64
+   * @param[in] offset offset, > 0.0
65
+   * @param[out] offsetPolys offset polygons (!= *this)
66
+   * @return if outer offset polygons could be constructed
67
+   */
68
+  bool createOuterOffset(double offset, Polygons &offsetPolys) const;
60 69
 
61 70
   /**
62 71
    * @brief add all polygons with holes as multiple paths to a layer
... ...
@@ -71,6 +80,16 @@ public:
71 80
   void writeToLayer(Layer &layer) const;
72 81
 
73 82
 protected:
83
+  /**
84
+   * @brief create outer offset polygon
85
+   * @param[in] poly polygon to create outer offset of
86
+   * @param[in] offset offset, > 0.0
87
+   * @param[out] offsetPoly offset polygon (!= *this)
88
+   * @return if outer offset polygon could be constructed
89
+   */
90
+  static bool createOuterOffsetPoly(const CgPolyHoles &poly, double offset,
91
+                                    CgPolyHoles &offsetPoly);
92
+
74 93
   /**
75 94
    * @brief add a polygon as path to a layer
76 95
    * @param[in] poly polygon to add to layer
77 96