This article proposes a method of three-dimensional modeling based on voxel code, which can build three-dimensional model by means of cubic voxels and Voxel code. Voxel code is the one that records the formation of physical location of the voxels piled up in turn order in the body. The different Three-dimensional shape can be constructed according to different codes. In order to reduce the storage overhead of the code, the linear octree coding and decoding are given in recording voxel code. Combined with VTK (Visualization Toolkit) programming, some voxel models have been visualization. The modeling idea and method proposed in this paper have a positive significance for the promotion of the research and development of related science fields and have their theoretical and practical value.