## 1 Introduction  
The design stage in the manufacturing process has become more complex in recent decades [1]. Designers try to create details that fully correspond to their intended functionality. This translates into certain mass limits and stiffness requirements to designed parts. Simulation and topology optimization algorithms help obtain the geometry satisfying these constraints. However, topology optimization algorithms can produce geometries that are impossible with traditional production methods but suitable for additive manufacturing (AM) [2]. These technologies impose new requirements to computer-aided design (CAD) and computer-aided manufacturing (CAM) software. Moreover, they significantly increase the complexity of CAD models that can be manufactured, and clearly show the limitations of boundary representation (BRep) used in traditional CAD/CAM systems. Application of multiple set-theoretic and other operations, varying the parameters of BRep models, leads to corruption of meshes and significantly increases the size of files with resulting geometry for models in high precision applications [3]. The use of BRep leads to occurrence of incorrect faces in exported STL files or errors in the slicing process. Moreover, when a design includes the analysis or topology optimization steps, the traditional approach uses the following geometry transformations. First, the BRep CAD geometry is transformed to the voxel representation, and then analysis and topology optimization is performed. Second, the BRep is reconstructed with possible smoothing. Finally, the resulting geometry is sliced to create a computer numerical control (CNC) program in a specific language such as G-code [4]. Several software packages usually serve these purposes. The use of the FRep-based CAD/CAM system instead resolves all previously mentioned problems of the BRep format. In contrast to BRep, function representation (FRep) guarantees the correctness of resulting geometry regardless of the number of set -theoretic and other operations and the number of parameters in the model [5]. The paper [6] presents the fundamentals of the FRep. It supports many modeling operations. The basis of set-theoretic operations are R-functions [7]. Operations on FRep objects have become the subject of several studies, including blending, bending, offsetting, sweeping [8], bounded blending, trimming [9], metamorphosis, etc. [10]. The mentioned theory of R-functions was initially developed as a tool for domains modeling in partial differential equations (PDE) [7]. Later publications elaborated this approach [11] and proposed an algorithm for topology optimization of FRep models [12]. Many algorithms employ the FRep for domain description in various simulation and structural optimization tasks [13; 14]. These algorithms form a group called level-set methods for topology optimization. The advantage of such optimization algorithms is their ability to directly provide the optimal geometry in contrast to 0-1 density methods such as the solid isotropic material with penalization (SIMP) method [14]. FRep-based optimization algorithms provide ready-to-print shapes in contrast to BRep-based methods requiring post-processing steps, e.g., smoothing the geometry, leading to remodeling of the body. Level-set methods for multi-material topology optimization exist [15]. For example, they can be applied for designing of continuous fiber-reinforced structures instead of existing topology optimization methods [16; 17]. Thus, FRep can be applied to solve various tasks; however, no complete FRep-based CAD/CAM system has yet been proposed. The presented work has two contributions. The first is the aggregation of FRep and level-set methods in one CAD/CAM system. Both FRep and level-set methods operate with continuous functions for describing domains. It allowed us to develop the first framework that provides tools for topology optimization and uses its results as modeling primitives for further design.