------------------- PyInit_PyModeling ------------------- The initialization function called by the Python interpreter when the 'modeling' module is loaded.
| 369 | // when the 'modeling' module is loaded. |
| 370 | // |
| 371 | PyMODINIT_FUNC |
| 372 | PyInit_PyModeling(void) |
| 373 | { |
| 374 | //std::cout << "[PyInit_PySolid] ========== load modeling module ==========" << std::endl; |
| 375 | |
| 376 | // Initialize the ModelingModeler class type. |
| 377 | SetModelingModelerTypeFields(PyModelingModelerType); |
| 378 | if (PyType_Ready(&PyModelingModelerType) < 0) { |
| 379 | fprintf(stdout,"Error in PyModelingModelerType"); |
| 380 | return SV_PYTHON_ERROR; |
| 381 | } |
| 382 | |
| 383 | // Initialize the ModelingModel class type. |
| 384 | SetModelingModelTypeFields(PyModelingModelType); |
| 385 | if (PyType_Ready(&PyModelingModelType) < 0) { |
| 386 | fprintf(stdout,"Error in PyModelingModelType"); |
| 387 | return SV_PYTHON_ERROR; |
| 388 | } |
| 389 | |
| 390 | // Initialize the Series class type. |
| 391 | SetModelingSeriesTypeFields(PyModelingSeriesType); |
| 392 | if (PyType_Ready(&PyModelingSeriesType) < 0) { |
| 393 | std::cout << "Error creating Series type" << std::endl; |
| 394 | return nullptr; |
| 395 | } |
| 396 | |
| 397 | // Initialize the OpenCascade class type. |
| 398 | SetOcctSolidTypeFields(PyOcctSolidType); |
| 399 | if (PyType_Ready(&PyOcctSolidType) < 0) { |
| 400 | std::cout << "Error creating OpenCascade type" << std::endl; |
| 401 | return nullptr; |
| 402 | } |
| 403 | |
| 404 | // Initialize the Parasolid class type. |
| 405 | SetParasolidSolidTypeFields(PyParasolidSolidType); |
| 406 | if (PyType_Ready(&PyParasolidSolidType) < 0) { |
| 407 | std::cout << "Error creating PolydataSolid type" << std::endl; |
| 408 | return nullptr; |
| 409 | } |
| 410 | |
| 411 | // Initialize the PolyData class type. |
| 412 | SetPolyDataSolidTypeFields(PyPolyDataSolidType); |
| 413 | if (PyType_Ready(&PyPolyDataSolidType) < 0) { |
| 414 | std::cout << "Error creating PolydataSolid type" << std::endl; |
| 415 | return nullptr; |
| 416 | } |
| 417 | |
| 418 | // Initialize the solid modeling kernel class type. |
| 419 | SetModelingKernelTypeFields(PyModelingKernelType); |
| 420 | if (PyType_Ready(&PyModelingKernelType) < 0) { |
| 421 | std::cout << "Error creating SolidKernel type" << std::endl; |
| 422 | return nullptr; |
| 423 | } |
| 424 | |
| 425 | // Create the 'solid' module. |
| 426 | auto module = PyModule_Create(&PyModelingModule); |
| 427 | if (module == NULL) { |
| 428 | fprintf(stdout,"Error in initializing pySolid"); |
nothing calls this directly
no test coverage detected