JC
Back to all projects
Automated DWG Export and Offset Adjustment Rhino 3D (Python Script)

Tech Art & 3D · 2022

Automated DWG Export and Offset Adjustment Rhino 3D (Python Script)

This project involved creating a Python script to automate several processes in Rhino 3D, including exporting DWG files, adjusting offsets, and updating spreadsheets with new offset values. The script is designed to streamline workflow by handling repetitive tasks and ensuring co

PythonC++MayaRhinoMEL

This project involved creating a Python script to automate several processes in Rhino 3D, including exporting DWG files, adjusting offsets, and updating spreadsheets with new offset values. The script is designed to streamline workflow by handling repetitive tasks and ensuring consistency across project files.

What I delivered:

  • DWG Export Automation: Automatically exports selected DWG files from Rhino 3D, saving them with specific naming conventions and locations.
  • Offset Calculation and Application: Calculates the offset values for objects and applies them based on the selected mode, such as city grid or origin.
  • Spreadsheet Update: Updates Excel spreadsheets with the calculated offset values or new values if none are provided.
  • Flexible User Input: Provides a menu for users to select different export and adjustment options, enhancing the script's usability.
  • Offset Calculation:

Result: Production-tested tool, documented install, and revisions until the client workflow was stable.


Description:
This project involved creating a Python script to automate several processes in Rhino 3D, including exporting DWG files, adjusting offsets, and updating spreadsheets with new offset values. The script is designed to streamline workflow by handling repetitive tasks and ensuring consistency across project files.

Key Features:

  • DWG Export Automation: Automatically exports selected DWG files from Rhino 3D, saving them with specific naming conventions and locations.
  • Offset Calculation and Application: Calculates the offset values for objects and applies them based on the selected mode, such as city grid or origin.
  • Spreadsheet Update: Updates Excel spreadsheets with the calculated offset values or new values if none are provided.
  • Flexible User Input: Provides a menu for users to select different export and adjustment options, enhancing the script's usability.

Implementation:
The script was developed using Python, with integration into Rhino 3D and additional processing with external tools. Here’s a breakdown of the main features and technical details:

  • File Handling:
    • List Files: Retrieves files from specified directories based on their extensions.
    • Save DWG Files: Exports DWG files with proper naming and location, incorporating the current date.
  • Offset Calculation:
    • Bounding Box Analysis: Computes offsets based on the bounding box of objects.
    • Apply Offsets: Moves objects according to calculated or provided offsets.
  • Spreadsheet Integration:
    • Update Excel Files: Uses libraries like xlrd and xlutils to read and write offset values to spreadsheets.
  • User Interface:
    • Popup Menu: Allows users to choose from different export and adjustment modes, making the script adaptable to various scenarios.

Challenges Solved:

  • Automation of Repetitive Tasks: Streamlined the process of exporting DWG files and adjusting offsets, reducing manual effort.
  • Integration with External Tools: Successfully integrated Python with Rhino 3D and external tools for comprehensive functionality.
  • Dynamic Offset Management: Implemented flexible offset calculations and updates, accommodating different project requirements.