As the weak structure and main seepage channel of rock mass, the discrete fracture network (DFN) has a significant influence on the physical and mechanical properties of rock mass. In this paper, based on the rectangular joint model, two algorithms are proposed to realize the precise modeling of the DFN in any polyhedron. First, the equivalence of DFN modeling with the rectangular joint model and the elliptical joint model is theoretically deduced. On this basis, the chain splicing algorithm suitable for the rectangular joint model is proposed, which can generate the DFN model according to the actual distribution of joint spacing, trace, and bridge length. Aiming at the concave boundary in the model domain, the segmentation‐stitching operation is put forward, and the continuity of the joint when passing through the interface is ensured. Finally, the effectiveness of the above algorithm is verified by several simple cases, and the relationship between the size of the geometrical representative elementary volume (REV) and discontinuity parameters is discussed. The results show that when the mean values of the joint distribution parameters are the same, even if the distribution rules are different, the number of joints generated in the same spatial region is approximately equal. The size of the geometrical REV is independent of the spacing and bridge length and is approximately three to five times the mean of the trace. The relevant algorithms and conclusions in this paper can be used as the basis for subsequent rock mass stability analysis and seepage calculation.