freecadparametricfea


Namefreecadparametricfea JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/da-crivelli/freecad-parametric-fea
SummaryA flexible parametric FEA library based on FreeCAD
upload_time2023-02-03 21:04:51
maintainer
docs_urlNone
authorDavide Crivelli,
requires_python>=3.8.10,<3.9.0
licenseLGPL-2.1-or-later
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # freecadparametricfea

 A flexible parametric FEA library based on [FreeCAD](https://www.freecadweb.org/), currently supporting FreeCAD 0.20. Some of this will be posted as a video tutorial on the [@engineeringmaths Youtube channel](https://www.youtube.com/@engineeringmaths)

> **Warning**
> this project is very early release, and should not be used for any serious structural analysis. It is aimed at hobbyists and makers

## Quickest start
Create a Python 3.8 virtual environment:

`pipenv --python 3.8`

Install the latest version from pypi:

`pipenv install freecadparametricfea`

then run any of the examples inside [the examples folder](examples/)

## Quick start

Create a FreeCAD part and assign names to the constraints that you want to change. You need to set up a FEA analysis as well, I have tested this using CalculiX and GMsh .

Then in a script, or on the command line, run:

```python
from FreecadParametricFEA import parametric as pfea
import numpy as np
# you need to manually specify the path to FreeCAD on your system, for now:
FREECAD_PATH = "C:/Program Files/FreeCAD 0.20/bin"

# initialise a parametric FEA object
fea = pfea(freecad_path=FREECAD_PATH)

# load the FreeCAD model
fea.set_model("your-part-here.fcstd")

# list the parameters to sweep:
fea.set_variables(
    [
        {
            "object_name": "CutsSketch", # the object where to find the constraint
            "constraint_name": "NotchDistance", # the constraint name that you assigned 
            "constraint_values": np.linspace(10, 30, 5), # the values you want to check
        },
        {
            "object_name": "CutsSketch",
            "constraint_name": "NotchDiam",
            "constraint_values": np.linspace(5, 9, 5),
        },
    ]
)

# setup the FEA analysis - we need to know the CalculiX results object and the solver name
fea.setup_fea(fea_results_name="CCX_Results", solver_name="SolverCcxTools")

# run and save the results (will return a Pandas DataFrame)
results = fea.run_parametric()

# plot the results
fea.plot_fea_results()
```

## Feeling fancy

You can export individual ParaView files using:

```python
results = fea.run_parametric(export_results=True)
```

Or just save the results dataframe in a .csv:

```python
fea.save_fea_results("results.csv")
```

... or even take a look at the parameters matrix before running any analysis:

```python
results = fea.run_parametric(dry_run=True)
```

# Contributing
I have created this for hobby and personal use, as I was interested in learning more about FreeCAD and writing Python modules. There are a lot of things that I would like to fix, if you want to get involved have a look at the [open issues](https://github.com/da-crivelli/freecad-parametric-fea/issues/) and send me a message if you have any questions.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/da-crivelli/freecad-parametric-fea",
    "name": "freecadparametricfea",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.10,<3.9.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Davide Crivelli,",
    "author_email": "da.crivelli@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/f4/1924d77e57783a78b992d19cf04a4cd06e97a3902cb49db8255fb848cf72/freecadparametricfea-0.1.1.tar.gz",
    "platform": null,
    "description": "# freecadparametricfea\n\n A flexible parametric FEA library based on [FreeCAD](https://www.freecadweb.org/), currently supporting FreeCAD 0.20. Some of this will be posted as a video tutorial on the [@engineeringmaths Youtube channel](https://www.youtube.com/@engineeringmaths)\n\n> **Warning**\n> this project is very early release, and should not be used for any serious structural analysis. It is aimed at hobbyists and makers\n\n## Quickest start\nCreate a Python 3.8 virtual environment:\n\n`pipenv --python 3.8`\n\nInstall the latest version from pypi:\n\n`pipenv install freecadparametricfea`\n\nthen run any of the examples inside [the examples folder](examples/)\n\n## Quick start\n\nCreate a FreeCAD part and assign names to the constraints that you want to change. You need to set up a FEA analysis as well, I have tested this using CalculiX and GMsh .\n\nThen in a script, or on the command line, run:\n\n```python\nfrom FreecadParametricFEA import parametric as pfea\nimport numpy as np\n# you need to manually specify the path to FreeCAD on your system, for now:\nFREECAD_PATH = \"C:/Program Files/FreeCAD 0.20/bin\"\n\n# initialise a parametric FEA object\nfea = pfea(freecad_path=FREECAD_PATH)\n\n# load the FreeCAD model\nfea.set_model(\"your-part-here.fcstd\")\n\n# list the parameters to sweep:\nfea.set_variables(\n    [\n        {\n            \"object_name\": \"CutsSketch\", # the object where to find the constraint\n            \"constraint_name\": \"NotchDistance\", # the constraint name that you assigned \n            \"constraint_values\": np.linspace(10, 30, 5), # the values you want to check\n        },\n        {\n            \"object_name\": \"CutsSketch\",\n            \"constraint_name\": \"NotchDiam\",\n            \"constraint_values\": np.linspace(5, 9, 5),\n        },\n    ]\n)\n\n# setup the FEA analysis - we need to know the CalculiX results object and the solver name\nfea.setup_fea(fea_results_name=\"CCX_Results\", solver_name=\"SolverCcxTools\")\n\n# run and save the results (will return a Pandas DataFrame)\nresults = fea.run_parametric()\n\n# plot the results\nfea.plot_fea_results()\n```\n\n## Feeling fancy\n\nYou can export individual ParaView files using:\n\n```python\nresults = fea.run_parametric(export_results=True)\n```\n\nOr just save the results dataframe in a .csv:\n\n```python\nfea.save_fea_results(\"results.csv\")\n```\n\n... or even take a look at the parameters matrix before running any analysis:\n\n```python\nresults = fea.run_parametric(dry_run=True)\n```\n\n# Contributing\nI have created this for hobby and personal use, as I was interested in learning more about FreeCAD and writing Python modules. There are a lot of things that I would like to fix, if you want to get involved have a look at the [open issues](https://github.com/da-crivelli/freecad-parametric-fea/issues/) and send me a message if you have any questions.\n\n\n",
    "bugtrack_url": null,
    "license": "LGPL-2.1-or-later",
    "summary": "A flexible parametric FEA library based on FreeCAD",
    "version": "0.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41eb552138fb3d69b72feeb966697fff52afb96a6e03dd6e9396c29dbe14cb31",
                "md5": "0f42bad24ea72bd40d9ff6e70a4d4ad5",
                "sha256": "536d6935a3bace146879e940da2d29ca952e80e955c45745ff4373037dc28128"
            },
            "downloads": -1,
            "filename": "freecadparametricfea-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f42bad24ea72bd40d9ff6e70a4d4ad5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.10,<3.9.0",
            "size": 17379,
            "upload_time": "2023-02-03T21:04:50",
            "upload_time_iso_8601": "2023-02-03T21:04:50.032662Z",
            "url": "https://files.pythonhosted.org/packages/41/eb/552138fb3d69b72feeb966697fff52afb96a6e03dd6e9396c29dbe14cb31/freecadparametricfea-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0f41924d77e57783a78b992d19cf04a4cd06e97a3902cb49db8255fb848cf72",
                "md5": "c8c683d2cbd70dffadc576da302fc820",
                "sha256": "b992d2202a0ab42a6aba78d518f51d7752dd46460d3c884caff48a0634ee71cb"
            },
            "downloads": -1,
            "filename": "freecadparametricfea-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c8c683d2cbd70dffadc576da302fc820",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.10,<3.9.0",
            "size": 16834,
            "upload_time": "2023-02-03T21:04:51",
            "upload_time_iso_8601": "2023-02-03T21:04:51.298744Z",
            "url": "https://files.pythonhosted.org/packages/e0/f4/1924d77e57783a78b992d19cf04a4cd06e97a3902cb49db8255fb848cf72/freecadparametricfea-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-03 21:04:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "da-crivelli",
    "github_project": "freecad-parametric-fea",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "freecadparametricfea"
}
        
Elapsed time: 0.03592s