CAD parameter optimization method based on sketch constraint

Through multi-view rendering, edge feature extraction and composite loss function optimization, the problems of model inconsistency and pose uncertainty in sketch CAD reconstruction are solved, and an editable parametric model that conforms to the sketch is generated.

CN120805213APending Publication Date: 2025-10-17ROBOTICS RESEARCH CENTER OF YUYAO CITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510874567.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The models generated by existing sketch CAD reconstruction methods are inconsistent with the input sketch and have uncertain poses, making it difficult to generate editable parametric models that conform to the sketch.

Method used

CAD model parameters are optimized through multi-view rendering, edge feature extraction, geometric scale screening, perceptual similarity screening and composite loss function, combined with random sampling and MCMC iterative optimization to optimize the posture, scale, position and modeling parameters of the CAD model.

Benefits of technology

The generated CAD model is more consistent with the shape, posture and position of the input sketch, realizing editable parametric model optimization, and the pose is more consistent with the shape of the sketch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120805213A_ABST
    Figure CN120805213A_ABST
Patent Text Reader

Abstract

The invention relates to the field of software modeling, in particular to a sketch-constrained CAD (computer aided design) parameter optimization method, which comprises the following steps of: in the process of reconstructing a CAD model, generating a plurality of visual angles, executing multi-visual-angle rendering, acquiring a CAD model rendering graph of a corresponding visual angle, after acquiring the rendering graph, extracting a sketch based on edge features to obtain a rendered sketch, and comparing the rendered sketch with an input sketch to obtain a CAD model. Screening out a CAD model of an optimal attitude through geometric proportion primary screening and perception similarity fine screening; on the basis of an axis alignment bounding box extracted from the input sketch and the rendered sketch, the model scaling size and position are optimized; based on a composite loss function jointly formed by perceptual similarity loss and geometric consistency loss, modeling parameters of a CAD model are optimized, and optimal modeling parameters are obtained based on random sampling and MCMC iteration. According to the method, parameter optimization and pose optimization can be carried out on the generated CAD, so that the generated CAD model better conforms to the shape of the input sketch.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of software modeling, and particularly to a sketch constraint CAD parameter optimization method. BACKGROUND

[0002] Sketch and modeling are two major steps of industrial design and mechanical design. Users first conceive and design products based on sketches, and then use modeling software to instantiate the sketches. Sketch modeling research directly generates models based on sketches to accelerate the product design process. Existing methods mainly focus on generating uneditable models such as meshes based on sketches using three-dimensional generation algorithms. Sketch-based CAD can generate editable parametric models, which facilitates subsequent size parameter modification and editing.

[0003] Existing sketch CAD reconstruction methods often only include sketch segmentation understanding and CAD modeling reconstruction steps. The CAD models generated through these steps have the problems of inconsistency with the input sketch and uncertain pose. SUMMARY

[0004] To solve the above technical problems in the prior art, the present application provides a sketch constraint CAD parameter optimization method, and the specific technical solutions are as follows: A sketch constraint CAD parameter optimization method, comprising: in the process of reconstructing a CAD model, generating multiple viewing angles and performing multi-view rendering to obtain a CAD model rendering image corresponding to the viewing angle, after obtaining the rendering image, performing sketch extraction based on edge features to obtain a rendering sketch, and then comparing the rendering sketch with the input sketch to screen out the CAD model with the optimal pose through geometric proportion preliminary screening and perception similarity fine screening; based on the axis-aligned bounding boxes extracted from the input sketch and the rendering sketch, optimizing the model scaling size and position; based on a composite loss function composed of a perception similarity loss and a geometric consistency loss, optimizing the modeling parameters of the CAD model, and based on random sampling and MCMC iteration to obtain the optimal modeling parameters.

[0005] Further, the multiple viewing angles are generated by uniformly generating multiple viewing direction on a unit sphere using a Fibonacci sphere sampling algorithm.

[0006] Further, the multi-view rendering is performed by reconstructing the CAD model in multiple different poses using the three-dimensional software FreeCAD.

[0007] Further, the sketch extraction based on edge features to obtain the rendering sketch specifically includes: Adaptive binarization of the rendering image; The Canny edge detector is applied to extract the sketch contour in the rendering image, and the model wireframe in the rendering image is extracted by setting a pixel threshold to obtain the rendering sketch.

[0008] Further, the geometric proportion preliminary screening, specifically: the rendering sketch is compared with the input sketch, and the length-width ratio of the axis-aligned bounding box of the two is calculated, and the Top 20 results with the most similar ratio to the input sketch are selected from the rendering sketches in different poses.

[0009] Further, the perception similarity fine screening, specifically: the Top 20 results are calculated with the input sketch LPIPSloss, the pose with the minimum loss is extracted, and the pose of the CAD model is updated, and the pose is updated within the range of plus or minus 5 degrees.

[0010] Further, the optimization model scaling size, specifically: the axis-aligned bounding box of the input sketch and the rendering sketch is extracted, and the length ratio of the two is calculated, and the size of the CAD model is uniformly scaled based on the ratio, so that the shape size in the input sketch and the rendering sketch is consistent.

[0011] Further, the optimization model position, specifically: the axis-aligned bounding box of the input sketch and the rendering sketch is extracted, and the center coordinates of the two are calculated, the center coordinates of the two are ray picked, and the intersection calculation is performed with the objects or reference surfaces in the three-dimensional space, the corresponding three-dimensional coordinates are calculated, the displacement difference calculation is performed, and the displacement of the CAD model is performed.

[0012] Further, the composite loss function based on the joint of the perception similarity loss and the geometric consistency loss is used to optimize the modeling parameters of the CAD model, specifically: A pre-trained deep perception metric network is used to calculate the structural difference between the input sketch and the parameterized rendering result in the multi-scale feature space, and the perception similarity loss is used to aggregate the weighted L2 distance of the convolution feature map, thereby effectively capturing the model contour and texture. N key pixel coordinates are randomly sampled from the input sketch and the rendering sketch, N=2048, and the key pixel coordinates are upgraded to three-dimensional point cloud space, and the spatial distribution difference of the sketch point cloud is quantified by symmetric chamfer distance, thereby enhancing the geometric alignment accuracy.

[0013] Further, the optimal modeling parameter is obtained by iteration based on random sampling and MCMC, specifically: given the initial value of the modeling parameter, random sampling is performed within the range of the initial value, and the loss function of the rendering sketch and the input sketch is calculated, and iteration is performed; based on the optimal solution of the random sampling, MCMC optimization iteration is performed within the range of the optimal solution, and the optimal solution is refined, and finally the optimal modeling parameter is obtained.

[0014] Beneficial effects: the method can optimize the generated CAD in parameters and pose, so that the generated CAD model is more consistent with the shape of the input sketch. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 is a sketch-constrained CAD parameter optimization method flowchart of an embodiment of the application. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical scheme and technical effect of the application clearer, the application is further described in detail below in combination with the drawings and examples of the specification.

[0017] A sketch-constrained CAD parameter optimization method of an embodiment of the application is based on a given initial CAD modeling operation category and parameters, such as categories and parameters obtained based on sketch understanding and segmentation, parameter analysis and other algorithms, to reconstruct a CAD model in CAD software, and to optimize global parameters first, such as the pose, scaling ratio and position of the CAD model, and then to optimize corresponding modeling parameters in detail. As shown in the figure, the CAD parameter optimization method specifically includes the following steps: Figure 1 1. Optimize the model pose, specifically including: 1.1, adopt Fibonacci Sphere Sampling to uniformly generate M=200 view directions on a unit sphere, to ensure that the view covers no dead angle.

[0018] 1.2, perform multi-view rendering, reconstruct the CAD model in multiple different poses by means of the three-dimensional software FreeCAD, and obtain the rendering of the CAD corresponding to the view.

[0019] 1.3, after obtaining the rendering, perform sketch extraction based on edge features, specifically as follows: 1.3.1, perform adaptive binarization on the rendering; 1.3.2, apply a Canny edge detector with a Gaussian kernel size σ=1.5 to extract the sketch contour in the rendering, and extract the model wireframe in the rendering by setting a pixel threshold, to obtain the rendering sketch.

[0020] 1.4, two-stage pose screening strategy, specifically as follows: 1.4.1, geometric proportion preliminary screening: compare the rendering sketch with the input sketch, first calculate the length-width ratio of the axis-aligned bounding box of the two, and select the Top 20 results from the rendering sketches in different poses that have the most similar ratio to the input sketch; ​1.4.2, perceptual similarity screening: the top 20 results are calculated with the input sketch LPIPS loss, the pose with the smallest loss is extracted, and the pose of the CAD model is updated, and the pose is updated within the range of plus and minus 5 degrees of the pose, and the optimal solution is obtained by the above method.

[0021] 2, optimize the model scale size, specifically: extract the axis-aligned bounding box of the input sketch and the rendered sketch, calculate the ratio of the length of the two, and uniformly scale the size of the CAD model based on the ratio, so that the shape size in the input sketch and the rendered sketch is consistent.

[0022] 3, optimize the model position, specifically: extract the axis-aligned bounding box of the input sketch and the rendered sketch, calculate the center coordinates of the two, perform ray picking on the center coordinates of the two, and calculate the intersection with the object or reference surface in the three-dimensional space, calculate the corresponding three-dimensional coordinates, calculate the displacement difference of the two, and displace the CAD model.

[0023] 4, optimize the modeling parameters of the model, specifically including: 4.1, construction and fusion strategy of multi-modal loss function, the difference between the input sketch and the rendered sketch is measured by a composite loss function, which is composed of perceptual similarity loss (LPIPS Loss) and geometric consistency loss (CD-Sketch Loss). Specifically as follows: Perceptual similarity loss: A pre-trained deep perceptual metric network such as AlexNet / VGG backbone network is used to calculate the structural difference between the input sketch and the parameterized rendering result in the multi-scale feature space. This loss function effectively captures the contour distortion and texture distortion sensitive to human vision by aggregating the weighted L2 distance of convolution feature maps. The loss function expression is as follows: , where, is the l-th layer feature map of the input sketch, is the l-th layer feature map of the rendered sketch, is the adaptive weight matrix.

[0024] Geometric consistency loss: To strengthen the geometric alignment accuracy, randomly sample N key pixel coordinates from the input sketch and the rendered sketch, N=2048, and upgrade them to three-dimensional point cloud space. The spatial distribution difference of the sketch point cloud is quantified by the symmetric chamfer distance (Chamfer Distance), and the expression is as follows: ; 4.1.3, the final loss is the weighted fusion of global perception constraints and local geometric constraints, expressed as follows: .

[0025] 4.2, an optimization method based on random sampling and MCMC is constructed, specifically: Given the initial value of the modeling parameter, random sampling is performed within a certain range of the initial value, and the loss function of the rendering sketch and the input sketch is calculated, and iteration is performed for about 20 steps; based on the optimal solution of random sampling, MCMC (Markov Chain Monte Carlo) optimization is performed within a certain range near the optimal solution, and iteration is performed for about 10 steps to refine the optimal solution, and finally the optimal modeling parameter is obtained.

[0026] The above is only the preferred embodiment of the present application, and does not limit the present application in any form. Although the implementation process of the present application has been described in detail in the foregoing, those skilled in the art can still modify the technical solutions recorded in the foregoing examples or replace some of the technical features equivalently. Any modification, equivalent replacement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A sketch-constrained CAD parameter optimization method, characterized in that: include: During the CAD model reconstruction process, multiple perspectives are generated and multi-perspective rendering is performed to obtain the CAD model renderings of the corresponding perspectives. After obtaining the renderings, sketch extraction based on edge features is performed to obtain the rendering sketch. The rendering sketch is then compared with the input sketch, and the CAD model with the optimal posture is selected through preliminary screening of geometric proportions and fine screening of perceptual similarity. Optimize model scaling and position based on axis-aligned bounding boxes extracted from input and rendered sketches; Based on the composite loss function composed of perceptual similarity loss and geometric consistency loss, the modeling parameters of the CAD model are optimized, and the optimal modeling parameters are obtained based on random sampling and MCMC iteration.

2. The CAD parameter optimization method according to claim 1, wherein: The generating of multiple viewing angles specifically includes: uniformly generating multiple viewing angle directions on a unit sphere using a Fibonacci spherical sampling algorithm.

3. The CAD parameter optimization method according to claim 1, wherein: The multi-view rendering is specifically performed by reconstructing the CAD model in multiple different postures using the 3D software FreeCAD.

4. The CAD parameter optimization method according to claim 1, wherein: The step of extracting a sketch based on edge features to obtain a rendering sketch specifically includes: Adaptively binarize the rendered image; The Canny edge detector is applied to extract the sketch outline in the rendering image, and the model wireframe in the rendering image is extracted by setting the pixel threshold to obtain the rendering sketch.

5. The CAD parameter optimization method according to claim 1, wherein: The geometric proportion screening is as follows: the rendered sketch is compared with the input sketch, the aspect ratio of the axis-aligned bounding boxes of the two is first calculated, and the top 20 results with the most similar proportions to the input sketch are selected from the rendered sketches of different poses.

6. The CAD parameter optimization method according to claim 5, wherein: The perceptual similarity fine-screening specifically involves calculating the LPIPS loss between the top 20 results and the input sketch, extracting the pose with the smallest loss, and updating the pose of the CAD model within a range of plus or minus 5 degrees.

7. The CAD parameter optimization method according to claim 1, wherein: Optimize model scaling by extracting axis-aligned bounding boxes for the input sketch and the rendered sketch, calculating the ratio of their lengths, and uniformly scaling the CAD model based on the ratio so that the shapes in the input sketch and the rendered sketch are the same size.

8. The CAD parameter optimization method according to claim 1, wherein: Optimize the model position by extracting axis-aligned bounding boxes for the input sketch and the rendered sketch, calculating the center coordinates of the two, performing ray picking on the center coordinates of the two, performing intersection calculations with objects or reference surfaces in 3D space, calculating the corresponding 3D coordinates, calculating the displacement difference between the two, and displacing the CAD model.

9. The CAD parameter optimization method according to claim 1, wherein: The modeling parameters of the CAD model are optimized based on the composite loss function composed of the perceptual similarity loss and the geometric consistency loss, specifically: A pre-trained depth-aware metric network is used to calculate the structural differences between the input sketch and the parametric rendering result in a multi-scale feature space. The weighted L2 distance of the convolutional feature map is aggregated using the perceptual similarity loss to effectively capture the model contour and texture. N key pixel coordinates (N=2048) are randomly sampled from the input sketch and the rendered sketch, respectively, and their dimensions are upgraded to the 3D point cloud space. The spatial distribution differences of the sketch point clouds are quantified by the symmetric chamfer distance, thereby enhancing the geometric alignment accuracy.

10. The CAD parameter optimization method according to claim 1, wherein: The optimal modeling parameters are obtained by iteration based on random sampling and MCMC. Specifically, given the initial values ​​of the modeling parameters, random sampling is performed within a range near the initial values, and the loss functions of the rendered sketch and the input sketch are calculated and iterated; based on the optimal solution of random sampling, MCMC optimization iterations are performed within a range near the optimal solution to refine the optimal solution and finally obtain the optimal modeling parameters.

Citation Information

Cited By

  • Three-dimensional computer-aided design model generation method based on multi-modal agent

    CN122549236A