3.4 KiB
Project Goal: To build an open source cross-platform Fusion 360 3D CAD clone using C++, Qt, and OpenGL.
Features should be as close to Fusion 360 as possible.
Don't ask for unrelated files to be added to the chat.
Development Summary:
1 Initial Setup: We created the basic application structure with a MainWindow class. This window was set up with a top toolbar to act as a banner for tools and a central widget area as a
placeholder for the 3D viewport.
2 3D Viewport Implementation: We created a ViewportWidget class (inheriting from QOpenGLWidget) to handle 3D rendering. This widget replaced the initial placeholder. To test functionality,
we rendered a simple, multi-colored 3D cube in the center of the viewport.
3 Camera Controls: We implemented mouse-based camera controls in the ViewportWidget:
• Zoom: Mouse scroll wheel.
• Rotate: Middle mouse button drag.
• Pan: Shift + Middle mouse button drag.
4 View Cube: We added a view orientation cube (like in Fusion 360) to the top-right corner of the viewport.
• The first version used QPainter to draw 2D text labels ("TOP", "FRONT", etc.) over the 3D cube.
• We then improved this by rendering the labels as textures directly onto the faces of the 3D view cube, so they rotate with the cube.
5 Refactoring: To improve code organization, all logic related to the view cube (drawing, texturing, and axis lines) was extracted from ViewportWidget into its own dedicated ViewCube class.
6 UI Toolbar: We implemented a tabbed toolbar in the MainWindow to mimic the Fusion 360 UI.
• Created "SOLID", "SURFACE", and "TOOLS" tabs.
• Added "Create Sketch" and "Extrude" QToolButtons to the "SOLID" tab, complete with custom SVG icons loaded via a Qt resource file (.qrc).
7 Code Cleanup & Bug Fixes:
• Removed the initial colorful test cube from the main scene.
• Fixed a build error caused by a typo (QMatrix4xá4 instead of QMatrix4x4) that was introduced during the cleanup.
• Resolved a Qt6 compatibility issue by replacing a legacy Qt5 OpenGL header include with its modern equivalent.
8 Sketch Creation Workflow:
• Implemented a sketch creation dialog that prompts the user to select a plane (XY, XZ, YZ).
• The viewport camera automatically orients itself to be normal to the chosen plane.
• Created a dedicated SketchGrid class to draw a 2D grid on the active sketch plane, complete with major/minor grid lines, labeled axes, and an origin point.
• Fixed a bug where the XY and XZ camera orientations were incorrect.
9 Data Model and File Persistence:
• Designed and implemented a feature-based dependency graph model.
• Created a base Feature class and a concrete SketchFeature class.
• A Document class was created to manage the collection of features (the feature graph).
• Implemented JSON serialization for the document, allowing models to be saved to and loaded from disk.
• Added "New", "Open", "Save", and "Save As" functionality to the main file menu.
10 Feature Browser UI:
• Added a dockable feature browser (tree view) to the left side of the main window.
• The browser displays the current document as the root node and lists all features (e.g., "Sketch") as children.
• The Document class now uses Qt signals and slots to notify the MainWindow of changes, ensuring the feature browser is always synchronized with the underlying data model.