A Hierarchical Model for Developing CAD Application Systems (4)


Fourth, the function of the hierarchical model processing function library

Based on the above principles, the author developed a general function library for hierarchical model processing in C language, working with graphics software packages. It mainly provides the following functions: (1) support functions for component reference transformation; (2) coordinate transformation functions for component layout; (3) current workspace support functions for setting current workspace, crossover Data transformation can also be used for virtual workspace operations; (4) support functions for various annotation pixels; (5) other practical coordinate calculation functions.

In order to facilitate the actual programming, the author defines the following types of coordinate systems in the function library: (1) the world coordinate system WCS: the coordinate system of the drawing surface; (2) the component coordinate system BCS: the body coordinate system of the component; (3) The current absolute coordinate system CACS: the base coordinate system under BCS, if it is under WCS, it is the base coordinate system under WCS; (4) the current coordinate system (or working coordinate system) CCS: the coordinate system used for the current drawing, and CRCS Parallel, if the CRCS is not set, it is CACS. If CACS is not set, it is BCS. If it is under WCS, it is the coordinate system under WCS.

Accordingly, the author defines the following types of coordinate transformations: (1) component reference transformation: transformation of reference components; (2) absolute coordinate transformation: reset CACS, correspondingly withdraw CRCS, CCS; (3) relative coordinate transformation: heavy Set the CRCS, correspondingly cancel CCS; (4) current coordinate transformation (or cumulative coordinate transformation): incrementally accumulated coordinate transformation on the original CCS, CCS takes the accumulated coordinate system is especially suitable for maintaining the inter-module between the programming Coordinate system independence.

V. Conclusion

The CAD application system development method based on the hierarchical model provides us with a systematic approach, which has practical significance in engineering and mechanical CAD graphics programming. This method needs to be supported by the corresponding function library, so it is very important to develop a more general hierarchical model processing function library. The hierarchical model processing library can be built on top of existing graphics packages and work with them.

Previous page