Skip to main content

Python for Autocad® and Clones.

Project description

CAD-PyRx

Python for AutoCAD & Clones

CAD-PyRx is an ObjectARX module that exposes ObjectARX methods to Python, CAD-PyRx also exposes CAD's ActiveX API. Currently supported platforms are AutoCAD® 2021-2026, BricsCAD® V24.2-V25.2, GStarCAD® 2024-2026, and ZwCAD® 2024-2026

Features

  • uses wxPython for the GUI, support for Palette and Dialogs
  • degugpy to easily step through and debug your code
  • Jig, Overrule, Point monitor and other advanced tools
  • readDwgFile to open and manipulate side databases
  • import other python modules such as pandas

Installation

  • Install Python 3.12 as shown here
  • Install from PyPI (here):
    pip install cad-pyrx
  • Install from the trunk:
    python -m pip install git+https://github.com/CEXT-Dan/PyRx.git
  • Uninstall:
    python -m pip uninstall cad-pyrx

Use APPLOAD command or the startup suite to load PyRx in CAD application, example: Note: if you are using a VENV, this path may differ, it will be loacated where you installed it

_APPLOAD
%localappdata%\Programs\Python\Python312\Lib\site-packages\pyrx\RxLoaderZ25.0.zrx
or
RxLoader24.0.arx = 2021
RxLoader24.1.arx = 2022
RxLoader24.2.arx = 2023
RxLoader24.3.arx = 2024
RxLoader25.0.arx = 2025
RxLoader25.1.arx = 2026
RxLoaderV25.0.brx = BricsCAD v25

Sample

# use prefix PyRxCmd_ to define a command called doit1
def PyRxCmd_doit1():
    try:
        db = Db.curDb()
        filter = [(Db.DxfCode.kDxfStart, "LINE")]
        ps, ss = Ed.Editor.select(filter)
        if ps != Ed.PromptStatus.eOk:
            return

        lines = [Db.Line(id) for id in ss.objectIds()]
        for line in lines:
            print(line.startPoint().distanceTo(line.endPoint()))

    except Exception as err:
        traceback.print_exception(err)

# or use decorator to define a command called doit2
@Ap.Command("doit2", Ap.CmdFlags.kMODAL)
def function_setlayer():
    try:
        db = Db.curDb()
        ps, id, _ = Ed.Editor.entSel("\nSelect a line: ", Db.Line.desc())
        if ps != Ed.PromptStatus.eOk:
            return

        # all DbObjects accept an ID in the constructor
        # line is garbage collected and closed
        line = Db.Line(id, Db.OpenMode.kForWrite)
        line.setLayer("0")

    except Exception as err:
        traceback.print_exception(err)

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

cad_pyrx-2.2.22.4604.tar.gz (73.7 MB view details)

Uploaded Source

Built Distribution

cad_pyrx-2.2.22.4604-py3-none-any.whl (74.1 MB view details)

Uploaded Python 3

File details

Details for the file cad_pyrx-2.2.22.4604.tar.gz.

File metadata

  • Download URL: cad_pyrx-2.2.22.4604.tar.gz
  • Upload date:
  • Size: 73.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cad_pyrx-2.2.22.4604.tar.gz
Algorithm Hash digest
SHA256 749fb2db4a40144932d5bcce154e1ee7ae11fb36d4beaf08448fdd9893c1780f
MD5 8603d405b22efd4005c8a1f67ca47741
BLAKE2b-256 e70efaab9b690adbd3ef079a225f9f3574a838631f436594e47a8f473a1fba73

See more details on using hashes here.

Provenance

The following attestation bundles were made for cad_pyrx-2.2.22.4604.tar.gz:

Publisher: publish.yml on CEXT-Dan/PyRx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cad_pyrx-2.2.22.4604-py3-none-any.whl.

File metadata

  • Download URL: cad_pyrx-2.2.22.4604-py3-none-any.whl
  • Upload date:
  • Size: 74.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cad_pyrx-2.2.22.4604-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8a791b70406211dde76a35a0c85c443e6fe8f3d0bba91d9e04adf697228416
MD5 a56a32f92c91f6a774422acb303ce213
BLAKE2b-256 86cfdc96682218ce5456ffe2cec52916f747ec9ddbb8d415750178529bc6a768

See more details on using hashes here.

Provenance

The following attestation bundles were made for cad_pyrx-2.2.22.4604-py3-none-any.whl:

Publisher: publish.yml on CEXT-Dan/PyRx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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