Skip to main content

llows 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.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cadquery_freecad_import_plugin-1.0.0.tar.gz (5.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file cadquery_freecad_import_plugin-1.0.0.tar.gz.

File metadata

File hashes

Hashes for cadquery_freecad_import_plugin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c36ac8cacb213f0f657151eab96626e53419aeb84c508f2a3751c78843d2044d
MD5 8d98b3d6f430eadc8361462dce1403bd
BLAKE2b-256 d772d555ac2a9d58eae079d219ce7d62b150c680a9a3fc1bcc8fcf7bba57df5c

See more details on using hashes here.

File details

Details for the file cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cadquery_freecad_import_plugin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40b7d0225d7bdb33f842d024b61a2a8b32aba394827c3ec8b35eca7c52a8b911
MD5 4950f97468c0d5ab3149ca97fc500c3a
BLAKE2b-256 84e0947633c6c13a7c9164a61405bb1cf98285f089895f31dc06a9a932e0cd4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page