FreeCAD Importer Plugin
This plugin allows users to import FreeCAD models into CadQuery, and will apply parameters to the model if they are provided and the model is a parametric one (contains a FreeCAD spreadsheet document). At this time this plugin does not handle FreeCAD assemblies.
Installation
Something like an Anaconda environment with FreeCAD installed as a conda package may be required on some Linux distros like Ubuntu because of the requirement to use the FreeCAD Snap to get the latest version of FreeCAD. The Snap does not seem to allow FreeCAD to be imported properly in Python. If you do use Anaconda, name the environment freecad to help this plugin find it. See the documentation here for instructions on how to set up Anaconda without messing up your local Python installation. A example conda installation to get this plugin working is shown below.
mamba create -n freecad python=3.10
mamba install -c cadquery cadquery=master
mamba install freecad:freecad
Assuming that you have pip and git installed, the following line can be used to install this plugin.
pip install -e "git+https://github.com/CadQuery/cadquery-plugins.git#egg=freecad_import&subdirectory=plugins/freecad_import"
Dependencies
FreeCAD must be installed and importable via Python in order for this plugin to work. CadQuery is also required. To install CadQuery, follow the instructions here, or use the conda instructions above.
Usage
To use this plugin after it has been installed, import it to automatically patch its functions into the cadquery.importers package.
Here is an example of importing a parametric FreeCAD part.
import cadquery as cq
# The below adds the plugin's functions to cadquery.importers
from freecad_importer import import_freecad_part
# Imports a FreeCAD part while altering its parameters.
# The parameter must exist for the part or an errorr will be thrown.
result = import_freecad_part(
"path_to_freecad_part_file.FCStd", parameters={"mount_dia": {"value": 4.8, "units": "mm"}}
)
Here is an example of retrieving the parameters from a parametric FreeCAD part.
import cadquery as cq
# The below adds the plugin's functions to cadquery.importers
from freecad_importer import get_freecad_part_parameters
# Get the parameters from the objectr
params = get_freecad_part_parameters(
"path_to_freecad_part_file.FCStd", name_column_letter="A", value_column_letter="B"
)
The tests associated with this plugin have additional code that also might be useful to review as examples.
Metadata
Release files for cadquery-freecad-import-plugin 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cadquery_freecad_import_plugin-1.0.0.tar.gz | 5.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.1 MB
Release files / cadquery_freecad_import_plugin-1.0.0.tar.gz
| Download URL | cadquery_freecad_import_plugin-1.0.0.tar.gz |
|---|---|
| Size | 5.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c36ac8cacb213f0f657151eab96626e53419aeb84c508f2a3751c78843d2044d
|
|
BLAKE2b-256 checksum How to use checksums |
d772d555ac2a9d58eae079d219ce7d62b150c680a9a3fc1bcc8fcf7bba57df5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.9
|
Release files / cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl
| Download URL | cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40b7d0225d7bdb33f842d024b61a2a8b32aba394827c3ec8b35eca7c52a8b911
|
|
BLAKE2b-256 checksum How to use checksums |
84e0947633c6c13a7c9164a61405bb1cf98285f089895f31dc06a9a932e0cd4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.9
|