This project facilitates the conversion of 2D engineering sketches into 3D models. It leverages OpenCV for shape recognition, utilizes tries and graphs for entity relationships, and employs SOLIDWORKS with VBA scripts for 3D modelling. Developed as part of the TEB (MIT-101) coursework under the MEID Department at IIT Roorkee.
- Shape Detection: Utilizes OpenCV to identify basic geometric shapes (e.g., rectangles, squares) from 2D sketches.
- Dimension Extraction: Extracts dimensions from identified shapes to inform 3D modelling.
- Entity Relationship Mapping: Employs tries and graphs to map relationships between different entities in the sketch.
- 3D Modelling: Generates 3D models using SOLIDWORKS via VBA scripting based on the extracted data.
- Interactive User Input: Prompts users to specify whether the shape is simple or complex, adjusting the processing accordingly.
- Python 3.x
- OpenCV: For image processing and shape detection.
- SOLIDWORKS: For 3D modelling.
- VBA Support: Enabled in SOLIDWORKS for script execution.
-
Clone the Repository:
git clone https://github.com/advikasinha/2D-3D-modelling.git cd 2D-3D-modelling -
Install Dependencies:
pip install -r requirements.txt
-
Prepare Your 2D Sketch: Ensure your 2D sketch is in a compatible image format (e.g., PNG, JPEG) and placed in the appropriate directory.
-
Run the Script:
python codev1.py
-
Follow Prompts: The script will prompt you to specify the type of shape:
- Enter
1for a simple shape. - Enter
2for a complex shape (e.g., a rectangle containing a square).
- Enter
-
Output: The script will process the image, extract dimensions, and generate a 3D model in SOLIDWORKS using VBA scripting.
codev1.py: Main script for processing and 3D model generation.cv_scripts/: Contains OpenCV-related scripts for image processing.cube-cuboid-scrips/: VBA scripts for generating cube and cuboid models in SOLIDWORKS.stacking/: Scripts related to stacking multiple shapes or components.id_dimension_extraction.py: Script for extracting dimensions from identified shapes.openCV_detection_demo.webm: Demo video showcasing OpenCV detection capabilities.requirements.txt: List of Python dependencies.server.py: Script to set up a local server for interfacing with SOLIDWORKS.([GitHub][2], [GitHub][1])
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed as part of the TEB (MIT-101) coursework under the MEID Department at IIT Roorkee.