A CAD Modeling Tool

Submitted by rootmaster on Thu, 06/14/2018 - 23:36
CAD s.pngchikenhappy bear treerobot frontrobot leftdog

Written is c/c++ opengl. 17,0000 + lines of code.

The UI system is build up use wxWidget.

rough OpenGL display.

basic platform of move/rotation/scale manipulation. change view port to front/left/back/.... perspective/orth view. local/world coord system change. transparent/edge/... display . symmetry copy.

cut/smoonth/deform/paint color on the model.

do/undo system.

The inside idea is draw a closed contour on the screen.

re-sample the contour line to remove some sharp corner.

use the contour line to generate two mesh plane. one face up one face down. and connect together on the border edger.

use Laplacian smooth to get something ball-like 3d model.

cut: draw cut line on screen. intersection with 3d model. with mouse click on one side of the cut line to decide which side to be cut off.

merge: remove the intersection part of the model. sew  the two model together use recursive function all  through the intersection border.

deform:something like smooth select in 3dmax. the key is  to calc how much each vertex should be affected.

painting on the model: the vertex data structure here must support one vertex with mult-uv. Setup a no-light scene behind use opengl fbo  buffer. Generate the uv data in screen space. draw the sketch on the screen. also on the fbo texture.  find the bounding rect of that sketch. store the uv and pack the rect color from fbo into big texture. Use this big texture to store sketches. use uv store previous to display the sketches. No need to unwrap uv by artists.

internally we use basic scene management of ogre. math lib like matrix,ray,quaternion,camera,frustum,vertor mixed with algorithm in-need interface function.memory management/trace debug tool.

do/undo part are simple memory images of the model arranged inside a stack-like data container.

use autodesk fbx sdk is quite easy to support many kind of file format.

Refer:

FiberMesh: Designing Freeform Surfaces with 3D Curves