| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | """ |
| | from femexamples.constraint_transform_torque import setup() |
| | setup() |
| | |
| | """ |
| |
|
| | |
| | |
| | |
| |
|
| | import FreeCAD |
| |
|
| | import Fem |
| | import ObjectsFem |
| | from Part import makeLine |
| |
|
| | from . import manager |
| | from .manager import get_meshname |
| | from .manager import init_doc |
| |
|
| |
|
| | def get_information(): |
| | return { |
| | "name": "Constraint Transform Torque", |
| | "meshtype": "solid", |
| | "meshelement": "Tet10", |
| | "constraints": ["fixed", "force", "transform"], |
| | "solvers": ["ccxtools"], |
| | "material": "solid", |
| | "equations": ["mechanical"], |
| | } |
| |
|
| |
|
| | def get_explanation(header=""): |
| | return ( |
| | header |
| | + """ |
| | |
| | To run the example from Python console use: |
| | from femexamples.constraint_transform_torque import setup |
| | setup() |
| | |
| | |
| | See forum topic post: |
| | https://forum.freecad.org/viewtopic.php?f=18&t=19037&start=10#p515447 |
| | https://forum.freecad.org/viewtopic.php?t=19037 |
| | https://forum.freecad.org/viewtopic.php?t=18970 |
| | |
| | constraint transform with a constraint force |
| | |
| | """ |
| | ) |
| |
|
| |
|
| | def setup(doc=None, solvertype="ccxtools"): |
| |
|
| | if doc is None: |
| | doc = init_doc() |
| |
|
| | |
| | |
| | manager.add_explanation_obj(doc, get_explanation(manager.get_header(get_information()))) |
| |
|
| | |
| | sh_load_line = makeLine(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(0, 10, 0)) |
| | load_line = doc.addObject("Part::Feature", "Load_direction_line") |
| | load_line.Shape = sh_load_line |
| | doc.recompute() |
| | if FreeCAD.GuiUp: |
| | load_line.ViewObject.LineWidth = 5.0 |
| | load_line.ViewObject.LineColor = (1.0, 0.0, 0.0) |
| |
|
| | |
| | |
| | cylinder1 = doc.addObject("Part::Cylinder", "Cylinder1") |
| | cylinder1.Height = "50 mm" |
| | cylinder1.Radius = "5 mm" |
| | cylinder2 = doc.addObject("Part::Cylinder", "Cylinder2") |
| | cylinder2.Height = "50 mm" |
| | cylinder2.Radius = "4 mm" |
| | geom_obj = doc.addObject("Part::Cut", "Cut") |
| | geom_obj.Base = cylinder1 |
| | geom_obj.Tool = cylinder2 |
| | doc.recompute() |
| |
|
| | if FreeCAD.GuiUp: |
| | geom_obj.ViewObject.Document.activeView().viewAxonometric() |
| | geom_obj.ViewObject.Document.activeView().fitAll() |
| |
|
| | |
| | analysis = ObjectsFem.makeAnalysis(doc, "Analysis") |
| |
|
| | |
| | if solvertype == "ccxtools": |
| | solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools") |
| | solver_obj.WorkingDir = "" |
| | else: |
| | FreeCAD.Console.PrintWarning( |
| | "Unknown or unsupported solver type: {}. " |
| | "No solver object was created.\n".format(solvertype) |
| | ) |
| | if solvertype == "ccxtools": |
| | solver_obj.AnalysisType = "static" |
| | solver_obj.GeometricalNonlinearity = "linear" |
| | solver_obj.ThermoMechSteadyState = False |
| | solver_obj.MatrixSolverType = "default" |
| | solver_obj.IterationsControlParameterTimeUse = False |
| | solver_obj.SplitInputWriter = False |
| | analysis.addObject(solver_obj) |
| |
|
| | |
| | material_obj = ObjectsFem.makeMaterialSolid(doc, "MechanicalMaterial") |
| | mat = material_obj.Material |
| | mat["Name"] = "Calculix-Steel" |
| | mat["YoungsModulus"] = "210000 MPa" |
| | mat["PoissonRatio"] = "0.30" |
| | material_obj.Material = mat |
| | analysis.addObject(material_obj) |
| |
|
| | |
| | con_fixed = ObjectsFem.makeConstraintFixed(doc, "ConstraintFixed") |
| | con_fixed.References = [(geom_obj, "Face3")] |
| | analysis.addObject(con_fixed) |
| |
|
| | |
| | con_force = ObjectsFem.makeConstraintForce(doc, "ConstraintForce") |
| | con_force.References = [(geom_obj, "Face1")] |
| | con_force.Force = "2500.0 N" |
| | con_force.Direction = (load_line, ["Edge1"]) |
| | con_force.Reversed = True |
| | analysis.addObject(con_force) |
| |
|
| | |
| | con_transform = ObjectsFem.makeConstraintTransform(doc, name="ConstraintTransform") |
| | con_transform.References = [(geom_obj, "Face1")] |
| | con_transform.TransformType = "Cylindrical" |
| | analysis.addObject(con_transform) |
| |
|
| | |
| | from .meshes.mesh_transform_torque_tetra10 import create_nodes, create_elements |
| |
|
| | fem_mesh = Fem.FemMesh() |
| | control = create_nodes(fem_mesh) |
| | if not control: |
| | FreeCAD.Console.PrintError("Error on creating nodes.\n") |
| | control = create_elements(fem_mesh) |
| | if not control: |
| | FreeCAD.Console.PrintError("Error on creating elements.\n") |
| | femmesh_obj = analysis.addObject(ObjectsFem.makeMeshGmsh(doc, get_meshname()))[0] |
| | femmesh_obj.FemMesh = fem_mesh |
| | femmesh_obj.Shape = geom_obj |
| | femmesh_obj.SecondOrderLinear = False |
| |
|
| | doc.recompute() |
| | return doc |
| |
|