AutoCAD


NameAutoCAD JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/Jones-peter
SummaryA professional AutoCAD automation package with many functions.
upload_time2025-07-14 20:01:22
maintainerNone
docs_urlNone
authorJones Peter
requires_pythonNone
licenseMIT
keywords autocad automation activex comtypes autocad autocadlib
VCS
bugtrack_url
requirements sphinx sphinx_rtd_theme myst-parser
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![acadlib.png](https://i.postimg.cc/xjBy2P1f/acadlib.png)](https://postimg.cc/5jqF5LzT)

# AutoCAD - python library Latest Version 0.1.8
[![GitHub](https://img.shields.io/badge/GitHub-Jones--peter-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/Jones-peter)  [![Instagram](https://img.shields.io/badge/Instagram-jones__peter__-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/jones_peter__/)  [![LinkedIn](https://img.shields.io/badge/LinkedIn-Jones--Peter-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jones-peter-121157221/)  [![Website](https://img.shields.io/badge/Website-jonespeter.site-0078D4?style=for-the-badge&logo=google-chrome&logoColor=white)](https://jonespeter.site)

[![PyPI version](https://img.shields.io/pypi/v/AutoCAD)](https://pypi.org/project/AutoCAD/)
[![Downloads](https://static.pepy.tech/badge/AutoCAD)](https://pepy.tech/project/AutoCAD)
[![License](https://img.shields.io/github/license/Jones-peter/AutoCAD)](https://github.com/Jones-peter/AutoCAD/blob/master/LICENSE)
## Overview

The `AutoCAD` module provides a comprehensive interface for interacting with AutoCAD through Python. It leverages the COM client to automate tasks within AutoCAD, allowing for efficient manipulation of drawings and objects.

## Features

- **Object Creation**: Create circles, lines, rectangles, ellipses, text, MText, dimensions, points, polylines, splines, arcs, and advanced tables.
- **Layer Management**: Create, delete, lock/unlock, and modify layers.
- **Block Operations**: Insert, export, and modify blocks and their attributes.
- **Group Management**: Create, add to, remove from, and select groups of objects.
- **User Interaction**: Request point, string, and integer inputs from the user.
- **View Management**: Control the drawing view with Zoom Extents and Zoom to Object.
- **Utility Functions**: Check if AutoCAD is installed or running.
- **Error Handling**: Custom exception handling for AutoCAD-related errors.

## Installation

Ensure you have Python installed along with the necessary packages:

```bash
pip install AutoCAD
```

## Usage

### Initialization 🎚️

To start using the module, initialize the `AutoCAD` class:

```python
from AutoCAD import AutoCAD

cad = AutoCAD()
```

### Object Creation 🪄

- **add_circle(center, radius)**: Adds a circle to the model space.

  ```python
  center = APoint(10, 10, 0)
  radius = 5
  circle = cad.add_circle(center, radius)
  ```

- **add_line(start_point, end_point)**: Adds a line to the model space.

  ```python
  start_point = APoint(0, 0, 0)
  end_point = APoint(10, 0, 0)
  line = cad.add_line(start_point, end_point)
  ```

- **add_rectangle(lower_left, upper_right)**: Adds a rectangle to the model space.

  ```python
  lower_left = APoint(0, 0, 0)
  upper_right = APoint(10, 5, 0)
  rectangle = cad.add_rectangle(lower_left, upper_right)
  ```

- **add_ellipse(center, major_axis, ratio)**: Adds an ellipse to the model space.

  ```python
  center = APoint(5, 5, 0)
  major_axis = APoint(10, 0, 0)
  ratio = 0.5
  ellipse = cad.add_ellipse(center, major_axis, ratio)
  ```

- **add_text(text)**: Adds a text object to the model space.

  ```python
  text = Text("Hello, AutoCAD!", APoint(5, 5, 0), 2.5)
  text_obj = cad.add_text(text)
  ```

- **add_dimension(dimension)**: Adds a dimension to the model space.

  ```python
  dimension = Dimension(APoint(0, 0, 0), APoint(10, 0, 0), APoint(5, -2, 0), DimensionType.ALIGNED)
  dimension_obj = cad.add_dimension(dimension)
  ```

- **add_point(point)**: Adds a point to the model space.

  ```python
  point = APoint(5, 5, 0)
  point_obj = cad.add_point(point)
  ```

- **add_polyline(points)**: Adds a polyline to the model space.

  ```python
  points = [APoint(0, 0, 0), APoint(5, 5, 0), APoint(10, 0, 0)]
  polyline = cad.add_polyline(points)
  ```

- **add_spline(points)**: Adds a spline to the model space.

  ```python
  points = [APoint(0, 0, 0), APoint(5, 5, 0), APoint(10, 0, 0)]
  spline = cad.add_spline(points)
  ```

- **add_arc(center, radius, start_angle, end_angle)**: Adds an arc to the model space.

  ```python
  center = APoint(5, 5, 0)
  radius = 5
  start_angle = 0
  end_angle = 180
  arc = cad.add_arc(center, radius, start_angle, end_angle)
  ```
  
- **add_table(table_obj)**: Adds a fully-featured table.
  ```python
  from AutoCAD import Table, Alignment
  data = [
      ["Row 1, Col 1", "Row 1, Col 2", "Row 1, Col 3"],
      ["Row 2, Col 1", "Row 2, Col 2", "Row 2, Col 3"]
  ]
  headers = ["Header 1", "Header 2", "Header 3"]
  table = Table(
      insertion_point=APoint(30, 30, 0),
      data=data,
      headers=headers,
      title="My Custom Table",
      col_widths=[30, 30, 30],
      text_height=2.0,
      alignment=Alignment.CENTER
  )
  table_obj = cad.add_table(table)
  ```

### Layer Management 🧩

- **create_layer(layer)**: Creates a new layer.

  ```python
  layer = Layer("MyLayer", Color.RED)
  new_layer = cad.create_layer(layer)
  ```

- **set_active_layer(layer_name)**: Sets the active layer.

  ```python
  cad.set_active_layer("MyLayer")
  ```

- **set_layer_visibility(layer_name, visible=True)**: Sets the visibility of a layer.

  ```python
  cad.set_layer_visibility("MyLayer", visible=False)
  ```

- **lock_layer(layer_name, lock=True)**: Locks or unlocks a layer.

  ```python
  cad.lock_layer("MyLayer", lock=True)
  ```

- **delete_layer(layer_name)**: Deletes a layer.

  ```python
  cad.delete_layer("MyLayer")
  ```

- **change_layer_color(layer_name, color)**: Changes the color of a layer.

  ```python
  cad.change_layer_color("MyLayer", Color.BLUE)
  ```

- **set_layer_linetype(layer_name, linetype_name)**: Sets the linetype of a layer.

  ```python
  cad.set_layer_linetype("MyLayer", "Dashed")
  ```

### Block Operations 🧱

- **insert_block(block)**: Inserts a block into the model space.

  ```python
  block = BlockReference("BlockName", APoint(5, 5, 0))
  block_ref = cad.insert_block(block)
  ```

- **get_block_extents(block_name)**: Gets the maximum extents of a block.

  ```python
  min_point, max_point = cad.get_block_extents("BlockName")
  ```

- **get_block_coordinates(block_name)**: Gets the insertion coordinates of a specific block.

  ```python
  block_coords = cad.get_block_coordinates("BlockName")
  ```

- **insert_block_from_file(file_path, insertion_point, scale=1.0, rotation=0.0)**: Inserts a block from a file.

  ```python
  block_ref = cad.insert_block_from_file("path/to/block.dwg", APoint(5, 5, 0))
  ```

- **export_block_to_file(block_name, file_path)**: Exports a block to a file.

  ```python
  cad.export_block_to_file("BlockName", "path/to/export.dwg")
  ```

- **modify_block_attribute(block_ref, tag, new_value)**: Modifies a block attribute.

  ```python
  cad.modify_block_attribute(block_ref, "TagName", "NewValue")
  ```

- **modify_block_attribute_by_old_value(block_ref, tag, old_value, new_value)**: Modifies a block attribute by old value.

  ```python
  cad.modify_block_attribute_by_old_value(block_ref, "TagName", "OldValue", "NewValue")
  ```

- **delete_block_attribute(block_ref, tag)**: Deletes a block attribute.

  ```python
  cad.delete_block_attribute(block_ref, "TagName")
  ```

### Group Management ⛓️

- **create_group(group_name, objects)**: Creates a group of objects.

  ```python
  group = cad.create_group("MyGroup", [circle, line])
  ```

- **add_to_group(group_name, objects)**: Adds objects to a group.

  ```python
  cad.add_to_group("MyGroup", [rectangle])
  ```

- **remove_from_group(group_name, objects)**: Removes objects from a group.

  ```python
  cad.remove_from_group("MyGroup", [line])
  ```

- **select_group(group_name)**: Selects a group of objects.

  ```python
  group_items = cad.select_group("MyGroup")
  ```

### User Interaction 🧑‍💻

- **get_user_input_point(prompt="Select a point")**: Requests point input from the user.

  ```python
  user_point = cad.get_user_input_point("Select a point")
  ```

- **get_user_input_string(prompt="Enter a string")**: Requests string input from the user.

  ```python
  user_string = cad.get_user_input_string("Enter a string")
  ```

- **get_user_input_integer(prompt="Enter an integer")**: Requests integer input from the user.

  ```python
  user_integer = cad.get_user_input_integer("Enter an integer")
  ```

- **show_message(message)**: Displays a message to the user.

  ```python
  cad.show_message("Operation completed successfully.")
  ```

### Document Management 📃📂

- **purge()**: Purges all unused elements in the active document.

  ```python
  cad.purge()
  ```

- **save_as(file_path)**: Saves the document with a new name.

  ```python
  cad.save_as("path/to/save.dwg")
  ```

- **save()**: Saves the active document.

  ```python
  cad.save()
  ```

- **close(save_changes=True)**: Closes the active document, optionally saving changes.

  ```python
  cad.close(save_changes=True)
  ```

- **open_file(file_path)**: Opens an existing file.

  ```python
  cad.open_file("path/to/open.dwg")
  ```
  
### View Management 🔍
- **zoom_extents():** Zooms the viewport to display all objects.

  ```python
  cad.zoom_extents()
  ```

- **zoom_to_object(obj)**: Zooms the viewport to fit a specific object.

  ```Python
  # Assuming 'circle' is an object created earlier
  cad.zoom_to_object(circle)
  ```

### Object Manipulation 🛠️

- **explode_object(obj)**: Explodes an object or a set of joined objects.

  ```python
  exploded_items = cad.explode_object(circle)
  ```

- **delete_object(obj)**: Deletes an object.

  ```python
  cad.delete_object(circle)
  ```

- **clone_object(obj, new_insertion_point)**: Clones an object.

  ```python
  cloned_obj = cad.clone_object(circle, APoint(15, 15, 0))
  ```

- **modify_object_property(obj, property_name, new_value)**: Modifies a property of an object.

  ```python
  cad.modify_object_property(circle, "Radius", 10)
  ```

- **repeat_block_horizontally(block_name, total_length, block_length, insertion_point)**: Repeats a block horizontally until a specified length is reached.

  ```python
  cad.repeat_block_horizontally("BlockName", 100, 10, APoint(0, 0, 0))
  ```

- **move_object(obj, new_insertion_point)**: Moves an object.

  ```python
  cad.move_object(circle, APoint(20, 20, 0))
  ```

- **scale_object(obj, base_point, scale_factor)**: Scales an object.

  ```python
  cad.scale_object(circle, APoint(5, 5, 0), 2)
  ```

- **rotate_object(obj, base_point, rotation_angle)**: Rotates an object.

  ```python
  cad.rotate_object(circle, APoint(5, 5, 0), 90)
  ```

- **align_objects(objects, alignment=Alignment.LEFT)**: Aligns objects based on the specified alignment.

  ```python
  cad.align_objects([circle, line], Alignment.LEFT)
  ```

- **distribute_objects(objects, spacing)**: Distributes objects with specified spacing.

  ```python
  cad.distribute_objects([circle, line, rectangle], 5)
  ```

- **get_entity_extents(entity):**: To get Min and Max Point of an Entity
  ```python
    min_point, max_point = cad.get_entity_extents(entity)
  ```

### Error Handling ❌

The module includes custom error handling through the `CADException` class, which provides detailed error messages for AutoCAD-related operations.

## Contributing 🤝💗
[![CONTRIBUTING](https://img.shields.io/badge/Contributing-Join%20Us-brightgreen)](CONTRIBUTING.md)


## Reporting Bugs 🪲

If you encounter a bug, please open an issue on GitHub. Please include the following:
* Your version of AutoCAD.
* A clear and concise description of the bug.
* Steps to reproduce the behavior.
* A code snippet demonstrating the issue.

## Suggesting Enhancements 💭📈

If you have an idea for a new feature, feel free to open an issue to discuss it. Please provide:
* A clear description of the feature and the problem it solves.
* Any sample code or use-cases you might have in mind.

## License 🔒

This project is licensed under the MIT License.

## Contact 📧

For any questions or support, please contact [jonespetersoftware@gmail.com].

## Credits 🥇🫡

This project was inspired by and builds upon the work from the following repositories:

- [AutoCAD by manufino](https://github.com/manufino/AutoCAD)
- [pyautocad by reclosedev](https://github.com/reclosedev/pyautocad)

> **Note**: This project is not affiliated with Autodesk AutoCAD in any way.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Jones-peter",
    "name": "AutoCAD",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "autocad, automation, activex, comtypes, AutoCAD, AutoCADlib",
    "author": "Jones Peter",
    "author_email": "jonespetersoftware@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/76/7026afd48206565e94ffe0c4fd8fffc2a3394c7f5e60a033f42cc1fff973/autocad-0.1.8.tar.gz",
    "platform": null,
    "description": "[![acadlib.png](https://i.postimg.cc/xjBy2P1f/acadlib.png)](https://postimg.cc/5jqF5LzT)\n\n# AutoCAD - python library Latest Version 0.1.8\n[![GitHub](https://img.shields.io/badge/GitHub-Jones--peter-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/Jones-peter)  [![Instagram](https://img.shields.io/badge/Instagram-jones__peter__-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/jones_peter__/)  [![LinkedIn](https://img.shields.io/badge/LinkedIn-Jones--Peter-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jones-peter-121157221/)  [![Website](https://img.shields.io/badge/Website-jonespeter.site-0078D4?style=for-the-badge&logo=google-chrome&logoColor=white)](https://jonespeter.site)\n\n[![PyPI version](https://img.shields.io/pypi/v/AutoCAD)](https://pypi.org/project/AutoCAD/)\n[![Downloads](https://static.pepy.tech/badge/AutoCAD)](https://pepy.tech/project/AutoCAD)\n[![License](https://img.shields.io/github/license/Jones-peter/AutoCAD)](https://github.com/Jones-peter/AutoCAD/blob/master/LICENSE)\n## Overview\n\nThe `AutoCAD` module provides a comprehensive interface for interacting with AutoCAD through Python. It leverages the COM client to automate tasks within AutoCAD, allowing for efficient manipulation of drawings and objects.\n\n## Features\n\n- **Object Creation**: Create circles, lines, rectangles, ellipses, text, MText, dimensions, points, polylines, splines, arcs, and advanced tables.\n- **Layer Management**: Create, delete, lock/unlock, and modify layers.\n- **Block Operations**: Insert, export, and modify blocks and their attributes.\n- **Group Management**: Create, add to, remove from, and select groups of objects.\n- **User Interaction**: Request point, string, and integer inputs from the user.\n- **View Management**: Control the drawing view with Zoom Extents and Zoom to Object.\n- **Utility Functions**: Check if AutoCAD is installed or running.\n- **Error Handling**: Custom exception handling for AutoCAD-related errors.\n\n## Installation\n\nEnsure you have Python installed along with the necessary packages:\n\n```bash\npip install AutoCAD\n```\n\n## Usage\n\n### Initialization \ud83c\udf9a\ufe0f\n\nTo start using the module, initialize the `AutoCAD` class:\n\n```python\nfrom AutoCAD import AutoCAD\n\ncad = AutoCAD()\n```\n\n### Object Creation \ud83e\ude84\n\n- **add_circle(center, radius)**: Adds a circle to the model space.\n\n  ```python\n  center = APoint(10, 10, 0)\n  radius = 5\n  circle = cad.add_circle(center, radius)\n  ```\n\n- **add_line(start_point, end_point)**: Adds a line to the model space.\n\n  ```python\n  start_point = APoint(0, 0, 0)\n  end_point = APoint(10, 0, 0)\n  line = cad.add_line(start_point, end_point)\n  ```\n\n- **add_rectangle(lower_left, upper_right)**: Adds a rectangle to the model space.\n\n  ```python\n  lower_left = APoint(0, 0, 0)\n  upper_right = APoint(10, 5, 0)\n  rectangle = cad.add_rectangle(lower_left, upper_right)\n  ```\n\n- **add_ellipse(center, major_axis, ratio)**: Adds an ellipse to the model space.\n\n  ```python\n  center = APoint(5, 5, 0)\n  major_axis = APoint(10, 0, 0)\n  ratio = 0.5\n  ellipse = cad.add_ellipse(center, major_axis, ratio)\n  ```\n\n- **add_text(text)**: Adds a text object to the model space.\n\n  ```python\n  text = Text(\"Hello, AutoCAD!\", APoint(5, 5, 0), 2.5)\n  text_obj = cad.add_text(text)\n  ```\n\n- **add_dimension(dimension)**: Adds a dimension to the model space.\n\n  ```python\n  dimension = Dimension(APoint(0, 0, 0), APoint(10, 0, 0), APoint(5, -2, 0), DimensionType.ALIGNED)\n  dimension_obj = cad.add_dimension(dimension)\n  ```\n\n- **add_point(point)**: Adds a point to the model space.\n\n  ```python\n  point = APoint(5, 5, 0)\n  point_obj = cad.add_point(point)\n  ```\n\n- **add_polyline(points)**: Adds a polyline to the model space.\n\n  ```python\n  points = [APoint(0, 0, 0), APoint(5, 5, 0), APoint(10, 0, 0)]\n  polyline = cad.add_polyline(points)\n  ```\n\n- **add_spline(points)**: Adds a spline to the model space.\n\n  ```python\n  points = [APoint(0, 0, 0), APoint(5, 5, 0), APoint(10, 0, 0)]\n  spline = cad.add_spline(points)\n  ```\n\n- **add_arc(center, radius, start_angle, end_angle)**: Adds an arc to the model space.\n\n  ```python\n  center = APoint(5, 5, 0)\n  radius = 5\n  start_angle = 0\n  end_angle = 180\n  arc = cad.add_arc(center, radius, start_angle, end_angle)\n  ```\n  \n- **add_table(table_obj)**: Adds a fully-featured table.\n  ```python\n  from AutoCAD import Table, Alignment\n  data = [\n      [\"Row 1, Col 1\", \"Row 1, Col 2\", \"Row 1, Col 3\"],\n      [\"Row 2, Col 1\", \"Row 2, Col 2\", \"Row 2, Col 3\"]\n  ]\n  headers = [\"Header 1\", \"Header 2\", \"Header 3\"]\n  table = Table(\n      insertion_point=APoint(30, 30, 0),\n      data=data,\n      headers=headers,\n      title=\"My Custom Table\",\n      col_widths=[30, 30, 30],\n      text_height=2.0,\n      alignment=Alignment.CENTER\n  )\n  table_obj = cad.add_table(table)\n  ```\n\n### Layer Management \ud83e\udde9\n\n- **create_layer(layer)**: Creates a new layer.\n\n  ```python\n  layer = Layer(\"MyLayer\", Color.RED)\n  new_layer = cad.create_layer(layer)\n  ```\n\n- **set_active_layer(layer_name)**: Sets the active layer.\n\n  ```python\n  cad.set_active_layer(\"MyLayer\")\n  ```\n\n- **set_layer_visibility(layer_name, visible=True)**: Sets the visibility of a layer.\n\n  ```python\n  cad.set_layer_visibility(\"MyLayer\", visible=False)\n  ```\n\n- **lock_layer(layer_name, lock=True)**: Locks or unlocks a layer.\n\n  ```python\n  cad.lock_layer(\"MyLayer\", lock=True)\n  ```\n\n- **delete_layer(layer_name)**: Deletes a layer.\n\n  ```python\n  cad.delete_layer(\"MyLayer\")\n  ```\n\n- **change_layer_color(layer_name, color)**: Changes the color of a layer.\n\n  ```python\n  cad.change_layer_color(\"MyLayer\", Color.BLUE)\n  ```\n\n- **set_layer_linetype(layer_name, linetype_name)**: Sets the linetype of a layer.\n\n  ```python\n  cad.set_layer_linetype(\"MyLayer\", \"Dashed\")\n  ```\n\n### Block Operations \ud83e\uddf1\n\n- **insert_block(block)**: Inserts a block into the model space.\n\n  ```python\n  block = BlockReference(\"BlockName\", APoint(5, 5, 0))\n  block_ref = cad.insert_block(block)\n  ```\n\n- **get_block_extents(block_name)**: Gets the maximum extents of a block.\n\n  ```python\n  min_point, max_point = cad.get_block_extents(\"BlockName\")\n  ```\n\n- **get_block_coordinates(block_name)**: Gets the insertion coordinates of a specific block.\n\n  ```python\n  block_coords = cad.get_block_coordinates(\"BlockName\")\n  ```\n\n- **insert_block_from_file(file_path, insertion_point, scale=1.0, rotation=0.0)**: Inserts a block from a file.\n\n  ```python\n  block_ref = cad.insert_block_from_file(\"path/to/block.dwg\", APoint(5, 5, 0))\n  ```\n\n- **export_block_to_file(block_name, file_path)**: Exports a block to a file.\n\n  ```python\n  cad.export_block_to_file(\"BlockName\", \"path/to/export.dwg\")\n  ```\n\n- **modify_block_attribute(block_ref, tag, new_value)**: Modifies a block attribute.\n\n  ```python\n  cad.modify_block_attribute(block_ref, \"TagName\", \"NewValue\")\n  ```\n\n- **modify_block_attribute_by_old_value(block_ref, tag, old_value, new_value)**: Modifies a block attribute by old value.\n\n  ```python\n  cad.modify_block_attribute_by_old_value(block_ref, \"TagName\", \"OldValue\", \"NewValue\")\n  ```\n\n- **delete_block_attribute(block_ref, tag)**: Deletes a block attribute.\n\n  ```python\n  cad.delete_block_attribute(block_ref, \"TagName\")\n  ```\n\n### Group Management \u26d3\ufe0f\n\n- **create_group(group_name, objects)**: Creates a group of objects.\n\n  ```python\n  group = cad.create_group(\"MyGroup\", [circle, line])\n  ```\n\n- **add_to_group(group_name, objects)**: Adds objects to a group.\n\n  ```python\n  cad.add_to_group(\"MyGroup\", [rectangle])\n  ```\n\n- **remove_from_group(group_name, objects)**: Removes objects from a group.\n\n  ```python\n  cad.remove_from_group(\"MyGroup\", [line])\n  ```\n\n- **select_group(group_name)**: Selects a group of objects.\n\n  ```python\n  group_items = cad.select_group(\"MyGroup\")\n  ```\n\n### User Interaction \ud83e\uddd1\u200d\ud83d\udcbb\n\n- **get_user_input_point(prompt=\"Select a point\")**: Requests point input from the user.\n\n  ```python\n  user_point = cad.get_user_input_point(\"Select a point\")\n  ```\n\n- **get_user_input_string(prompt=\"Enter a string\")**: Requests string input from the user.\n\n  ```python\n  user_string = cad.get_user_input_string(\"Enter a string\")\n  ```\n\n- **get_user_input_integer(prompt=\"Enter an integer\")**: Requests integer input from the user.\n\n  ```python\n  user_integer = cad.get_user_input_integer(\"Enter an integer\")\n  ```\n\n- **show_message(message)**: Displays a message to the user.\n\n  ```python\n  cad.show_message(\"Operation completed successfully.\")\n  ```\n\n### Document Management \ud83d\udcc3\ud83d\udcc2\n\n- **purge()**: Purges all unused elements in the active document.\n\n  ```python\n  cad.purge()\n  ```\n\n- **save_as(file_path)**: Saves the document with a new name.\n\n  ```python\n  cad.save_as(\"path/to/save.dwg\")\n  ```\n\n- **save()**: Saves the active document.\n\n  ```python\n  cad.save()\n  ```\n\n- **close(save_changes=True)**: Closes the active document, optionally saving changes.\n\n  ```python\n  cad.close(save_changes=True)\n  ```\n\n- **open_file(file_path)**: Opens an existing file.\n\n  ```python\n  cad.open_file(\"path/to/open.dwg\")\n  ```\n  \n### View Management \ud83d\udd0d\n- **zoom_extents():** Zooms the viewport to display all objects.\n\n  ```python\n  cad.zoom_extents()\n  ```\n\n- **zoom_to_object(obj)**: Zooms the viewport to fit a specific object.\n\n  ```Python\n  # Assuming 'circle' is an object created earlier\n  cad.zoom_to_object(circle)\n  ```\n\n### Object Manipulation \ud83d\udee0\ufe0f\n\n- **explode_object(obj)**: Explodes an object or a set of joined objects.\n\n  ```python\n  exploded_items = cad.explode_object(circle)\n  ```\n\n- **delete_object(obj)**: Deletes an object.\n\n  ```python\n  cad.delete_object(circle)\n  ```\n\n- **clone_object(obj, new_insertion_point)**: Clones an object.\n\n  ```python\n  cloned_obj = cad.clone_object(circle, APoint(15, 15, 0))\n  ```\n\n- **modify_object_property(obj, property_name, new_value)**: Modifies a property of an object.\n\n  ```python\n  cad.modify_object_property(circle, \"Radius\", 10)\n  ```\n\n- **repeat_block_horizontally(block_name, total_length, block_length, insertion_point)**: Repeats a block horizontally until a specified length is reached.\n\n  ```python\n  cad.repeat_block_horizontally(\"BlockName\", 100, 10, APoint(0, 0, 0))\n  ```\n\n- **move_object(obj, new_insertion_point)**: Moves an object.\n\n  ```python\n  cad.move_object(circle, APoint(20, 20, 0))\n  ```\n\n- **scale_object(obj, base_point, scale_factor)**: Scales an object.\n\n  ```python\n  cad.scale_object(circle, APoint(5, 5, 0), 2)\n  ```\n\n- **rotate_object(obj, base_point, rotation_angle)**: Rotates an object.\n\n  ```python\n  cad.rotate_object(circle, APoint(5, 5, 0), 90)\n  ```\n\n- **align_objects(objects, alignment=Alignment.LEFT)**: Aligns objects based on the specified alignment.\n\n  ```python\n  cad.align_objects([circle, line], Alignment.LEFT)\n  ```\n\n- **distribute_objects(objects, spacing)**: Distributes objects with specified spacing.\n\n  ```python\n  cad.distribute_objects([circle, line, rectangle], 5)\n  ```\n\n- **get_entity_extents(entity):**: To get Min and Max Point of an Entity\n  ```python\n    min_point, max_point = cad.get_entity_extents(entity)\n  ```\n\n### Error Handling \u274c\n\nThe module includes custom error handling through the `CADException` class, which provides detailed error messages for AutoCAD-related operations.\n\n## Contributing \ud83e\udd1d\ud83d\udc97\n[![CONTRIBUTING](https://img.shields.io/badge/Contributing-Join%20Us-brightgreen)](CONTRIBUTING.md)\n\n\n## Reporting Bugs \ud83e\udeb2\n\nIf you encounter a bug, please open an issue on GitHub. Please include the following:\n* Your version of AutoCAD.\n* A clear and concise description of the bug.\n* Steps to reproduce the behavior.\n* A code snippet demonstrating the issue.\n\n## Suggesting Enhancements \ud83d\udcad\ud83d\udcc8\n\nIf you have an idea for a new feature, feel free to open an issue to discuss it. Please provide:\n* A clear description of the feature and the problem it solves.\n* Any sample code or use-cases you might have in mind.\n\n## License \ud83d\udd12\n\nThis project is licensed under the MIT License.\n\n## Contact \ud83d\udce7\n\nFor any questions or support, please contact [jonespetersoftware@gmail.com].\n\n## Credits \ud83e\udd47\ud83e\udee1\n\nThis project was inspired by and builds upon the work from the following repositories:\n\n- [AutoCAD by manufino](https://github.com/manufino/AutoCAD)\n- [pyautocad by reclosedev](https://github.com/reclosedev/pyautocad)\n\n> **Note**: This project is not affiliated with Autodesk AutoCAD in any way.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A professional AutoCAD automation package with many functions.",
    "version": "0.1.8",
    "project_urls": {
        "Bug Tracker": "https://github.com/Jones-peter/AutoCAD/issues",
        "Documentation": "https://autocad-automation.readthedocs.io/",
        "Homepage": "https://github.com/Jones-peter/AutoCAD"
    },
    "split_keywords": [
        "autocad",
        " automation",
        " activex",
        " comtypes",
        " autocad",
        " autocadlib"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6204402978832b376c3712de0e8466d2a8668a6a05d12c41a574f638e577c4db",
                "md5": "4af21c12ed2feabd10eba2e3852e353b",
                "sha256": "1eb049d9a8d5c5d7a1b329d0cedddd3df68cfb08013969946271cb9a5aa73cb6"
            },
            "downloads": -1,
            "filename": "autocad-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4af21c12ed2feabd10eba2e3852e353b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16497,
            "upload_time": "2025-07-14T20:01:21",
            "upload_time_iso_8601": "2025-07-14T20:01:21.668703Z",
            "url": "https://files.pythonhosted.org/packages/62/04/402978832b376c3712de0e8466d2a8668a6a05d12c41a574f638e577c4db/autocad-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "12767026afd48206565e94ffe0c4fd8fffc2a3394c7f5e60a033f42cc1fff973",
                "md5": "cf997579a80b9756c9c4e3edfc456d72",
                "sha256": "a1ae8a224c23081612b111592af394825807c1ed343e8053737f04f01dfaad3d"
            },
            "downloads": -1,
            "filename": "autocad-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "cf997579a80b9756c9c4e3edfc456d72",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16464,
            "upload_time": "2025-07-14T20:01:22",
            "upload_time_iso_8601": "2025-07-14T20:01:22.865603Z",
            "url": "https://files.pythonhosted.org/packages/12/76/7026afd48206565e94ffe0c4fd8fffc2a3394c7f5e60a033f42cc1fff973/autocad-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 20:01:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jones-peter",
    "github_project": "AutoCAD",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "sphinx",
            "specs": []
        },
        {
            "name": "sphinx_rtd_theme",
            "specs": []
        },
        {
            "name": "myst-parser",
            "specs": []
        }
    ],
    "lcname": "autocad"
}
        
Elapsed time: 2.75981s