File size: 22,204 Bytes
985c397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | # ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
"""Class and methods to migrate old FEM App objects
see module end as well as forum topic
https://forum.freecad.org/viewtopic.php?&t=46218
"""
__title__ = "FEM class and methods that migrates old App objects"
__author__ = "Bernd Hahnebach"
__url__ = "https://www.freecad.org"
from importlib.util import spec_from_loader
import FreeCAD
class FemMigrateApp:
def find_spec(self, fullname, path, target=None):
if fullname in {
"femsolver.elmer.equations",
"femsolver.elmer.equations.fluxsolver",
"femsolver.elmer.solver",
"femobjects",
"femobjects._FemConstraintBodyHeatSource",
"femobjects._FemConstraintElectrostaticPotential",
"femobjects._FemConstraintFlowVelocity",
"femobjects._FemConstraintInitialFlowVelocity",
"femobjects._FemConstraintSelfWeight",
"femobjects._FemConstraintTie",
"femobjects._FemElementFluid1D",
"femobjects._FemElementGeometry1D",
"femobjects._FemElementGeometry2D",
"femobjects._FemElementRotation1D",
"femobjects._FemMaterial",
"femobjects._FemMaterialMechanicalNonlinear",
"femobjects._FemMaterialReinforced",
"femobjects._FemMeshBoundaryLayer",
"femobjects._FemMeshGmsh",
"femobjects._FemMeshGroup",
"femobjects._FemMeshRegion",
"femobjects._FemMeshResult",
"femobjects._FemResultMechanical",
"femobjects._FemSolverCalculix",
"PyObjects",
"PyObjects._FemConstraintBodyHeatSource",
"PyObjects._FemConstraintElectrostaticPotential",
"PyObjects._FemConstraintFlowVelocity",
"PyObjects._FemConstraintInitialFlowVelocity",
"PyObjects._FemConstraintSelfWeight",
"PyObjects._FemElementFluid1D",
"PyObjects._FemElementGeometry1D",
"PyObjects._FemElementGeometry2D",
"PyObjects._FemElementRotation1D",
"PyObjects._FemMaterial",
"PyObjects._FemMaterialMechanicalNonlinear",
"PyObjects._FemMeshBoundaryLayer",
"PyObjects._FemMeshGmsh",
"PyObjects._FemMeshGroup",
"PyObjects._FemMeshRegion",
"PyObjects._FemMeshResult",
"PyObjects._FemResultMechanical",
"PyObjects._FemSolverCalculix",
"PyObjects._FemSolverZ88",
"PyObjects._FemBeamSection",
"PyObjects._FemFluidSection",
"PyObjects._FemShellThickness",
"_FemBeamSection",
"_FemConstraintSelfWeight",
"_FemMaterial",
"_FemMaterialMechanicalNonlinear",
"_FemMeshGmsh",
"_FemMeshGroup",
"_FemMeshRegion",
"_FemResultMechanical",
"_FemShellThickness",
"_FemSolverCalculix",
"_FemSolverZ88",
"_FemMechanicalResult",
"FemResult",
"_MechanicalMaterial",
"FemBeamSection",
"FemShellThickness",
"MechanicalAnalysis",
"MechanicalMaterial",
}:
return spec_from_loader(fullname, self)
return None
def create_module(self, spec):
return None
def exec_module(self, module):
return self.load_module(module)
def load_module(self, module):
if module.__name__ == "femsolver.elmer.equations":
return self
if module.__name__ == "femsolver.elmer.equations.fluxsolver":
import femsolver.elmer.equations.flux
module.Proxy = femsolver.elmer.equations.flux.Proxy
if FreeCAD.GuiUp:
module.ViewProxy = femsolver.elmer.equations.flux.ViewProxy
if module.__name__ == "femsolver.elmer.solver":
from femobjects.solver_elmer import SolverElmer
module.Proxy = SolverElmer
if FreeCAD.GuiUp:
from femviewprovider.view_solver_elmer import VPSolverElmer
module.ViewProxy = VPSolverElmer
if module.__name__ == "femobjects":
module.__path__ = "femobjects"
if module.__name__ == "femobjects._FemConstraintBodyHeatSource":
import femobjects.constraint_bodyheatsource
module.Proxy = femobjects.constraint_bodyheatsource.ConstraintBodyHeatSource
if module.__name__ == "femobjects._FemConstraintElectrostaticPotential":
import femobjects.constraint_electrostaticpotential
module.Proxy = (
femobjects.constraint_electrostaticpotential.ConstraintElectrostaticPotential
)
if module.__name__ == "femobjects._FemConstraintFlowVelocity":
import femobjects.constraint_flowvelocity
module.Proxy = femobjects.constraint_flowvelocity.ConstraintFlowVelocity
if module.__name__ == "femobjects._FemConstraintInitialFlowVelocity":
import femobjects.constraint_initialflowvelocity
module.Proxy = femobjects.constraint_initialflowvelocity.ConstraintInitialFlowVelocity
if module.__name__ == "femobjects._FemConstraintSelfWeight":
import femobjects.constraint_selfweight
module._FemConstraintSelfWeight = femobjects.constraint_selfweight.ConstraintSelfWeight
if module.__name__ == "femobjects._FemConstraintTie":
import femobjects.constraint_tie
module._FemConstraintTie = femobjects.constraint_tie.ConstraintTie
if module.__name__ == "femobjects._FemElementFluid1D":
import femobjects.element_fluid1D
module._FemElementFluid1D = femobjects.element_fluid1D.ElementFluid1D
if module.__name__ == "femobjects._FemElementGeometry1D":
import femobjects.element_geometry1D
module._FemElementGeometry1D = femobjects.element_geometry1D.ElementGeometry1D
if module.__name__ == "femobjects._FemElementGeometry2D":
import femobjects.element_geometry2D
module._FemElementGeometry2D = femobjects.element_geometry2D.ElementGeometry2D
if module.__name__ == "femobjects._FemElementRotation1D":
import femobjects.element_rotation1D
module._FemElementRotation1D = femobjects.element_rotation1D.ElementRotation1D
if module.__name__ == "femobjects._FemMaterial":
import femobjects.material_common
module._FemMaterial = femobjects.material_common.MaterialCommon
if module.__name__ == "femobjects._FemMaterialMechanicalNonlinear":
import femobjects.material_mechanicalnonlinear
module._FemMaterialMechanicalNonlinear = (
femobjects.material_mechanicalnonlinear.MaterialMechanicalNonlinear
)
if module.__name__ == "femobjects._FemMaterialReinforced":
import femobjects.material_reinforced
module._FemMaterialReinforced = femobjects.material_reinforced.MaterialReinforced
if module.__name__ == "femobjects._FemMeshBoundaryLayer":
import femobjects.mesh_boundarylayer
module._FemMeshBoundaryLayer = femobjects.mesh_boundarylayer.MeshBoundaryLayer
if module.__name__ == "femobjects._FemMeshGmsh":
import femobjects.mesh_gmsh
module._FemMeshGmsh = femobjects.mesh_gmsh.MeshGmsh
if module.__name__ == "femobjects._FemMeshGroup":
import femobjects.mesh_group
module._FemMeshGroup = femobjects.mesh_group.MeshGroup
if module.__name__ == "femobjects._FemMeshRegion":
import femobjects.mesh_region
module._FemMeshRegion = femobjects.mesh_region.MeshRegion
if module.__name__ == "femobjects._FemMeshResult":
import femobjects.mesh_result
module._FemMeshResult = femobjects.mesh_result.MeshResult
if module.__name__ == "femobjects._FemResultMechanical":
import femobjects.result_mechanical
module._FemResultMechanical = femobjects.result_mechanical.ResultMechanical
if module.__name__ == "femobjects._FemSolverCalculix":
import femobjects.solver_ccxtools
module._FemSolverCalculix = femobjects.solver_ccxtools.SolverCcxTools
if module.__name__ == "PyObjects":
module.__path__ = "PyObjects"
if module.__name__ == "PyObjects._FemConstraintBodyHeatSource":
import femobjects.constraint_bodyheatsource
module.Proxy = femobjects.constraint_bodyheatsource.ConstraintBodyHeatSource
if module.__name__ == "PyObjects._FemConstraintElectrostaticPotential":
import femobjects.constraint_electrostaticpotential
module.Proxy = (
femobjects.constraint_electrostaticpotential.ConstraintElectrostaticPotential
)
if module.__name__ == "PyObjects._FemConstraintFlowVelocity":
import femobjects.constraint_flowvelocity
module.Proxy = femobjects.constraint_flowvelocity.ConstraintFlowVelocity
if module.__name__ == "PyObjects._FemConstraintInitialFlowVelocity":
import femobjects.constraint_initialflowvelocity
module.Proxy = femobjects.constraint_initialflowvelocity.ConstraintInitialFlowVelocity
if module.__name__ == "PyObjects._FemConstraintSelfWeight":
import femobjects.constraint_selfweight
module._FemConstraintSelfWeight = femobjects.constraint_selfweight.ConstraintSelfWeight
if module.__name__ == "PyObjects._FemElementFluid1D":
import femobjects.element_fluid1D
module._FemElementFluid1D = femobjects.element_fluid1D.ElementFluid1D
if module.__name__ == "PyObjects._FemElementGeometry1D":
import femobjects.element_geometry1D
module._FemElementGeometry1D = femobjects.element_geometry1D.ElementGeometry1D
if module.__name__ == "PyObjects._FemElementGeometry2D":
import femobjects.element_geometry2D
module._FemElementGeometry2D = femobjects.element_geometry2D.ElementGeometry2D
if module.__name__ == "PyObjects._FemElementRotation1D":
import femobjects.element_rotation1D
module._FemElementRotation1D = femobjects.element_rotation1D.ElementRotation1D
if module.__name__ == "PyObjects._FemMaterial":
import femobjects.material_common
module._FemMaterial = femobjects.material_common.MaterialCommon
if module.__name__ == "PyObjects._FemMaterialMechanicalNonlinear":
import femobjects.material_mechanicalnonlinear
module._FemMaterialMechanicalNonlinear = (
femobjects.material_mechanicalnonlinear.MaterialMechanicalNonlinear
)
if module.__name__ == "PyObjects._FemMeshBoundaryLayer":
import femobjects.mesh_boundarylayer
module._FemMeshBoundaryLayer = femobjects.mesh_boundarylayer.MeshBoundaryLayer
if module.__name__ == "PyObjects._FemMeshGmsh":
import femobjects.mesh_gmsh
module._FemMeshGmsh = femobjects.mesh_gmsh.MeshGmsh
if module.__name__ == "PyObjects._FemMeshGroup":
import femobjects.mesh_group
module._FemMeshGroup = femobjects.mesh_group.MeshGroup
if module.__name__ == "PyObjects._FemMeshRegion":
import femobjects.mesh_region
module._FemMeshRegion = femobjects.mesh_region.MeshRegion
if module.__name__ == "PyObjects._FemMeshResult":
import femobjects.mesh_result
module._FemMeshResult = femobjects.mesh_result.MeshResult
if module.__name__ == "PyObjects._FemResultMechanical":
import femobjects.result_mechanical
module._FemResultMechanical = femobjects.result_mechanical.ResultMechanical
if module.__name__ == "PyObjects._FemSolverCalculix":
import femobjects.solver_ccxtools
module._FemSolverCalculix = femobjects.solver_ccxtools.SolverCcxTools
if module.__name__ == "PyObjects._FemSolverZ88":
import femsolver.z88.solver
module._FemSolverZ88 = femsolver.z88.solver.Proxy
if module.__name__ == "PyObjects._FemBeamSection":
import femobjects.element_geometry1D
module._FemBeamSection = femobjects.element_geometry1D.ElementGeometry1D
if module.__name__ == "PyObjects._FemFluidSection":
import femobjects.element_fluid1D
module._FemFluidSection = femobjects.element_fluid1D.ElementFluid1D
if module.__name__ == "PyObjects._FemShellThickness":
import femobjects.element_geometry2D
module._FemShellThickness = femobjects.element_geometry2D.ElementGeometry2D
if module.__name__ == "_FemBeamSection":
import femobjects.element_geometry1D
module._FemBeamSection = femobjects.element_geometry1D.ElementGeometry1D
if module.__name__ == "_FemConstraintSelfWeight":
import femobjects.constraint_selfweight
module._FemConstraintSelfWeight = femobjects.constraint_selfweight.ConstraintSelfWeight
if module.__name__ == "_FemMaterial":
import femobjects.material_common
module._FemMaterial = femobjects.material_common.MaterialCommon
if module.__name__ == "_FemMaterialMechanicalNonlinear":
import femobjects.material_mechanicalnonlinear
module._FemMaterialMechanicalNonlinear = (
femobjects.material_mechanicalnonlinear.MaterialMechanicalNonlinear
)
if module.__name__ == "_FemMeshGmsh":
import femobjects.mesh_gmsh
module._FemMeshGmsh = femobjects.mesh_gmsh.MeshGmsh
if module.__name__ == "_FemMeshGroup":
import femobjects.mesh_group
module._FemMeshGroup = femobjects.mesh_group.MeshGroup
if module.__name__ == "_FemMeshRegion":
import femobjects.mesh_region
module._FemMeshRegion = femobjects.mesh_region.MeshRegion
if module.__name__ == "_FemResultMechanical":
import femobjects.result_mechanical
module._FemResultMechanical = femobjects.result_mechanical.ResultMechanical
if module.__name__ == "_FemShellThickness":
import femobjects.element_geometry2D
module._FemShellThickness = femobjects.element_geometry2D.ElementGeometry2D
if module.__name__ == "_FemSolverCalculix":
import femobjects.solver_ccxtools
module._FemSolverCalculix = femobjects.solver_ccxtools.SolverCcxTools
if module.__name__ == "_FemSolverZ88":
import femsolver.z88.solver
module._FemSolverZ88 = femsolver.z88.solver.Proxy
if module.__name__ == "_FemMechanicalResult":
import femobjects.result_mechanical
module._FemMechanicalResult = femobjects.result_mechanical.ResultMechanical
if module.__name__ == "FemResult":
import femobjects.result_mechanical
module.FemResult = femobjects.result_mechanical.ResultMechanical
if module.__name__ == "_MechanicalMaterial":
import femobjects.material_common
module._MechanicalMaterial = femobjects.material_common.MaterialCommon
if module.__name__ == "FemBeamSection":
import femobjects.element_geometry1D
module._FemBeamSection = femobjects.element_geometry1D.ElementGeometry1D
if FreeCAD.GuiUp:
import femviewprovider.view_element_geometry1D
module._ViewProviderFemBeamSection = (
femviewprovider.view_element_geometry1D.VPElementGeometry1D
)
if module.__name__ == "FemShellThickness":
import femobjects.element_geometry2D
module._FemShellThickness = femobjects.element_geometry2D.ElementGeometry2D
if FreeCAD.GuiUp:
import femviewprovider.view_element_geometry2D
module._ViewProviderFemShellThickness = (
femviewprovider.view_element_geometry2D.VPElementGeometry2D
)
if module.__name__ == "MechanicalAnalysis":
import femobjects.base_fempythonobject
module._FemAnalysis = femobjects.base_fempythonobject.BaseFemPythonObject
if FreeCAD.GuiUp:
import femviewprovider.view_base_femobject
module._ViewProviderFemAnalysis = (
femviewprovider.view_base_femobject.VPBaseFemObject
)
if module.__name__ == "MechanicalMaterial":
import femobjects.material_common
module._MechanicalMaterial = femobjects.material_common.MaterialCommon
if FreeCAD.GuiUp:
import femviewprovider.view_material_common
module._ViewProviderMechanicalMaterial = (
femviewprovider.view_material_common.VPMaterialCommon
)
return None
"""
possible entries in the old files:
(the class name in the old file does not matter, we ever only had one class per module)
further renaming objects
module="femsolver.elmer.equations.fluxsolver"
in this modules object class and viewprovider class are in same module
fourth big moving
renaming class and module names in femobjects
TODO add link to commit before the first commit
module="femobjects._FemConstraintBodyHeatSource"
module="femobjects._FemConstraintElectrostaticPotential"
module="femobjects._FemConstraintFlowVelocity"
module="femobjects._FemConstraintInitialFlowVelocity"
module="femobjects._FemConstraintSelfWeight"
module="femobjects._FemConstraintTie"
module="femobjects._FemElementFluid1D"
module="femobjects._FemElementGeometry1D"
module="femobjects._FemElementGeometry2D"
module="femobjects._FemElementRotation1D"
module="femobjects._FemMaterial"
module="femobjects._FemMaterialMechanicalNonlinear"
module="femobjects._FemMaterialReinforced"
module="femobjects._FemMeshBoundaryLayer"
module="femobjects._FemMeshGmsh"
module="femobjects._FemMeshGroup"
module="femobjects._FemMeshRegion"
module="femobjects._FemMeshResult"
module="femobjects._FemResultMechanical"
module="femobjects._FemSolverCalculix"
third big moving
from PyObjects to femobjects, following the parent commit
https://github.com/FreeCAD/FreeCAD/tree/07ae0e56c4/src/Mod/Fem/PyObjects
module="PyObjects._FemConstraintBodyHeatSource"
module="PyObjects._FemConstraintElectrostaticPotential"
module="PyObjects._FemConstraintFlowVelocity"
module="PyObjects._FemConstraintInitialFlowVelocity"
module="PyObjects._FemConstraintSelfWeight"
module="PyObjects._FemElementFluid1D"
module="PyObjects._FemElementGeometry1D"
module="PyObjects._FemElementGeometry2D"
module="PyObjects._FemElementRotation1D"
module="PyObjects._FemMaterial"
module="PyObjects._FemMaterialMechanicalNonlinear"
module="PyObjects._FemMeshBoundaryLayer"
module="PyObjects._FemMeshGmsh"
module="PyObjects._FemMeshGroup"
module="PyObjects._FemMeshRegion"
module="PyObjects._FemMeshResult"
module="PyObjects._FemResultMechanical"
module="PyObjects._FemSolverCalculix"
module="PyObjects._FemSolverZ88"
renamed between the second and third big moveings
module="PyObjects._FemBeamSection"
module="PyObjects._FemFluidSection"
module="PyObjects._FemShellThickness"
second big moveing
into PyObjects, following the parent commit
https://github.com/FreeCAD/FreeCAD/tree/7f884e8bff/src/Mod/Fem
module="_FemBeamSection"
module="_FemConstraintSelfWeight"
module="_FemMaterial"
module="_FemMaterialMechanicalNonlinear."
module="_FemMeshGmsh"
module="_FemMeshGroup"
module="_FemMeshRegion"
module="_FemResultMechanical"
module="_FemShellThickness"
module="_FemSolverCalculix"
module="_FemSolverZ88"
renamed between the first and second big moveings
module="_FemMechanicalResult"
module="FemResult"
module="_MechanicalMaterial"
first big moving
split modules from one module into make, obj class, vp class, command
new obj class module names had a _
following the parent commit of the first split commit
https://github.com/FreeCAD/FreeCAD/tree/c3328d6b4e/src/Mod/Fem
in this modules there where object class and viewprovider class together
module="FemBeamSection"
module="FemShellThickness"
module="MechanicalAnalysis"
module="MechanicalMaterial"
"""
|