A method for identifying part datum planes based on SolidWorks assemblies

By using SolidWorks API functions and national standards, the system automatically identifies assembly matings in assemblies, solving the problem of lost assembly matings caused by information flow during assembly datum annotation, and achieving fast and accurate datum plane identification and annotation.

CN117744267BActive Publication Date: 2026-11-17SHANGHAI UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311770725.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2026-11-17
Estimated Expiration
2043-12-21

AI Technical Summary

Technical Problem

In actual production, there are problems with information flow during the labeling of assembly datums, which leads to the loss of assembly fit and makes it difficult to effectively identify and label the position of parts in the assembly.

Method used

Using the official SolidWorks API functions and combining the benchmark element definition specifications of national and international standards, the system automatically identifies assembly matings in the assembly and assists in annotating the benchmark surfaces. This includes steps S1-S4: unifying the assembly format, obtaining part entities, traversing surface types, comparing surface parameters, recording assembly matings, and highlighting the benchmark surfaces.

Benefits of technology

It significantly improves the speed and accuracy of part datum surface identification, reduces human error, reduces the time for three-dimensional tolerance annotation, and avoids assembly and mating errors and omissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117744267B_ABST
    Figure CN117744267B_ABST
Patent Text Reader

Abstract

This invention discloses a method for identifying part datum surfaces based on SolidWorks assemblies, comprising the following steps: S1: Unifying the assembly format of SolidWorks files and obtaining the corresponding part entities; S2: Traversing the part entities to obtain all surface instances, determining the type of the obtained surface, and obtaining the corresponding surface parameters according to different surface types; S3: Based on a set gap range, traversing and comparing the surface types and surface parameters of the obtained surface instances of different parts to determine whether there is an existing assembly mate, and recording all assembly mates between parts, i.e., all surfaces that can become datum elements. This method uses API functions provided by SolidWorks to unify the assembly format of assemblies and encapsulated part bodies, process surface types, and automatically identify assembly mates, thereby highlighting the auxiliary datum annotation of assembly mates and effectively solving the practical problems of assembly mate errors and omissions in the process of datum annotation from assembly to part body.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a method for identifying part reference surfaces based on SolidWorks (a three-dimensional mechanical design software) assemblies, belonging to the field of computer-aided development and modeling and tolerance analysis technology for mechanical products. Background Technology

[0002] A datum is one or a set of directional elements related to a datum feature, used to define the positional orientation of a tolerance zone or the positional orientation of an entity. National and international standards provide specifications for defining datum features. Both tolerance zones and dimensional chains need to be determined by the datum constraints of the part, as defined by its functional structural model.

[0003] In actual production, the fit used to determine the position of a part or component in the assembly is called the assembly datum. The assembly datum is defined by the designer to determine the position of the part in the assembly. It is used as a reference for moving the part when designing the part model. It cannot be directly used as a datum element in the production of the part. Datum annotation requires the designer to judge the assembly fit in the assembly and determine the part datum accordingly. Furthermore, due to information flow and other issues, the model needs to be encapsulated, which can lead to the loss of assembly fits and other problems, which also cause inconvenience to the annotation personnel. Summary of the Invention

[0004] The purpose of this invention is to provide a method for identifying part datum surfaces based on SolidWorks assemblies. This method uses API functions provided by SolidWorks and is based on the datum element definition specifications given by national and international standards to perform surface type processing on assemblies and packaged parts, automatically identify assembly matings, and assist annotators in marking datums on the model.

[0005] To achieve the above objectives, this invention provides a method for identifying part reference planes based on SolidWorks assemblies, comprising the following steps:

[0006] S1: Standardize the assembly format of SolidWorks files and obtain the corresponding part entities;

[0007] S2: Traverse the part entity to obtain all face instances, determine the type of the obtained face, and obtain the corresponding face parameters according to different face types;

[0008] S3: Based on the set gap range, iterate through and compare the surface types and surface parameters of the obtained surface instances of different parts, determine whether there is an existing assembly fit, and record the assembly fits between all parts, that is, all the part datum surfaces that can become datum elements.

[0009] Furthermore, the part reference surface identification method also includes the following steps: S4: Based on the selected labeled parts, highlight all assembly matings to assist labeling personnel in labeling.

[0010] Furthermore, the specific process of unifying the assembly format and obtaining the corresponding part entities in step S1 is as follows: For the assembly format, the GetBodies tool is directly called to obtain the part entities, while the encapsulated part entities are converted into the assembly format using the following method:

[0011] First, the CreateSaveBodyFeature and SaveToFile2 tools are called to save all the required Body2 type entities and generate a part body for each one separately. The Transform2 tool is used to record the world coordinate orientation of the original entity.

[0012] Secondly, use the AddComponent5 tool to import each individually generated part body into a newly created assembly document;

[0013] Finally, the AddMate5 tool is used to add mating parts in the assembly and fix them to their original positions, thereby achieving the unification of the packaged part body into the assembly format.

[0014] Furthermore, the specific process of obtaining all face instances and face types in step S2 is as follows:

[0015] First, based on the part entity obtained in step S1, the GetFirstFace and GetNextFace tools are called to traverse and obtain all faces on the entity, i.e., to obtain face instances. Second, the GetSurface tool is called to obtain the face type of the face instance, and the face type is determined and recorded based on the Identity attribute. Further, the face type is a planar type, cylindrical surface type, spherical surface type, conical surface type, or torus surface type.

[0016] Furthermore, when the surface type is a planar type, the PlaneParams tool is called to obtain the planar parameters of the surface instance, namely a point on the plane and the normal vector of the plane; when the surface type is a cylindrical surface type, the CylinderParams tool is called to obtain the cylindrical surface parameters of the surface instance, namely the center point of the cylindrical surface, the axis vector of the cylindrical surface, the radius R and the height H of the cylindrical surface, and the FaceInSurfaceSense tool is called to obtain the type of the hole axis.

[0017] Furthermore, the specific process for determining whether an assembly fit exists in step S3 is as follows:

[0018] 1) First, select two different face instances that may have an assembly relationship;

[0019] 2) Obtain the face types and face parameters of the two face instances that may have assembly relationships, one by one;

[0020] 3) Determine the surface type of both parts, adopt the corresponding reference type identification for different surface types, determine whether there is an assembly fit, and record all assembly fits between different parts.

[0021] Furthermore, the reference type identification is divided into planar reference identification and cylindrical surface reference identification;

[0022] When a plane type is obtained in both of the two different face instances, a plane reference is used for identification:

[0023] Obtain the plane parameters of surface instance A: point coordinates O1(x1,y1,z1) and plane normal vector V1(a1,b1,c1); obtain the plane parameters of surface instance B: point coordinates O2(x2,y2,z2) and plane normal vector V2(a2,b2,c2); determine whether the normal vectors V1(a1,b1,c1) and V2(a2,b2,c2) are parallel; if so, calculate the distance between the two planes using Formula 1 to obtain D, and then compare it with the set gap range to determine whether it is within the gap range; if so, measure and evaluate whether the two planes have overlapping areas; if they have overlapping areas, record that the two surface instances have a planar type of assembly mating;

[0024]

[0025] When both of the two different surface instances are found to be cylindrical (either two holes or a hole shaft), the cylindrical surface reference is used for identification:

[0026] Obtain the cylindrical surface parameters of surface instance A: center point coordinates O1(x1,y1,z1), normal vector of the hole or shaft V1(a1,b1,c1), height H1, and radius R1; Obtain the cylindrical surface parameters of surface instance B: center point coordinates O2(x2,y2,z2), normal vector of the hole or shaft V2(a2,b2,c2), height H2, and radius R2; Determine if the radii of the two surfaces match and are within a certain gap range; if so... First, determine whether the axial directions V1(a1,b1,c1) and V2(a2,b2,c2) of the two axes are coaxial. If so, use Formula 2 to calculate the line connecting the two points to obtain V3(x,y,z), and then compare it with at least one of V1(a1,b1,c1) and V2(a2,b2,c2) to determine whether they are coaxial. If they are hole-shaft fit, check whether the axial line segments of the two axes have overlapping line segments. If they are hole-hole fit, check whether the overlapping line segments of the two axes are a single point.

[0027]

[0028] If the above line segment checks are satisfactory, then record that these two surface instances have cylindrical surface type assembly fits, specifically down to hole-to-hole fits or hole-to-shaft fits.

[0029] Furthermore, the specific process of highlighting all assembly matings in step S4 is as follows: call the GetMaterialPropertyValues2 tool and the ChangeBodyColor tool to highlight the reference surface of the part.

[0030] The present invention has the following advantages or beneficial effects:

[0031] This paper proposes a method for identifying the datum planes of parts in an assembly based on Solidworks secondary development. This method automatically identifies assembly matings, effectively improving the identification speed. It practically solves the problem of assembly mating errors and omissions in the process of datum annotation from assembly to part, significantly reducing the time for 3D tolerance annotation and avoiding manual operation errors. Attached Figure Description

[0032] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:

[0033] Figure 1 This is a schematic diagram of an embodiment of a part reference surface identification method based on SolidWorks assembly according to the present invention;

[0034] Figure 2 This is a diagram illustrating the instance type relationships used in SolidWorks in this invention;

[0035] Figure 3 This is an embodiment illustrating the display of auxiliary reference annotations on the model according to the present invention;

[0036] Figure 4 This is a schematic diagram of an embodiment of a part reference surface identification method based on SolidWorks assembly according to the present invention;

[0037] Figure 5 This is a schematic diagram of an embodiment of a part reference surface identification method based on SolidWorks assembly according to the present invention. Detailed Implementation

[0038] To better understand the above-mentioned objects, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Many specific details are set forth in the following description to provide a thorough understanding of the present invention; however, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0039] like Figure 4 As shown, an embodiment of the present invention provides a method for identifying part reference planes based on SolidWorks assemblies, including the following steps:

[0040] S1: Standardize the assembly format of SolidWorks files and obtain the corresponding part entities.

[0041] Combination Figures 1-2 This diagram illustrates the instance type relationships between some API functions used in the embodiments of the present invention. SolidWorks file types include PartDoc, AssemblyDoc, and DrawingDoc formats. One type of PartDoc format is a packaged PartDoc, which contains multiple entities and reflects the relationships between these entities.

[0042] For assembly format, the GetBodies tool can be used directly to obtain the part entities, while the encapsulated part bodies are converted into assembly format using the following method:

[0043] First, the CreateSaveBodyFeature tool is called to obtain all the required Body2 type entities, and the SaveToFile2 tool is used to save all the required Body2 type entities and generate a part body for each one separately. The Transform2 tool is used to record the world coordinate orientation of the original entity.

[0044] Secondly, use the AddComponent5 tool to import each individually generated part body into a newly created assembly document;

[0045] Finally, the AddMate5 tool is used to add mating parts in the assembly and fix them to their original positions, thereby achieving the unification of the packaged part body into the assembly format.

[0046] S2: Traverse the part entity to obtain all face instances, determine the type of the obtained face, and obtain the corresponding face parameters according to the different face types.

[0047] Reference Figure 1Based on the Body2 part entity obtained in step S1, call the GetFirstFace and GetNextFace tools to traverse and obtain all faces (i.e., face instances) on the entity.

[0048] Secondly, the surface type of the surface instance is obtained through the GetSurface method. The Identity property is used to determine and record the surface type as a plane, cylinder, sphere, cone, or torus, etc. (e.g., ...). Figure 2 (As shown).

[0049] For a plane, the PlaneParams tool is used to obtain the plane parameters of the Body2 part entity: these can be represented by a point O(x,y,z) on the plane and the plane's normal vector V(a,b,c), as shown in Formula 3:

[0050] a(x0-x)+b(y0-y)+c(z0-z)=0 (3)

[0051] For a cylindrical surface, use the CylinderParams tool to obtain the cylindrical surface parameters of the Body2 part entity: these can be represented by the center point O(x,y,z) of the cylindrical surface, the axis vector V(a,b,c) of the cylindrical surface, and the radius R and height H of the cylindrical surface, as shown in Formula 4 (the axis direction is the y-coordinate direction):

[0052]

[0053] Unlike planes, cylindrical surfaces are mainly used for hole-shaft mating and hole-hole positioning during assembly. It is also necessary to determine whether the cylindrical surface is a hole or a shaft. The hole-shaft type can be obtained through the FaceInSurfaceSense tool. If it returns true, it is a hole; if it returns false, it is a shaft.

[0054] Finally, combining Figure 2 Based on the instance type relationship of the part entity, record all face instances and face parameters on the part entity.

[0055] S3: Based on the set gap range, iterate through and compare the surface instances of different parts, checking for existing assembly matings, and recording all assembly matings between parts, i.e., all part datum surfaces that can become datum elements.

[0056] Reference Figure 1 First, select two different face instances (face instance A and face instance B) that may have an assembly relationship; obtain the face type and face parameters of the two face instances that may have an assembly relationship one by one; determine the face type of the two, and take the corresponding datum type identification for different face types to determine whether there is an assembly mate, and record all assembly mates between different parts.

[0057] In this invention, the clearance range refers to a set assembly tolerance threshold. This threshold is a defined range for identifying assembly fits that take into account dimensional and clearance fits. If the surface parameter to be compared is less than this threshold, then the obtained surface instances of different parts are considered to be part of an existing assembly fit. When the surface parameter to be compared is a planar parameter, the clearance range refers to the numerical range within which the distance between the two surfaces should be less than a certain value. When the surface parameter to be compared is a cylindrical surface parameter (hole-shaft fit or hole-hole positioning), the clearance range refers to the numerical range within which the difference in cylinder radii should be less than a certain value.

[0058] The following explanation will focus on the two most common types of datums in a datum system: planar datum identification and cylindrical datum identification.

[0059] When plane types are obtained in both of the above two different surface instances, plane datum identification is used. The plane parameters of surface instance A are obtained: point coordinates O1(x1,y1,z1) and the plane normal vector V1(a1,b1,c1); the plane parameters of surface instance B are obtained: point coordinates O2(x2,y2,z2) and the plane normal vector V2(a2,b2,c2). It is determined whether the normal vectors V1(a1,b1,c1) and V2(a2,b2,c2) are parallel. If so, the distance between the two planes is calculated using Formula 1, resulting in D. This distance is then compared with a set gap range to determine if it falls within the gap range. If so, Measure is used to assess whether the two planes have an overlapping area. If an overlapping area exists, it is recorded that these two surface instances have a plane-type assembly fit.

[0060]

[0061] When cylindrical surface types are obtained in both of the above two different surface instances (either two holes or a hole-shaft), the cylindrical surface reference is used for identification. Obtain the cylindrical surface parameters of surface instance A: center point coordinates of the hole or shaft O1(x1,y1,z1), normal vector of the hole or shaft V1(a1,b1,c1), height H1, and radius R1; obtain the cylindrical surface parameters of surface instance B: center point coordinates of the hole or shaft O2(x2,y2,z2), normal vector of the hole or shaft V2(a2,b2,c2), height H2, and radius R2. Determine if the radii of both surfaces are within a gap range; if so, determine if their axial directions V1(a1,b1,c1) and V2(a2,b2,c2) are coaxial; if so, calculate the line connecting the two points using Formula 2 to obtain V3(x,y,z), and then compare it with at least one of V1(a1,b1,c1) and V2(a2,b2,c2) to determine if they are coaxial; if it is a hole-shaft fit, check if the axial line segments of both surfaces have overlapping segments; if it is a hole-hole fit, check if the overlapping of the line segments is a single point. If the above line segment checks are met, record that these two surface instances have a cylindrical surface type assembly fit, specifying it as a hole-hole fit or a hole-shaft fit.

[0062]

[0063] like Figure 5 As shown, another embodiment of the present invention provides a method for identifying part reference planes based on SolidWorks assemblies, which, in addition to steps S1-S3 described above, also includes the following steps:

[0064] S4: Based on the selected labeled parts, highlight all assembly fits to assist labelers in labeling.

[0065] Specifically, based on the annotators' selection of the annotated parts, the ChangeBodyColor and GetMaterialPropertyValues2 methods are used to highlight all assembly matings, such as... Figure 3 The display example of auxiliary datum annotation on the model is all the faces that can become datum features, with a total of 3 sets of planar datums and 2 sets of cylindrical datums, which assist the annotation personnel in making annotations.

Claims

1. A method for identifying part reference planes based on SolidWorks assemblies, comprising the following steps: S1: Standardize the assembly format of SolidWorks files and obtain the corresponding part entities; S2: Traverse the part entity to obtain all face instances, determine the type of the obtained face, and obtain the corresponding face parameters according to different face types; S3: Based on the set gap range, for the obtained surface instances of different parts, traverse and compare the surface type and surface parameters, determine whether there is an existing assembly fit, and record the assembly fit between all parts, that is, all the part reference surfaces that can become reference elements. S4: Highlight all assembly fits based on the selected labeled parts to assist labelers in labeling; The specific process of unifying the assembly format and obtaining the corresponding part entities in step S1 is as follows: For the assembly format, the GetBodies tool is directly called to obtain the part entities, while the encapsulated part entities are converted into the assembly format using the following method: First, the CreateSaveBodyFeature and SaveToFile2 tools are called to save all the required Body2 type entities and generate a part body for each one separately. The Transform2 tool is used to record the world coordinate orientation of the original entity. Secondly, use the AddComponent5 tool to import each individually generated part body into a newly created assembly document; Finally, the AddMate5 tool is used to add mating parts in the assembly and fix them to their original positions, thereby achieving the unification of the packaged part body into the assembly format; The specific process of obtaining all face instances and face types in step S2 is as follows: First, based on the part entity obtained in step S1, call the GetFirstFace and GetNextFace tools to traverse and obtain all faces on the entity, that is, obtain face instances; second, call the GetSurface tool to obtain the face type of the face instance, and determine and record the face type based on the Identity attribute; The surface type is a planar surface, a cylindrical surface, a spherical surface, a conical surface, or a toroidal surface; When the face type is planar, the PlaneParams tool is used to obtain the planar parameters of the face instance, namely a point on the plane and the plane's normal vector; when the face type is cylindrical, the CylinderParams tool is used to obtain the cylindrical parameters of the face instance, namely the center point of the cylinder, the axis vector of the cylinder, and the radius of the cylinder. and height And call the FaceInSurfaceSense tool to obtain the type of the hole shaft; The specific process for determining whether an assembly fit exists in step S3 is as follows: 1) First, select two different face instances that may have an assembly relationship; 2) Obtain the face types and face parameters of the two face instances that may have assembly relationships, one by one; 3) Determine the surface type of both parts, adopt the corresponding reference type identification for different surface types, determine whether there is an assembly fit, and record all assembly fits between different parts; The reference type is identified as planar reference identification and cylindrical surface reference identification; When a plane type is obtained in both of the two different face instances, a plane reference is used for identification: Get the planar parameters of face instance A: point coordinates The normal vector of the plane is Get the planar parameters of face instance B: point coordinates The normal vector of the plane is Determine the normal vectors of the two. and Are they parallel? If so, calculate the distance between the two planes using Formula 1. Then, it is compared with the set gap range to determine whether it is within the gap range; if so, Measure measures and evaluates whether the two planes have overlapping areas; if there are overlapping areas, it records that the two surface instances have a planar type of assembly mating. (1) When both of the two different surface instances are obtained as cylindrical surfaces (either two holes or a hole shaft), the cylindrical surface reference is used for identification: Get the cylindrical surface parameters of surface instance A: coordinates of the center point of the hole or shaft. The normal vector of the hole or shaft is ,high ,radius ; Obtain the cylindrical surface parameters of surface instance B: coordinates of the center point of the hole or shaft. The normal vector of the hole or shaft is ,high ,radius Determine if the radii of the two objects are within a certain gap; if so, determine the direction of their axes. and Are they coaxial? If so, use Formula 2 to calculate the line connecting the two points, and obtain... , and then with and Compare at least one of them to determine if they are coaxial; if it is a hole-shaft fit, check if the line segments of the two axes have overlapping line segments; if it is a hole-hole positioning, check if the overlap of the line segments of the two is a point; if the above line segment checks are met, record that the two surface instances have cylindrical surface type assembly fit, and specify whether it is a hole-hole fit or a hole-shaft fit. (2) 。 2. The method according to claim 1, characterized in that, The specific process of highlighting all assembly matings in step S4 is as follows: call the GetMaterialPropertyValues2 tool and the ChangeBodyColor tool to highlight the reference surface of the part.

Citation Information

Patent Citations

  • Feature matching detection system for Creo model of fan device

    CN110659652A