public static string ExtractCodeString(Param_String inputCode) { if (inputCode.VolatileDataCount > 0 && inputCode.VolatileData.PathCount > 0) { var goo = inputCode.VolatileData.get_Branch(0)[0] as IGH_Goo; if (goo != null) { string code; if (goo.CastTo(out code) && !string.IsNullOrEmpty(code)) { return(code); } } } else if (inputCode.PersistentDataCount > 0) // here to handle the lock and disabled components { var flat_list = inputCode.PersistentData.FlattenData(); if (flat_list != null && flat_list.Count > 0) { var stringData = flat_list[0]; if (stringData != null && !string.IsNullOrEmpty(stringData.Value)) { return(stringData.Value); } } } return(string.Empty); }
public IGH_Param CreateParameter(GH_ParameterSide side, int index) { IGH_Param p = new Param_String(); p.Name = "Expression";// + index.ToString(); p.NickName = "F"; p.Description = expressionStringParamDescription + index.ToString(); p.Access = GH_ParamAccess.item; return(p); }
public static void SetInput(GH_Component component, string text_input, int index = 0) { // instantiate new GH_String param var input = new Param_String(); input.CreateAttributes(); // set persistent data input.PersistentData.Append(new GH_String(text_input)); // add num to component input component.Params.Input[index].AddSource(input); }
public Param_String ConstructCodeInputParameter() { var code = new Param_String { Name = "code", NickName = "code", Description = "Python script to execute", }; return(code); }
private static Param_String ConstructOutOutputParam() { var outText = new Param_String { Name = "out", NickName = "out", Description = "The execution information, as output and error streams", }; return(outText); }
public IGH_Param CreateParameter(GH_ParameterSide side, int index) { Param_String newParam = new Param_String(); int n = Params.Input.Count; newParam.Name = "field_" + (n + 1).ToString(); newParam.NickName = "F" + (n + 1).ToString(); newParam.MutableNickName = true; newParam.Optional = true; return(newParam); }
public IGH_Param CreateParameter(GH_ParameterSide side, int index, bool is_twin) { switch (side) { case GH_ParameterSide.Input: return(CreateInputParam(side, index)); case GH_ParameterSide.Output: IGH_Param p; if (!is_twin) { if (used_script_variable_names == null) { used_script_variable_names = new List <string>(); script_variables_in_use = new List <string>(); } string script_variable = GH_ComponentParamServer.InventUniqueNickname("abcdefghijklmn", used_script_variable_names); used_script_variable_names.Add(script_variable); Param_GenericObject geom = new Param_GenericObject(); geom.NickName = script_variable; geom.Name = NickName; geom.Description = "Contains the translated geometry found in outie " + script_variable; p = geom; } else { if (Params.Output.Count <= 1) { return(null); } string nickname = AttNicknameFromGeomNickname(Params.Output[index - 1].NickName); Param_String prop = new Param_String(); prop.NickName = nickname; prop.Name = nickname; prop.Description = "Contains the non-geometric properties of the geometry found in the parameter above"; prop.MutableNickName = false; p = prop; } return(p); default: { return(null); } } }
/// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { Param_String param_String = new Param_String() { Optional = true }; param_String.SetPersistentData(new string[] { WallKind.Basic.ToString() }); inputParamManager.AddParameter(param_String, "_wallKinds_", "_wallKinds_", "_wallKinds_ \n *Connect SAMCore.WallKind", GH_ParamAccess.list); Param_Boolean param_Boolean = new Param_Boolean() { Optional = true }; param_Boolean.SetPersistentData(false); inputParamManager.AddParameter(param_Boolean, "_inverted_", "_inverted_", "Inverted_", GH_ParamAccess.item); }
/// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddNumberParameter("Sun Hours", "sunhours", "The hours of the year relevant for shade analysis", GH_ParamAccess.list); pManager.AddNumberParameter("Start of winter period", "winterStart", "Start of the winter period given as an hour", GH_ParamAccess.item); pManager.AddNumberParameter("End of winter period", "winterEnd", "End of the winter period given as an hour", GH_ParamAccess.item); pManager.AddTextParameter("Winter Weight String", "winterCoef", "Coeficient for the analysis in the winter period, given as text. The order should be Shade, View and Glare", GH_ParamAccess.item); pManager.AddTextParameter("Summer Weight String", "summerCoef", "Coeficient for the analysis in the Summer period, given as text. The order should be Shade, View and Glare", GH_ParamAccess.item); //Assign initial default data to the input parameters. Param_Number param0 = (Param_Number)pManager[0]; Param_Number param1 = (Param_Number)pManager[1]; Param_Number param2 = (Param_Number)pManager[2]; Param_String param3 = (Param_String)pManager[3]; Param_String param4 = (Param_String)pManager[4]; //Assign default sun hours GH_Structure <GH_Number> data = new GH_Structure <GH_Number>(); foreach (double d in new List <int>(new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 56, 57, 58, 59, 60, 61, 62, 63, 64, 80, 81, 82, 83, 84, 85, 86, 87, 88, 104, 105, 106, 107, 108, 109, 110, 111, 112, 128, 129, 130, 131, 132, 133, 134, 135, 136, 152, 153, 154, 155, 156, 157, 158, 159, 160, 176, 177, 178, 179, 180, 181, 182, 183, 184, 200, 201, 202, 203, 204, 205, 206, 207, 208, 224, 225, 226, 227, 228, 229, 230, 231, 232, 248, 249, 250, 251, 252, 253, 254, 255, 256, 272, 273, 274, 275, 276, 277, 278, 279, 280, 296, 297, 298, 299, 300, 301, 302, 303, 304, 320, 321, 322, 323, 324, 325, 326, 327, 328, 344, 345, 346, 347, 348, 349, 350, 351, 352, 368, 369, 370, 371, 372, 373, 374, 375, 376, 392, 393, 394, 395, 396, 397, 398, 399, 400, 416, 417, 418, 419, 420, 421, 422, 423, 424, 440, 441, 442, 443, 444, 445, 446, 447, 448, 464, 465, 466, 467, 468, 469, 470, 471, 472, 488, 489, 490, 491, 492, 493, 494, 495, 496, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 3005, 3006, 3007, 3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4853, 4854, 4855, 4856, 4857, 4858, 4859, 4860, 4861, 4862, 4863, 4864, 4865, 4866, 4867, 4877, 4878, 4879, 4880, 4881, 4882, 4883, 4884, 4885, 4886, 4887, 4888, 4889, 4890, 4891, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914, 4915, 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4936, 4937, 4938, 4939, 4949, 4950, 4951, 4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4985, 4986, 4987, 4997, 4998, 4999, 5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056, 5057, 5058, 5059, 5070, 5071, 5072, 5073, 5074, 5075, 5076, 5077, 5078, 5079, 5080, 5081, 5082, 5083, 5094, 5095, 5096, 5097, 5098, 5099, 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6174, 6175, 6176, 6177, 6178, 6179, 6180, 6181, 6182, 6183, 6184, 6185, 6186, 6198, 6199, 6200, 6201, 6202, 6203, 6204, 6205, 6206, 6207, 6208, 6209, 6210, 6222, 6223, 6224, 6225, 6226, 6227, 6228, 6229, 6230, 6231, 6232, 6233, 6246, 6247, 6248, 6249, 6250, 6251, 6252, 6253, 6254, 6255, 6256, 6257, 6270, 6271, 6272, 6273, 6274, 6275, 6276, 6277, 6278, 6279, 6280, 6281, 6294, 6295, 6296, 6297, 6298, 6299, 6300, 6301, 6302, 6303, 6304, 6305, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6751, 6752, 6753, 6754, 6755, 6756, 6757, 6758, 6759, 6760, 6761, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048, 7049, 7063, 7064, 7065, 7066, 7067, 7068, 7069, 7070, 7071, 7072, 7073, 7087, 7088, 7089, 7090, 7091, 7092, 7093, 7094, 7095, 7096, 7097, 7111, 7112, 7113, 7114, 7115, 7116, 7117, 7118, 7119, 7120, 7121, 7135, 7136, 7137, 7138, 7139, 7140, 7141, 7142, 7143, 7144, 7159, 7160, 7161, 7162, 7163, 7164, 7165, 7166, 7167, 7168, 7183, 7184, 7185, 7186, 7187, 7188, 7189, 7190, 7191, 7192, 7207, 7208, 7209, 7210, 7211, 7212, 7213, 7214, 7215, 7216, 7231, 7232, 7233, 7234, 7235, 7236, 7237, 7238, 7239, 7240, 7255, 7256, 7257, 7258, 7259, 7260, 7261, 7262, 7263, 7264, 7279, 7280, 7281, 7282, 7283, 7284, 7285, 7286, 7287, 7288, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8600, 8601, 8602, 8603, 8604, 8605, 8606, 8607, 8608, 8624, 8625, 8626, 8627, 8628, 8629, 8630, 8631, 8632, 8648, 8649, 8650, 8651, 8652, 8653, 8654, 8655, 8656, 8672, 8673, 8674, 8675, 8676, 8677, 8678, 8679, 8680, 8696, 8697, 8698, 8699, 8700, 8701, 8702, 8703, 8704, 8720, 8721, 8722, 8723, 8724, 8725, 8726, 8727, 8728, 8744, 8745, 8746, 8747, 8748, 8749, 8750, 8751, 8752 })) { data.Append(new GH_Number(d)); } param0.PersistentData.ClearData(); param0.PersistentData.AppendRange(data); //Assign default start and end of winter period based on winter official dates param1.PersistentData.ClearData(); param1.PersistentData.Append(new GH_Number(8472)); param2.PersistentData.ClearData(); param2.PersistentData.Append(new GH_Number(1872)); //Assign default weights for winter and summer periods based on the following order: shade, view, glare string[] coefs = { "1,1,-1", "-1,1,-1" }; param3.PersistentData.ClearData(); param3.PersistentData.Append(new GH_String(coefs[1])); param4.PersistentData.ClearData(); param4.PersistentData.Append(new GH_String(coefs[0])); }
/** * CreateParameter: check if the name already exists on the left hand side. If it does, do not create it. * Create new parameters on the fly */ public IGH_Param CreateParameter(GH_ParameterSide side, int index) { Param_String param = new Param_String(); string name = "Label"; string compareName = name; int iteration = 0; bool nameFound = false; while (nameFound == false) { bool NameExists = false; if (iteration > 0) { compareName = name + "_" + iteration.ToString(); } foreach (IGH_Param Input in this.Params.Input) { if (Input.NickName == compareName) { NameExists = true; break; } } if (NameExists) { iteration++; } else { nameFound = true; } } param.NickName = compareName; return(param); }
/** * CreateParameter: check if the name already exists on the left hand side. If it does, do not create it. * Create new parameters on the fly */ public IGH_Param CreateParameter(GH_ParameterSide side, int index) { Param_String param = new Param_String(); string name = "Label"; string compareName = name; int iteration = 0; bool nameFound = false; while (nameFound == false) { bool NameExists = false; if (iteration > 0) { compareName = name + "_" + iteration.ToString(); } foreach (IGH_Param Input in this.Params.Input) { if (Input.NickName == compareName) { NameExists = true; break; } } if (NameExists) { iteration++; } else { nameFound = true; } } param.NickName = compareName; return param; }
public static Response Grasshopper(NancyContext ctx) { // load grasshopper file var archive = new GH_Archive(); // TODO: stream to string var body = ctx.Request.Body.ToString(); string json = string.Empty; using (var reader = new StreamReader(ctx.Request.Body)) { json = reader.ReadToEnd(); } //GrasshopperInput input = Newtonsoft.Json.JsonConvert.DeserializeObject<GrasshopperInput>(json); //JsonSerializerSettings settings = new JsonSerializerSettings(); //settings.ContractResolver = new DictionaryAsArrayResolver(); Schema input = JsonConvert.DeserializeObject <Schema>(json); string grasshopperXml = string.Empty; if (input.Algo != null) { // If request contains markup byte[] byteArray = Convert.FromBase64String(input.Algo); grasshopperXml = System.Text.Encoding.UTF8.GetString(byteArray); } else { // If request contains pointer string pointer = input.Pointer; grasshopperXml = GetGhxFromPointer(pointer); } if (!archive.Deserialize_Xml(grasshopperXml)) { throw new Exception(); } var definition = new GH_Document(); if (!archive.ExtractObject(definition, "Definition")) { throw new Exception(); } // Set input params foreach (var obj in definition.Objects) { var group = obj as GH_Group; if (group == null) { continue; } if (group.NickName.Contains("RH_IN")) { // It is a RestHopper input group! GHTypeCodes code = (GHTypeCodes)Int32.Parse(group.NickName.Split(':')[1]); var param = group.Objects()[0]; //GH_Param<IGH_Goo> goo = obj as GH_Param<IGH_Goo>; // SetData foreach (Resthopper.IO.DataTree <ResthopperObject> tree in input.Values) { string paramname = tree.ParamName; if (group.NickName == paramname) { switch (code) { case GHTypeCodes.Boolean: //PopulateParam<GH_Boolean>(goo, tree); Param_Boolean boolParam = param as Param_Boolean; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Boolean> objectList = new List <GH_Boolean>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; bool boolean = JsonConvert.DeserializeObject <bool>(restobj.Data); GH_Boolean data = new GH_Boolean(boolean); boolParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Point: //PopulateParam<GH_Point>(goo, tree); Param_Point ptParam = param as Param_Point; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Point> objectList = new List <GH_Point>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Point3d rPt = JsonConvert.DeserializeObject <Rhino.Geometry.Point3d>(restobj.Data); GH_Point data = new GH_Point(rPt); ptParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Vector: //PopulateParam<GH_Vector>(goo, tree); Param_Vector vectorParam = param as Param_Vector; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Vector> objectList = new List <GH_Vector>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Vector3d rhVector = JsonConvert.DeserializeObject <Rhino.Geometry.Vector3d>(restobj.Data); GH_Vector data = new GH_Vector(rhVector); vectorParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Integer: //PopulateParam<GH_Integer>(goo, tree); Param_Integer integerParam = param as Param_Integer; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Integer> objectList = new List <GH_Integer>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; int rhinoInt = JsonConvert.DeserializeObject <int>(restobj.Data); GH_Integer data = new GH_Integer(rhinoInt); integerParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Number: //PopulateParam<GH_Number>(goo, tree); Param_Number numberParam = param as Param_Number; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Number> objectList = new List <GH_Number>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; double rhNumber = JsonConvert.DeserializeObject <double>(restobj.Data); GH_Number data = new GH_Number(rhNumber); numberParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Text: //PopulateParam<GH_String>(goo, tree); Param_String stringParam = param as Param_String; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_String> objectList = new List <GH_String>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; string rhString = JsonConvert.DeserializeObject <string>(restobj.Data); GH_String data = new GH_String(rhString); stringParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Line: //PopulateParam<GH_Line>(goo, tree); Param_Line lineParam = param as Param_Line; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Line> objectList = new List <GH_Line>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Line rhLine = JsonConvert.DeserializeObject <Rhino.Geometry.Line>(restobj.Data); GH_Line data = new GH_Line(rhLine); lineParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Curve: //PopulateParam<GH_Curve>(goo, tree); Param_Curve curveParam = param as Param_Curve; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Curve> objectList = new List <GH_Curve>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; GH_Curve ghCurve; try { Rhino.Geometry.Polyline data = JsonConvert.DeserializeObject <Rhino.Geometry.Polyline>(restobj.Data); Rhino.Geometry.Curve c = new Rhino.Geometry.PolylineCurve(data); ghCurve = new GH_Curve(c); } catch { Rhino.Geometry.NurbsCurve data = JsonConvert.DeserializeObject <Rhino.Geometry.NurbsCurve>(restobj.Data); Rhino.Geometry.Curve c = new Rhino.Geometry.NurbsCurve(data); ghCurve = new GH_Curve(c); } curveParam.AddVolatileData(path, i, ghCurve); } } break; case GHTypeCodes.Circle: //PopulateParam<GH_Circle>(goo, tree); Param_Circle circleParam = param as Param_Circle; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Circle> objectList = new List <GH_Circle>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Circle rhCircle = JsonConvert.DeserializeObject <Rhino.Geometry.Circle>(restobj.Data); GH_Circle data = new GH_Circle(rhCircle); circleParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.PLane: //PopulateParam<GH_Plane>(goo, tree); Param_Plane planeParam = param as Param_Plane; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Plane> objectList = new List <GH_Plane>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Plane rhPlane = JsonConvert.DeserializeObject <Rhino.Geometry.Plane>(restobj.Data); GH_Plane data = new GH_Plane(rhPlane); planeParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Rectangle: //PopulateParam<GH_Rectangle>(goo, tree); Param_Rectangle rectangleParam = param as Param_Rectangle; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Rectangle> objectList = new List <GH_Rectangle>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Rectangle3d rhRectangle = JsonConvert.DeserializeObject <Rhino.Geometry.Rectangle3d>(restobj.Data); GH_Rectangle data = new GH_Rectangle(rhRectangle); rectangleParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Box: //PopulateParam<GH_Box>(goo, tree); Param_Box boxParam = param as Param_Box; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Box> objectList = new List <GH_Box>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Box rhBox = JsonConvert.DeserializeObject <Rhino.Geometry.Box>(restobj.Data); GH_Box data = new GH_Box(rhBox); boxParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Surface: //PopulateParam<GH_Surface>(goo, tree); Param_Surface surfaceParam = param as Param_Surface; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Surface> objectList = new List <GH_Surface>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Surface rhSurface = JsonConvert.DeserializeObject <Rhino.Geometry.Surface>(restobj.Data); GH_Surface data = new GH_Surface(rhSurface); surfaceParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Brep: //PopulateParam<GH_Brep>(goo, tree); Param_Brep brepParam = param as Param_Brep; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Brep> objectList = new List <GH_Brep>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Brep rhBrep = JsonConvert.DeserializeObject <Rhino.Geometry.Brep>(restobj.Data); GH_Brep data = new GH_Brep(rhBrep); brepParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Mesh: //PopulateParam<GH_Mesh>(goo, tree); Param_Mesh meshParam = param as Param_Mesh; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Mesh> objectList = new List <GH_Mesh>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; Rhino.Geometry.Mesh rhMesh = JsonConvert.DeserializeObject <Rhino.Geometry.Mesh>(restobj.Data); GH_Mesh data = new GH_Mesh(rhMesh); meshParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Slider: //PopulateParam<GH_Number>(goo, tree); GH_NumberSlider sliderParam = param as GH_NumberSlider; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Number> objectList = new List <GH_Number>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; double rhNumber = JsonConvert.DeserializeObject <double>(restobj.Data); GH_Number data = new GH_Number(rhNumber); sliderParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.BooleanToggle: //PopulateParam<GH_Boolean>(goo, tree); GH_BooleanToggle toggleParam = param as GH_BooleanToggle; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Boolean> objectList = new List <GH_Boolean>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; bool rhBoolean = JsonConvert.DeserializeObject <bool>(restobj.Data); GH_Boolean data = new GH_Boolean(rhBoolean); toggleParam.AddVolatileData(path, i, data); } } break; case GHTypeCodes.Panel: //PopulateParam<GH_String>(goo, tree); GH_Panel panelParam = param as GH_Panel; foreach (KeyValuePair <string, List <ResthopperObject> > entree in tree) { GH_Path path = new GH_Path(GhPath.FromString(entree.Key)); List <GH_Panel> objectList = new List <GH_Panel>(); for (int i = 0; i < entree.Value.Count; i++) { ResthopperObject restobj = entree.Value[i]; string rhString = JsonConvert.DeserializeObject <string>(restobj.Data); GH_String data = new GH_String(rhString); panelParam.AddVolatileData(path, i, data); } } break; } } } } } Schema OutputSchema = new Schema(); OutputSchema.Algo = Utils.Base64Encode(string.Empty); // Parse output params foreach (var obj in definition.Objects) { var group = obj as GH_Group; if (group == null) { continue; } if (group.NickName.Contains("RH_OUT")) { // It is a RestHopper output group! GHTypeCodes code = (GHTypeCodes)Int32.Parse(group.NickName.Split(':')[1]); var param = group.Objects()[0] as IGH_Param; if (param == null) { continue; } try { param.CollectData(); param.ComputeData(); } catch (Exception) { param.Phase = GH_SolutionPhase.Failed; // TODO: throw something better throw; } // Get data Resthopper.IO.DataTree <ResthopperObject> OutputTree = new Resthopper.IO.DataTree <ResthopperObject>(); OutputTree.ParamName = group.NickName; var volatileData = param.VolatileData; for (int p = 0; p < volatileData.PathCount; p++) { List <ResthopperObject> ResthopperObjectList = new List <ResthopperObject>(); foreach (var goo in volatileData.get_Branch(p)) { if (goo == null) { continue; } else if (goo.GetType() == typeof(GH_Boolean)) { GH_Boolean ghValue = goo as GH_Boolean; bool rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <bool>(rhValue)); } else if (goo.GetType() == typeof(GH_Point)) { GH_Point ghValue = goo as GH_Point; Point3d rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Point3d>(rhValue)); } else if (goo.GetType() == typeof(GH_Vector)) { GH_Vector ghValue = goo as GH_Vector; Vector3d rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Vector3d>(rhValue)); } else if (goo.GetType() == typeof(GH_Integer)) { GH_Integer ghValue = goo as GH_Integer; int rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <int>(rhValue)); } else if (goo.GetType() == typeof(GH_Number)) { GH_Number ghValue = goo as GH_Number; double rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <double>(rhValue)); } else if (goo.GetType() == typeof(GH_String)) { GH_String ghValue = goo as GH_String; string rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <string>(rhValue)); } else if (goo.GetType() == typeof(GH_Line)) { GH_Line ghValue = goo as GH_Line; Line rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Line>(rhValue)); } else if (goo.GetType() == typeof(GH_Curve)) { GH_Curve ghValue = goo as GH_Curve; Curve rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Curve>(rhValue)); } else if (goo.GetType() == typeof(GH_Circle)) { GH_Circle ghValue = goo as GH_Circle; Circle rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Circle>(rhValue)); } else if (goo.GetType() == typeof(GH_Plane)) { GH_Plane ghValue = goo as GH_Plane; Plane rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Plane>(rhValue)); } else if (goo.GetType() == typeof(GH_Rectangle)) { GH_Rectangle ghValue = goo as GH_Rectangle; Rectangle3d rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Rectangle3d>(rhValue)); } else if (goo.GetType() == typeof(GH_Box)) { GH_Box ghValue = goo as GH_Box; Box rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Box>(rhValue)); } else if (goo.GetType() == typeof(GH_Surface)) { GH_Surface ghValue = goo as GH_Surface; Brep rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Brep>(rhValue)); } else if (goo.GetType() == typeof(GH_Brep)) { GH_Brep ghValue = goo as GH_Brep; Brep rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Brep>(rhValue)); } else if (goo.GetType() == typeof(GH_Mesh)) { GH_Mesh ghValue = goo as GH_Mesh; Mesh rhValue = ghValue.Value; ResthopperObjectList.Add(GetResthopperObject <Mesh>(rhValue)); } } GhPath path = new GhPath(new int[] { p }); OutputTree.Add(path.ToString(), ResthopperObjectList); } OutputSchema.Values.Add(OutputTree); } } if (OutputSchema.Values.Count < 1) { throw new System.Exceptions.PayAttentionException("Looks like you've missed something..."); // TODO } string returnJson = JsonConvert.SerializeObject(OutputSchema); return(returnJson); }
private static Param_String ConstructOutOutputParam() { var outText = new Param_String { Name = "out", NickName = "out", Description = "The execution information, as output and error streams", }; return outText; }
public Param_String ConstructCodeInputParameter() { var code = new Param_String { Name = "code", NickName = "code", Description = "Python script to execute", }; return code; }
public static string ExtractCodeString(Param_String inputCode) { if (inputCode.VolatileDataCount > 0 && inputCode.VolatileData.PathCount > 0) { var goo = inputCode.VolatileData.get_Branch(0)[0] as IGH_Goo; if (goo != null) { string code; if (goo.CastTo(out code) && !string.IsNullOrEmpty(code)) return code; } } else if (inputCode.PersistentDataCount > 0) // here to handle the lock and disabled components { var flat_list = inputCode.PersistentData.FlattenData(); if (flat_list != null && flat_list.Count > 0) { var stringData = flat_list[0]; if (stringData != null && !string.IsNullOrEmpty(stringData.Value)) { return stringData.Value; } } } return string.Empty; }
/*************************************/ /**** Public Methods ****/ /*************************************/ public static IGH_Param ToGH_Param(this ParamInfo info) { UnderlyingType subType = info.DataType.UnderlyingType(); IGH_Param param; switch (subType.Type.FullName) { case "System.Boolean": param = new Param_Boolean(); break; case "System.Drawing.Color": param = new Param_Colour(); break; case "System.DateTime": param = new Param_Time(); break; case "System.Double": param = new Param_Number(); break; case "System.Guid": param = new Param_Guid(); break; case "System.Int16": case "System.Int32": param = new Param_Integer(); break; case "System.Int64": param = new Param_Time(); break; case "System.String": param = new Param_String(); break; case "System.Type": param = new Param_Type(); break; default: Type type = subType.Type; if (typeof(IGeometry).IsAssignableFrom(type)) { param = new Param_BHoMGeometry(); } else if (typeof(IBHoMObject).IsAssignableFrom(type)) { param = new Param_BHoMObject(); } else if (typeof(IObject).IsAssignableFrom(type)) { param = new Param_IObject(); } else if (typeof(Enum).IsAssignableFrom(type)) { param = new Param_Enum(); } else if (typeof(IDictionary).IsAssignableFrom(type)) { param = new Param_Dictionary(); } else if (typeof(BHoMAdapter).IsAssignableFrom(type)) { param = new Param_BHoMAdapter(); } else { param = new Param_Variable { SelectedHint = new GH_NullHint(), PossibleHints = Helpers.AvailableHints, }; } break; } param.Access = (GH_ParamAccess)subType.Depth; param.Description = info.Description; param.Name = info.Name; param.NickName = info.Name; param.Optional = !info.IsRequired; //TODO: Is it necessary to react to param.AttributesChanged ? if (param is IBHoMParam) { ((IBHoMParam)param).ObjectType = subType.Type; } try { if (info.HasDefaultValue && !info.IsRequired) { var data = Helpers.IToGoo(info.DefaultValue as dynamic); SetPersistentData(param as dynamic, data as dynamic); } } catch { } return(param); }