[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Conversions between compas objects and CAD specific objects.

License

Notifications You must be signed in to change notification settings

biodigitalmatter/compas_convert

Repository files navigation

DEVELOPMENT DISCONTIUED

Conversion functions are now available upstream in compas_rhino.conversions since version 1.11.

There's no universal converter, that might become an upstreams PR in the future.

compas_convert

Build and test PyPI Package latest release Conda License

Conversions of COMPAS geometry objects to CAD specific objects.

Supported CAD environments

Installation

pip install compas_convert
python -m compas_rhino.install

This will install the package into your Rhino environment and add a grasshopper component next to the COMPAS package's components.

Documentation

The function convert which you can import from the top level of the package (from compas_convert import convert) will convert compas object to CAD object or CAD object to compas object. It does this based on the environment and the input object.

You can also use normal converter functions:

from compas.geometry import Point
from compas_convert.rhino import point_to_rhino_point

compas_pt = Point(10, 10, 0)
rhino_pt = point_to_rhino_pt(compas_pt)

Under the hood

Converter functions can be found in subpackages named after the CAD software it converts to and from. The modules are named compas_to_* and *_to_compas. The convert functions are decorated with the decorator compas_convert.register_converter where possible input types are specified and the output type.

This metadata is used by the function compas_convert.convert which on its first use maps types and converters and uses that mapping to convert object without the need to specify either input type or output type. Input type or output type can however be specified to override the default.

Conversion diagrams

Conversions