Script Help Needed Please



  • On 17/06/2014 at 22:07, xxxxxxxx wrote:

    I have put together a script to create a object from a python node and works great on my Cinema
    4D. Now I want to know from some of the experienced guys here if it could be written better so that
    it wont give me any problems in the future. I myself am a beginner so please guys don't just tell me
    to change this and that. Tell me WHY I must change it so I could understand better.


     
    Here is the sample file:

    _<_img src="http://www.c4dcafe.com/ipb/public/style_extra/mime_types/c4d.gif" border="0" alt="attached file" title="attached file" /_>_   Object Creation.c4d   
     
    Just click the "Create button" in the controls
     
    Here's the Script:

    import c4d
    from c4d.utils import *
      
    Points_List = [" 0, 64.279, 0, -76.605 "," 1, 50, 0, -86.603 "," 2, 34.202, 0, -93.97 "," 3, 76.605, 0, -64.279 "," 4, 86.603, 0, -50 "," 5, 17.365, 0, -98.481 "," 6, 0, 0, -100.001 "," 7, -50, 0, -86.603 "," 8, -34.202, 0, -93.97 "," 9, -64.279, 0, -76.605 "," 10, -76.605, 0, -64.279 "," 11, -17.365, 0, -98.481 "," 12, -86.603, 0, -50 "," 13, -93.97, 0, -34.202 "," 14, -98.482, 0, -17.365 "," 15, -100.001, 0, 0 "," 16, -98.482, 0, 17.365 "," 17, -93.97, 0, 34.203 "," 18, -86.603, 0, 50.001 "," 19, -76.605, 0, 64.28 "," 20, -64.279, 0, 76.605 "," 21, -50, 0, 86.604 "," 22, -34.202, 0, 93.97 "," 23, -17.365, 0, 98.482 "," 24, 0, 0, 100.001 "," 25, 17.365, 0, 98.482 "," 26, 34.202, 0, 93.97 "," 27, 50, 0, 86.604 "," 28, 64.279, 0, 76.605 "," 29, 76.605, 0, 64.28 "," 30, 86.603, 0, 50.001 "," 31, 93.97, 0, 34.203 "," 32, 98.482, 0, 17.365 "," 33, 100.001, 0, 0 "," 34, 98.482, 0, -17.365 "," 35, 93.97, 0, -34.202 "," 36, -97.273, 37.219, 17.152 "," 37, 52.446, 0, -90.75 "," 38, -92.817, 37.219, 33.783 "," 39, 68.263, 0, -81.618 "," 40, 36.552, 0, -99.926 "," 41, -17.601, 36.316, -99.22 "," 42, 85.154, 0, -71.866 "," 43, 0, 36.3, 100.774 "," 44, 105.629, 11.855, -60.985 "," 45, 19.661, 0, -109.678 "," 46, 0, 11.858, -121.967 "," 47, -17.5, 36.316, 99.248 "," 48, -94.701, 36.316, 34.469 "," 49, -99.255, 36.341, 17.501 "," 50, 0.001, 36.3, -100.774 "," 51, 50.396, 36.358, -87.288 "," 52, -52.407, 0, -90.772 "," 53, -85.541, 37.219, 49.386 "," 54, 98.774, 37.219, 0 "," 55, -97.273, 37.219, -17.151 "," 56, 97.273, 37.219, 17.152 "," 57, -33.784, 37.219, -92.816 "," 58, -75.666, 37.219, 63.49 "," 59, -63.491, 37.219, 75.664 "," 60, 64.784, 36.341, -77.207 "," 61, -87.273, 36.3, -50.387 "," 62, 63.49, 37.219, -75.665 "," 63, 49.386, 37.219, -85.541 "," 64, -36.552, 0, -99.926 "," 65, 17.15, 37.219, -97.273 "," 66, -68.625, 0, -81.409 "," 67, -34.471, 36.34, 94.708 "," 68, -34.471, 36.341, -94.708 "," 69, -85.153, 0, -71.866 "," 70, -98.774, 37.219, 0 "," 71, 85.54, 37.219, -49.387 "," 72, 75.665, 37.219, -63.491 "," 73, -19.661, 0, -109.678 "," 74, -87.273, 36.3, 50.387 "," 75, -104.566, 0, -60.371 "," 76, -104.814, 0, -37.813 "," 77, -50.396, 36.358, 87.288 "," 78, -104.814, 0, -18.308 "," 79, -64.784, 36.341, 77.207 "," 80, -104.814, 0, 0 "," 81, -104.814, 0, 18.308 "," 82, 0, 37.219, -98.773 "," 83, -77.201, 36.316, 64.779 "," 84, -104.814, 0, 37.812 "," 85, 49.386, 37.219, 85.541 "," 86, 99.812, 37.031, 0 "," 87, 98.294, 37.027, -17.332 "," 88, -17.153, 37.219, 97.273 "," 89, 93.789, 37.02, -34.137 "," 90, -0.001, 37.219, 98.774 "," 91, 104.814, 0, -37.813 "," 92, 98.294, 37.027, 17.332 "," 93, 93.789, 37.02, 34.137 "," 94, 77.201, 36.316, -64.779 "," 95, 86.436, 37.016, 49.904 "," 96, 76.458, 37.02, 64.156 "," 97, -19.389, 25.081, 109.966 "," 98, 0, 15.092, 120.851 "," 99, 105.88, 2, -38.201 "," 100, -0.12, 37.219, 0.02 "," 101, 87.273, 36.3, -50.387 "," 102, 97.273, 37.219, -17.152 "," 103, 92.817, 37.219, -33.783 "," 104, 105.88, 21.995, -38.533 "," 105, 105.88, 27.614, -18.667 "," 106, 17.5, 36.316, 99.248 "," 107, -85.541, 37.219, -49.386 "," 108, -92.817, 37.219, -33.782 "," 109, 0, 37.016, 99.808 "," 110, 17.331, 37.02, 98.293 "," 111, -17.332, 37.02, 98.292 "," 112, -49.906, 37.031, -86.44 "," 113, -64.157, 37.027, -76.459 "," 114, -76.458, 37.02, -64.155 "," 115, -34.137, 37.027, -93.791 "," 116, -17.439, 37.02, -98.263 "," 117, 34.137, 37.027, 93.792 "," 118, 86.436, 37.016, -49.904 "," 119, 76.458, 37.02, -64.156 "," 120, 85.54, 37.219, 49.387 "," 121, 92.817, 37.219, 33.783 "," 122, -63.491, 37.219, -75.664 "," 123, -75.666, 37.219, -63.489 "," 124, 105.88, 2, -18.496 "," 125, -104.934, 30.588, 18.503 "," 126, -104.928, 25.082, 38.191 "," 127, 64.157, 37.027, 76.46 "," 128, 49.906, 37.031, 86.44 "," 129, 49.906, 37.031, -86.44 "," 130, 34.137, 37.027, -93.791 "," 131, 64.157, 37.027, -76.46 "," 132, -99.255, 36.34, -17.501 "," 133, -94.701, 36.315, -34.469 "," 134, 52.467, 32.322, -90.875 "," 135, -76.458, 37.02, 64.156 "," 136, -64.157, 37.027, 76.459 "," 137, 68.491, 30.588, -81.624 "," 138, 75.665, 37.219, 63.491 "," 139, 104.814, 0, -18.308 "," 140, 104.814, 0, 0 "," 141, 105.376, 13.667, -60.839 "," 142, 34.471, 36.341, 94.708 "," 143, -49.906, 37.031, 86.44 "," 144, 104.678, 15.072, -60.436 "," 145, 50.396, 36.358, 87.288 "," 146, -86.436, 37.016, 49.904 "," 147, 17.331, 37.02, -98.293 "," 148, -34.137, 37.027, 93.791 "," 149, 105.88, 2, 18.496 "," 150, 105.88, 27.618, 18.667 "," 151, 77.201, 36.316, 64.779 "," 152, 105.88, 21.997, 38.533 "," 153, 0.001, 37.016, -99.808 "," 154, -93.79, 37.02, 34.137 "," 155, -98.294, 37.027, -17.332 "," 156, -93.79, 37.02, -34.137 "," 157, -86.436, 37.016, -49.904 "," 158, -99.812, 37.031, 0 "," 159, -98.294, 37.027, 17.332 "," 160, -104.937, 12.091, -61.674 "," 161, -104.679, 15.072, -60.436 "," 162, -105.635, 2, -60.988 "," 163, -105.383, 13.674, -60.843 "," 164, -105.035, 13.799, -61.174 "," 165, 105.88, 2, 38.201 "," 166, -68.263, 0, 81.618 "," 167, -85.154, 0, 71.866 "," 168, -86.022, 2, -72.595 "," 169, -105.499, 13.802, -60.363 "," 170, -86.31, 21.997, -72.429 "," 171, -69.112, 27.613, -82.358 "," 172, -69.32, 2, -82.238 "," 173, 52.407, 0, 90.772 "," 174, 36.552, 0, 99.926 "," 175, 85.538, 25.081, -71.775 "," 176, -105.88, 12.09, -60.041 "," 177, 105.025, 0.586, -61.092 "," 178, -105.378, 13.679, 60.84 "," 179, 105.88, 29.398, 0 "," 180, -105.88, 2, -60.051 "," 181, 105.88, 2, 0 "," 182, -0.934, 2, -121.72 "," 183, 0, 0, -120.725 "," 184, 0, 2, -121.97 "," 185, 0, 0.586, -121.61 "," 186, -0.433, 13.802, -121.546 "," 187, 0.406, 13.796, -121.553 "," 188, 0.934, 2, -121.72 "," 189, 0.943, 12.091, -121.715 "," 190, 105.88, 12.091, -60.04 "," 191, 105.635, 2, -60.988 "," 192, 105.323, 0.586, -60.808 "," 193, 104.566, 0, -60.371 "," 194, 104.936, 12.091, -61.675 "," 195, 104.946, 2, -61.669 "," 196, 105.475, 13.778, -60.424 "," 197, 105.045, 13.786, -61.153 "," 198, 105.88, 2, 60.051 "," 199, 104.566, 0, 60.371 "," 200, 105.635, 2, 60.988 "," 201, 105.319, 0.586, 60.806 "," 202, 105.439, 0.586, 60.32 "," 203, 105.019, 0.586, 61.095 "," 204, 104.946, 2, 61.669 "," 205, -105.88, 2, -18.496 "," 206, 104.936, 12.091, 61.675 "," 207, -105.88, 27.614, -18.667 "," 208, -105.88, 21.995, -38.533 "," 209, 64.784, 36.34, 77.207 "," 210, -105.88, 2, -38.201 "," 211, 19.39, 25.081, 109.966 "," 212, 0, 2, 121.97 "," 213, -19.57, 21.997, -110.961 "," 214, 94.701, 36.315, -34.469 "," 215, 0, 13.693, -121.665 "," 216, 0, 11.858, 121.967 "," 217, 87.273, 36.3, 50.387 "," 218, 17.5, 36.316, -99.248 "," 219, -0.943, 12.091, 121.715 "," 220, -0.934, 2, 121.72 "," 221, 0.943, 12.091, 121.715 "," 222, 0, 15.092, -120.851 "," 223, 34.471, 36.34, -94.708 "," 224, -19.857, 2, -110.795 "," 225, -19.661, 0, 109.678 "," 226, -36.552, 0, 99.926 "," 227, 0.934, 2, 121.72 "," 228, 0.417, 0.586, 121.49 "," 229, -0.441, 0.586, 121.484 "," 230, -105.88, 12.091, 60.041 "," 231, -68.958, 2, 82.447 "," 232, -69.106, 27.618, 82.361 "," 233, -86.31, 21.997, 72.429 "," 234, 94.701, 36.316, 34.469 "," 235, -86.023, 2, 72.594 "," 236, 52.94, 2, 91.695 "," 237, 52.94, 29.398, 91.695 "," 238, 36.774, 27.618, 101.028 "," 239, -105.88, 2, 60.052 "," 240, -105.064, 13.79, 61.142 "," 241, -105.483, 13.791, 60.413 "," 242, -105.019, 0.586, 61.098 "," 243, -105.41, 0.586, 60.451 "," 244, -104.937, 12.091, 61.674 "," 245, -104.946, 2, 61.669 "," 246, 36.922, 2, 100.943 "," 247, 63.49, 37.219, 75.666 "," 248, -104.928, 25.079, -38.192 "," 249, 99.255, 36.341, 17.501 "," 250, -104.934, 30.584, -18.503 "," 251, 100.791, 36.358, 0 "," 252, 68.958, 2, -82.447 "," 253, 69.106, 27.618, -82.361 "," 254, 86.31, 21.997, -72.429 "," 255, 86.023, 2, -72.594 "," 256, -105.88, 2, 38.201 "," 257, -105.88, 21.997, 38.533 "," 258, -105.88, 27.618, 18.667 "," 259, -105.88, 2, 18.496 "," 260, 36.443, 30.588, 100.127 "," 261, 52.467, 32.322, 90.875 "," 262, 19.57, 21.997, 110.961 "," 263, 19.857, 2, 110.795 "," 264, 68.491, 30.585, 81.624 "," 265, 85.539, 25.081, 71.775 "," 266, 104.928, 25.079, -38.192 "," 267, 104.678, 15.072, 60.436 "," 268, 36.443, 30.584, -100.127 "," 269, 19.389, 25.081, -109.966 "," 270, 104.928, 25.082, 38.191 "," 271, 104.934, 30.588, 18.503 "," 272, 104.934, 32.322, 0 "," 273, -105.63, 11.855, -60.985 "," 274, -105.323, 0.586, -60.808 "," 275, 104.934, 30.584, -18.503 "," 276, -104.934, 32.322, 0 "," 277, -52.467, 32.322, -90.875 "," 278, -68.491, 30.585, -81.624 "," 279, -85.539, 25.081, -71.775 "," 280, -0.368, 0.586, -121.505 "," 281, -19.398, 25.084, -109.961 "," 282, -105.46, 0.586, -60.244 "," 283, -36.443, 30.584, 100.127 "," 284, -36.443, 30.588, -100.127 "," 285, 105.629, 11.855, 60.985 "," 286, 105.371, 13.672, 60.836 "," 287, -36.922, 2, -100.943 "," 288, -36.774, 27.618, -101.028 "," 289, 104.814, 0, 18.308 "," 290, 104.814, 0, 37.812 "," 291, -105.635, 2, 60.989 "," 292, 68.958, 2, 82.447 "," 293, 69.106, 27.614, 82.361 "," 294, -105.63, 11.855, 60.985 "," 295, -104.679, 15.072, 60.436 "," 296, 52.94, 29.398, -91.694 "," 297, 52.979, 2, -91.672 "," 298, 36.922, 2, -100.943 "," 299, 36.774, 27.614, -101.028 "," 300, -52.467, 32.322, 90.875 "," 301, 0, 0, 120.725 "," 302, -52.94, 29.398, -91.695 "," 303, -52.94, 2, -91.695 "," 304, -85.538, 25.081, 71.775 "," 305, -68.491, 30.588, 81.624 "," 306, -52.407, 0, 90.772 "," 307, 105.068, 13.78, 61.127 "," 308, 85.153, 0, 71.866 "," 309, 68.262, 0, 81.618 "," 310, 0, 13.681, 121.678 "," 311, -19.57, 21.997, 110.961 "," 312, -19.857, 2, 110.795 "," 313, 0.444, 13.798, 121.55 "," 314, -36.774, 27.614, 101.028 "," 315, -36.922, 2, 100.943 "," 316, 19.57, 21.997, -110.961 "," 317, 19.857, 2, -110.795 "," 318, -105.88, 29.398, 0 "," 319, -105.88, 2, 0 "," 320, -52.94, 29.398, 91.695 "," 321, -52.94, 2, 91.695 "," 322, 86.31, 21.997, 72.429 "," 323, 86.022, 2, 72.595 "," 324, 19.661, 0, 109.678 "," 325, -105.623, 29.344, 18.624 "," 326, -105.625, 31.109, 0 "," 327, -105.623, 29.34, -18.624 "," 328, -36.814, 0.586, -100.644 "," 329, -52.784, 0.586, -91.424 "," 330, -69.118, 0.586, -81.994 "," 331, 68.753, 0.586, -82.204 "," 332, 85.766, 0.586, -72.382 "," 333, 105.428, 0.586, -60.375 "," 334, 19.52, 23.772, 110.698 "," 335, 36.684, 29.348, 100.788 "," 336, 52.813, 31.109, 91.474 "," 337, -105.62, 23.765, 38.442 "," 338, 86.107, 23.772, 72.254 "," 339, 68.943, 29.344, 82.163 "," 340, 105.48, 13.789, 60.393 "," 341, 19.801, 0.586, 110.467 "," 342, -0.446, 13.799, 121.55 "," 343, -19.802, 0.586, 110.467 "," 344, 19.802, 0.586, -110.467 "," 345, 36.814, 0.586, -100.645 "," 346, 52.823, 0.586, -91.402 "," 347, 105.568, 0.586, -38.085 "," 348, 105.568, 0.586, -18.44 "," 349, 0, 0.586, 121.61 "," 350, -104.566, 0, 60.371 "," 351, -86.108, 23.774, 72.255 "," 352, 105.568, 0.586, 18.44 "," 353, 105.568, 0.586, 0 "," 354, 0.438, 0.586, -121.484 "," 355, -19.801, 0.586, -110.467 "," 356, -85.766, 0.586, -72.382 "," 357, 36.814, 0.586, 100.644 "," 358, 52.784, 0.586, 91.424 "," 359, 68.753, 0.586, 82.204 "," 360, -52.813, 31.109, 91.474 "," 361, -68.942, 29.347, 82.163 "," 362, -36.684, 29.343, 100.787 "," 363, 68.943, 29.348, -82.163 "," 364, 86.107, 23.772, -72.254 "," 365, 52.813, 31.109, -91.474 "," 366, 36.684, 29.344, -100.788 "," 367, 19.52, 23.772, -110.698 "," 368, -0.943, 12.091, -121.715 "," 369, -52.813, 31.109, -91.474 "," 370, -68.944, 29.343, -82.162 "," 371, -86.107, 23.772, -72.254 "," 372, -105.568, 0.586, -38.085 "," 373, -105.568, 0.586, -18.44 "," 374, -105.568, 0.586, 0 "," 375, -105.568, 0.586, 38.085 "," 376, -105.568, 0.586, 18.44 "," 377, -36.684, 29.347, -100.787 "," 378, -19.52, 23.773, 110.699 "," 379, -105.323, 0.586, 60.808 "," 380, -104.95, 0.586, -61.164 "," 381, 105.88, 12.091, 60.04 "," 382, 85.766, 0.586, 72.382 "," 383, 105.568, 0.586, 38.085 "," 384, -104.946, 2, -61.669 "," 385, -105.626, 23.769, -38.444 "," 386, -68.753, 0.586, 82.204 "," 387, -85.766, 0.586, 72.382 "," 388, -52.784, 0.586, 91.424 "," 389, -36.814, 0.586, 100.644 "," 390, 105.88, 2, -60.051 "," 391, -19.522, 23.773, -110.697 "," 392, 105.623, 29.344, 18.624 "," 393, 105.625, 31.109, 0 "," 394, 105.623, 29.34, -18.624 "," 395, 105.626, 23.771, 38.444 "," 396, 105.62, 23.762, -38.442 "," 397, -49.388, 37.219, 85.54 "," 398, -33.783, 37.219, 92.817 "," 399, -49.388, 37.219, -85.54 "," 400, 33.781, 37.219, -92.817 "," 401, 99.255, 36.34, -17.501 "," 402, -100.791, 36.358, 0 "," 403, 17.15, 37.219, 97.273 "," 404, 33.781, 37.219, 92.817 "," 405, -17.261, 37.219, -97.244 "," 406, -64.784, 36.34, -77.207 "," 407, -50.396, 36.358, -87.288 "," 408, -77.201, 36.316, -64.779 ",]
    Poly_List = [" 0, 117, 404, 403, 110 "," 1, 37, 39, 0, 1 "," 2, 142, 117, 110, 106 "," 3, 40, 37, 1, 2 "," 4, 101, 118, 89, 214 "," 5, 39, 42, 3, 0 "," 6, 118, 71, 103, 89 "," 7, 195, 191, 192, 177 "," 8, 118, 101, 94, 119 "," 9, 45, 40, 2, 5 "," 10, 71, 118, 119, 72 "," 11, 6, 183, 45, 5 "," 12, 151, 96, 127, 209 "," 13, 52, 64, 8, 7 "," 14, 96, 138, 247, 127 "," 15, 66, 52, 7, 9 "," 16, 209, 127, 128, 145 "," 17, 69, 66, 9, 10 "," 18, 127, 247, 85, 128 "," 19, 64, 73, 11, 8 "," 20, 129, 51, 223, 130 "," 21, 182, 184, 185, 280 "," 22, 63, 129, 130, 400 "," 23, 273, 160, 384, 162 "," 24, 129, 63, 62, 131 "," 25, 176, 273, 162, 180 "," 26, 51, 129, 131, 60 "," 27, 78, 76, 13, 14 "," 28, 117, 142, 145, 128 "," 29, 80, 78, 14, 15 "," 30, 404, 117, 128, 85 "," 31, 81, 80, 15, 16 "," 32, 135, 83, 79, 136 "," 33, 84, 81, 16, 17 "," 34, 58, 135, 136, 59 "," 35, 144, 196, 141 "," 36, 43, 47, 97, 98 "," 37, 99, 104, 105, 124 "," 38, 125, 126, 48, 49 "," 39, 134, 51, 60, 137 "," 40, 139, 140, 33, 34 "," 41, 390, 190, 104, 99 "," 42, 149, 150, 152, 165 "," 43, 166, 167, 19, 20 "," 44, 168, 170, 171, 172 "," 45, 65, 82, 100 "," 46, 173, 174, 26, 27 "," 47, 143, 397, 59, 136 "," 48, 88, 90, 100 "," 49, 175, 94, 101, 144 "," 50, 102, 103, 100 "," 51, 245, 291, 379, 242 "," 52, 124, 105, 179, 181 "," 53, 205, 207, 208, 210 "," 54, 43, 98, 211, 106 "," 55, 213, 368, 182, 224 "," 56, 225, 226, 22, 23 "," 57, 100, 107, 108 "," 58, 77, 143, 136, 79 "," 59, 100, 120, 121 "," 60, 231, 232, 233, 235 "," 61, 100, 122, 123 "," 62, 236, 237, 238, 246 "," 63, 146, 74, 83, 135 "," 64, 132, 133, 248, 250 "," 65, 252, 253, 254, 255 "," 66, 138, 120, 100 "," 67, 255, 254, 194, 195 "," 68, 256, 257, 258, 259 "," 69, 211, 260, 142, 106 "," 70, 260, 261, 145, 142 "," 71, 262, 263, 246, 238 "," 72, 53, 146, 135, 58 "," 73, 264, 265, 151, 209 "," 74, 101, 214, 266, 144 "," 75, 217, 151, 265, 267 "," 76, 268, 269, 218, 223 "," 77, 218, 147, 130, 223 "," 78, 217, 267, 270, 234 "," 79, 247, 138, 100 "," 80, 270, 271, 249, 234 "," 81, 271, 272, 251, 249 "," 82, 397, 398, 100 "," 83, 100, 399, 122 "," 84, 147, 65, 400, 130 "," 85, 384, 160, 170, 168 "," 86, 47, 111, 148, 67 "," 87, 111, 88, 398, 148 "," 88, 400, 65, 100 "," 89, 143, 77, 67, 148 "," 90, 275, 266, 214, 401 "," 91, 397, 143, 148, 398 "," 92, 250, 276, 402, 132 "," 93, 82, 153, 116, 405 "," 94, 153, 50, 41, 116 "," 95, 153, 82, 65, 147 "," 96, 50, 153, 147, 218 "," 97, 403, 404, 100 "," 98, 100, 82, 405 "," 99, 38, 154, 146, 53 "," 100, 154, 48, 74, 146 "," 101, 155, 55, 108, 156 "," 102, 277, 278, 406, 407 "," 103, 132, 155, 156, 133 "," 104, 279, 408, 406, 278 "," 105, 157, 61, 133, 156 "," 106, 36, 38, 100 "," 107, 107, 157, 156, 108 "," 108, 401, 251, 272, 275 "," 109, 402, 158, 155, 132 "," 110, 158, 70, 55, 155 "," 111, 187, 215, 222 "," 112, 38, 53, 100 "," 113, 100, 54, 102 "," 114, 100, 108, 55 "," 115, 100, 56, 54 "," 116, 100, 90, 403 "," 117, 57, 399, 100 "," 118, 123, 107, 100 "," 119, 58, 59, 100 "," 120, 160, 273, 163, 164 "," 121, 159, 36, 70, 158 "," 122, 49, 159, 158, 402 "," 123, 48, 154, 159, 49 "," 124, 154, 38, 36, 159 "," 125, 157, 107, 123, 114 "," 126, 61, 157, 114, 408 "," 127, 62, 63, 100 "," 128, 60, 131, 119, 94 "," 129, 131, 62, 72, 119 "," 130, 12, 75, 69, 10 "," 131, 283, 97, 47, 67 "," 132, 281, 284, 68, 41 "," 133, 161, 163, 169 "," 134, 277, 407, 68, 284 "," 135, 12, 13, 76, 75 "," 136, 134, 268, 223, 51 "," 137, 180, 162, 274, 282 "," 138, 161, 61, 408, 279 "," 139, 161, 164, 163 "," 140, 61, 161, 248, 133 "," 141, 380, 274, 162, 384 "," 142, 75, 274, 380 "," 143, 125, 49, 402, 276 "," 144, 53, 58, 100 "," 145, 100, 121, 56 "," 146, 55, 70, 100 "," 147, 100, 71, 72 "," 148, 75, 282, 274 "," 149, 381, 198, 165, 152 "," 150, 150, 149, 181, 179 "," 151, 215, 186, 222 "," 152, 72, 62, 100 "," 153, 287, 288, 213, 224 "," 154, 189, 46, 215, 187 "," 155, 6, 11, 73, 183 "," 156, 50, 218, 269, 222 "," 157, 354, 185, 184, 188 "," 158, 41, 50, 222, 281 "," 159, 31, 32, 289, 290 "," 160, 184, 182, 368, 46 "," 161, 126, 295, 74, 48 "," 162, 186, 215, 46, 368 "," 163, 237, 236, 292, 293 "," 164, 230, 257, 256, 239 "," 165, 296, 297, 298, 299 "," 166, 34, 35, 91, 139 "," 167, 188, 184, 46, 189 "," 168, 280, 185, 183 "," 169, 185, 354, 183 "," 170, 144, 141, 197 "," 171, 42, 193, 4, 3 "," 172, 91, 35, 4, 193 "," 173, 197, 141, 44, 194 "," 174, 285, 206, 204, 200 "," 175, 333, 192, 191, 390 "," 176, 381, 285, 200, 198 "," 177, 67, 77, 300, 283 "," 178, 190, 44, 141, 196 "," 179, 193, 192, 333 "," 180, 193, 177, 192 "," 181, 398, 88, 100 "," 182, 220, 212, 216, 219 "," 183, 191, 195, 194, 44 "," 184, 302, 303, 172, 171 "," 185, 390, 191, 44, 190 "," 186, 79, 83, 304, 305 "," 187, 239, 291, 294, 230 "," 188, 243, 379, 291, 239 "," 189, 267, 286, 340 "," 190, 340, 286, 285, 381 "," 191, 202, 201, 199 "," 192, 267, 307, 286 "," 193, 198, 200, 201, 202 "," 194, 290, 199, 30, 31 "," 195, 60, 94, 175, 137 "," 196, 203, 201, 200, 204 "," 197, 308, 29, 30, 199 "," 198, 301, 228, 349 "," 199, 212, 227, 221, 216 "," 200, 313, 310, 216, 221 "," 201, 301, 349, 229 "," 202, 166, 20, 21, 306 "," 203, 300, 77, 79, 305 "," 204, 219, 216, 310, 342 "," 205, 209, 145, 261, 264 "," 206, 206, 285, 286, 307 "," 207, 225, 23, 24, 301 "," 208, 169, 163, 273, 176 "," 209, 227, 212, 349, 228 "," 210, 201, 203, 199 "," 211, 229, 349, 212, 220 "," 212, 309, 28, 29, 308 "," 213, 342, 310, 98 "," 214, 310, 313, 98 "," 215, 219, 311, 312, 220 "," 216, 244, 245, 235, 233 "," 217, 303, 302, 288, 287 "," 218, 18, 350, 84, 17 "," 219, 312, 311, 314, 315 "," 220, 316, 317, 188, 189 "," 221, 291, 245, 244, 294 "," 222, 59, 397, 100 "," 223, 296, 253, 252, 297 "," 224, 263, 262, 221, 227 "," 225, 103, 71, 100 "," 226, 404, 85, 100 "," 227, 295, 241, 178 "," 228, 405, 57, 100 "," 229, 258, 318, 319, 259 "," 230, 318, 207, 205, 319 "," 231, 240, 178, 294, 244 "," 232, 320, 232, 231, 321 "," 233, 314, 320, 321, 315 "," 234, 83, 74, 295, 304 "," 235, 140, 289, 32, 33 "," 236, 295, 178, 240 "," 237, 299, 298, 317, 316 "," 238, 230, 294, 178, 241 "," 239, 100, 85, 247 "," 240, 306, 21, 22, 226 "," 241, 173, 27, 28, 309 "," 242, 18, 19, 167, 350 "," 243, 204, 206, 322, 323 "," 244, 324, 25, 26, 174 "," 245, 322, 293, 292, 323 "," 246, 324, 301, 24, 25 "," 247, 242, 379, 350 "," 248, 379, 243, 350 "," 249, 70, 36, 100 "," 250, 63, 400, 100 "," 251, 208, 176, 180, 210 "," 252, 258, 325, 326, 318 "," 253, 325, 125, 276, 326 "," 254, 327, 207, 318, 326 "," 255, 250, 327, 326, 276 "," 256, 287, 328, 329, 303 "," 257, 328, 64, 52, 329 "," 258, 329, 52, 66, 330 "," 259, 303, 329, 330, 172 "," 260, 39, 331, 332, 42 "," 261, 331, 252, 255, 332 "," 262, 42, 332, 177, 193 "," 263, 332, 255, 195, 177 "," 264, 211, 334, 335, 260 "," 265, 334, 262, 238, 335 "," 266, 260, 335, 336, 261 "," 267, 335, 238, 237, 336 "," 268, 257, 337, 325, 258 "," 269, 337, 126, 125, 325 "," 270, 322, 338, 339, 293 "," 271, 338, 265, 264, 339 "," 272, 265, 338, 307, 267 "," 273, 338, 322, 206, 307 "," 274, 324, 341, 228, 301 "," 275, 341, 263, 227, 228 "," 276, 301, 229, 343, 225 "," 277, 229, 220, 312, 343 "," 278, 45, 344, 345, 40 "," 279, 344, 317, 298, 345 "," 280, 346, 37, 40, 345 "," 281, 297, 346, 345, 298 "," 282, 99, 347, 333, 390 "," 283, 347, 91, 193, 333 "," 284, 348, 139, 91, 347 "," 285, 124, 348, 347, 99 "," 286, 98, 313, 334, 211 "," 287, 313, 221, 262, 334 "," 288, 241, 295, 126, 337 "," 289, 230, 241, 337, 257 "," 290, 240, 244, 233, 351 "," 291, 295, 240, 351, 304 "," 292, 149, 352, 353, 181 "," 293, 352, 289, 140, 353 "," 294, 348, 124, 181, 353 "," 295, 139, 348, 353, 140 "," 296, 183, 354, 344, 45 "," 297, 354, 188, 317, 344 "," 298, 355, 73, 64, 328 "," 299, 224, 355, 328, 287 "," 300, 73, 355, 280, 183 "," 301, 355, 224, 182, 280 "," 302, 172, 330, 356, 168 "," 303, 330, 66, 69, 356 "," 304, 246, 357, 358, 236 "," 305, 357, 174, 173, 358 "," 306, 309, 359, 358, 173 "," 307, 359, 292, 236, 358 "," 308, 320, 360, 361, 232 "," 309, 360, 300, 305, 361 "," 310, 232, 361, 351, 233 "," 311, 361, 305, 304, 351 "," 312, 314, 362, 360, 320 "," 313, 362, 283, 300, 360 "," 314, 37, 346, 331, 39 "," 315, 346, 297, 252, 331 "," 316, 253, 363, 364, 254 "," 317, 363, 137, 175, 364 "," 318, 137, 363, 365, 134 "," 319, 363, 253, 296, 365 "," 320, 366, 299, 316, 367 "," 321, 268, 366, 367, 269 "," 322, 189, 187, 367, 316 "," 323, 187, 222, 269, 367 "," 324, 369, 302, 171, 370 "," 325, 277, 369, 370, 278 "," 326, 278, 370, 371, 279 "," 327, 370, 171, 170, 371 "," 328, 372, 76, 78, 373 "," 329, 210, 372, 373, 205 "," 330, 373, 78, 80, 374 "," 331, 205, 373, 374, 319 "," 332, 84, 375, 376, 81 "," 333, 375, 256, 259, 376 "," 334, 376, 259, 319, 374 "," 335, 81, 376, 374, 80 "," 336, 302, 369, 377, 288 "," 337, 369, 277, 284, 377 "," 338, 378, 311, 219, 342 "," 339, 97, 378, 342, 98 "," 340, 350, 243, 375, 84 "," 341, 243, 239, 256, 375 "," 342, 76, 372, 282, 75 "," 343, 372, 210, 180, 282 "," 344, 75, 380, 356, 69 "," 345, 380, 384, 168, 356 "," 346, 199, 203, 382, 308 "," 347, 203, 204, 323, 382 "," 348, 290, 383, 202, 199 "," 349, 383, 165, 198, 202 "," 350, 261, 336, 339, 264 "," 351, 336, 237, 293, 339 "," 352, 161, 169, 385, 248 "," 353, 169, 176, 208, 385 "," 354, 248, 385, 327, 250 "," 355, 385, 208, 207, 327 "," 356, 174, 357, 341, 324 "," 357, 357, 246, 263, 341 "," 358, 292, 359, 382, 323 "," 359, 359, 309, 308, 382 "," 360, 386, 231, 235, 387 "," 361, 166, 386, 387, 167 "," 362, 245, 242, 387, 235 "," 363, 242, 350, 167, 387 "," 364, 388, 321, 231, 386 "," 365, 306, 388, 386, 166 "," 366, 225, 343, 389, 226 "," 367, 343, 312, 315, 389 "," 368, 388, 306, 226, 389 "," 369, 321, 388, 389, 315 "," 370, 352, 149, 165, 383 "," 371, 289, 352, 383, 290 "," 372, 144, 197, 364, 175 "," 373, 197, 194, 254, 364 "," 374, 391, 213, 288, 377 "," 375, 281, 391, 377, 284 "," 376, 213, 391, 186, 368 "," 377, 391, 281, 222, 186 "," 378, 164, 161, 279, 371 "," 379, 160, 164, 371, 170 "," 380, 299, 366, 365, 296 "," 381, 366, 268, 134, 365 "," 382, 271, 392, 393, 272 "," 383, 392, 150, 179, 393 "," 384, 272, 393, 394, 275 "," 385, 393, 179, 105, 394 "," 386, 283, 362, 378, 97 "," 387, 362, 314, 311, 378 "," 388, 152, 395, 340, 381 "," 389, 395, 270, 267, 340 "," 390, 150, 392, 395, 152 "," 391, 392, 271, 270, 395 "," 392, 104, 396, 394, 105 "," 393, 396, 266, 275, 394 "," 394, 266, 396, 196, 144 "," 395, 396, 104, 190, 196 "," 396, 86, 251, 401, 87 "," 397, 54, 86, 87, 102 "," 398, 89, 103, 102, 87 "," 399, 214, 89, 87, 401 "," 400, 92, 56, 121, 93 "," 401, 249, 92, 93, 234 "," 402, 251, 86, 92, 249 "," 403, 86, 54, 56, 92 "," 404, 234, 93, 95, 217 "," 405, 93, 121, 120, 95 "," 406, 95, 120, 138, 96 "," 407, 217, 95, 96, 151 "," 408, 90, 109, 110, 403 "," 409, 109, 43, 106, 110 "," 410, 111, 47, 43, 109 "," 411, 88, 111, 109, 90 "," 412, 399, 112, 113, 122 "," 413, 112, 407, 406, 113 "," 414, 113, 406, 408, 114 "," 415, 122, 113, 114, 123 "," 416, 115, 68, 407, 112 "," 417, 57, 115, 112, 399 "," 418, 405, 116, 115, 57 "," 419, 116, 41, 68, 115 ",]
      
    Y_Sel_List = [36, 38, 41, 43, 44, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 67, 68, 70, 71, 72, 74, 77, 79, 82, 83, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 169, 170, 171, 175, 176, 178, 179, 186, 187, 189, 190, 194, 196, 197, 206, 207, 208, 209, 211, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 230, 232, 233, 234, 237, 238, 240, 241, 244, 247, 248, 249, 250, 251, 253, 254, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 275, 276, 277, 278, 279, 281, 283, 284, 285, 286, 288, 293, 294, 295, 296, 299, 300, 302, 304, 305, 307, 310, 311, 313, 314, 316, 318, 320, 322, 325, 326, 327, 334, 335, 336, 337, 338, 339, 340, 342, 351, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 377, 378, 381, 385, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408]
    XZ_Sel_List = [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, 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]
      
    def Hex_Std_Create() :
        obj_Hex_Std = doc.SearchObject("Hex_Head_Standard")
      
        if obj_Hex_Std == None:
           mypoly = c4d.BaseObject(c4d.Opolygon)
           mypoly.ResizeObject(409,420)
      
           for line in Points_List:
               coord = line.split(",")
      
               nr = int(coord[0])
               Vec_X = float(coord[1])
               Vec_Y = float(coord[2])
               Vec_Z = float(coord[3])
      
               mypoly.SetPoint(nr,c4d.Vector(Vec_X,Vec_Y,Vec_Z))
      
           for line in Poly_List:
               coord = line.split(",")
      
               if len(coord)<5:
                  nr = int(coord[0])
                  Pnt_1 = int(coord[1])
                  Pnt_2 = int(coord[2])
                  Pnt_3 = int(coord[3])
      
                  mypoly.SetPolygon(nr,c4d.CPolygon(Pnt_1,Pnt_2,Pnt_3))
      
               elif len(coord)==5:
                  nr = int(coord[0])
                  Pnt_1 = int(coord[1])
                  Pnt_2 = int(coord[2])
                  Pnt_3 = int(coord[3])
                  Pnt_4 = int(coord[4])
      
                  mypoly.SetPolygon(nr,c4d.CPolygon(Pnt_1,Pnt_2,Pnt_3,Pnt_4))
      
           doc.InsertObject(mypoly,None,None)          #Create Polygon
           mypoly.SetPhong(True,True,c4d.utils.Rad(60))#Add Phong Tag
           mypoly.SetName("Hex_Head_Standard")         #Rename Polygon
           mypoly.SetRelPos(c4d.Vector(0,0,0))         #Set pos of Polygon
           mypoly.Message(c4d.MSG_UPDATE)
      
           parent = doc.SearchObject("Bolt_Head")
           child = doc.SearchObject("Hex_Head_Standard")
      
           child.InsertUnder(parent)
      
    def Head_Adjust_Y() :
           obj_Hex_Std = doc.SearchObject("Hex_Head_Standard")
      
           for i in Y_Sel_List:
               N_List = Points_List
               coord = N_List.split(",")
      
               nr = int(coord[0])
               Vec_X = float(coord[1])
               Vec_Y = float(coord[2])
               Vec_Z = float(coord[3])
      
               PosYN = Vec_Y + Input2
               obj_Hex_Std.SetPoint(nr,c4d.Vector(Vec_X, PosYN, Vec_Z))
               obj_Hex_Std.Message (c4d.MSG_UPDATE)
      
    def Head_Adjust_XZ() :
           obj_Hex_Std = doc.SearchObject("Hex_Head_Standard")
      
           for i in XZ_Sel_List:
               Pnts = obj_Hex_Std.GetPoint(i)
               PosYN = Pnts.y
      
               N_List = Points_List
               coord = N_List.split(",")
      
               nr = int(coord[0])
               Vec_X = float(coord[1])
               Vec_Z = float(coord[3])
      
               PosXN = Vec_X * Input3
               PosZN = Vec_Z * Input3
               obj_Hex_Std.SetPoint(nr,c4d.Vector(PosXN, PosYN, PosZN))
               obj_Hex_Std.Message (c4d.MSG_UPDATE)
      
    def main() :
           if Input1 == True:
               return Hex_Std_Create(),Head_Adjust_Y(),Head_Adjust_XZ()
    

    Edit by NiklasR: Please use the [*code][*/code] tags (without * ) for posting code.




  • On 18/06/2014 at 10:45, xxxxxxxx wrote:

    I've tested your in script and everything is fine. I wouldn't worry to much about having it be compatible with the upcoming R16. If anything changes in the scripting area it will be documented and you can easily adjust the script.

    As far as how to make your script better, I don't think it needs anything different. I would however use a python generator for object creation rather than using XPresso.

    Keep in mind when you are posting scripts to use [C O D E] your code. [/ C O D E] minus the spaces:

    your code.
    


  • On 18/06/2014 at 22:04, xxxxxxxx wrote:

    @ShawnFrueh

    Thanks for taking the time to test my script _<_img src="http://www.c4dcafe.com/ipb/public/style_emoticons/default/signthankspin.gif" border="0" alt=":signthankspin:" title=":signthankspin:" /_>_

    The reason I chose Xpresso is I am going to use a lot of these and don't want to overcrowd my object manager and it would be easier for me to enable and disable some of the scripts in Xpresso but it would be nice to hear of some pro's and con's between the two.

    I tried to use [C O D E] when I posted my script but it keeps giving me "Internal error, something, something. Don't know if I'm doing something wrong 😊

    Thanks again for your feedback&n;_<_img src="http://www.c4dcafe.com/ipb/public/style_emoticons/default/signthankspin.gif" border="0" alt=":signthankspin:" title=":signthankspin:" /_>_" />


Log in to reply