A method, device and medium for acquiring a reference of a geometric element
By defining the element type and unifying the naming of geometric elements in the human-computer interaction software, and combining the API to obtain the reference point and direction, the problem of inefficient reference acquisition in the existing technology is solved, and efficient and accurate reference point and direction acquisition is achieved, thereby improving design efficiency and quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 潍柴新能源商用车有限公司
- Filing Date
- 2026-04-02
- Publication Date
- 2026-07-10
AI Technical Summary
In automotive and aerospace design, existing technologies for obtaining reference points and reference directions by creating point and line features are inefficient and labor-intensive, making it difficult to meet the human-computer interaction requirements in software secondary development.
The unit type of geometric elements is determined by human-computer interaction software, reference elements are uniformly named, reference points and reference directions are obtained by API, specific acquisition rules are set for different geometric types, and visualization and interactive functions are provided.
It improves the efficiency and accuracy of obtaining reference points and reference directions, simplifies the operation process, reduces the possibility of errors, and enhances design efficiency and quality.
Smart Images

Figure CN122365748A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and medium for obtaining references for geometric elements. Background Technology
[0002] CATIA software is widely used in the design of automotive, aerospace, and other fields. To improve design efficiency, CATIA often needs to be further developed, and the software's human-computer interaction function is an essential part of this development. To improve the software's execution efficiency, human intervention during software operation should be minimized, and interactive operations should be simplified to reduce the possibility of errors.
[0003] In processes such as part design, assembly design, and DMU motion design, it is often necessary to reference a large number of datum points and datum directions in order to create features, apply assembly constraints, and create kinematic pairs based on these datums. However, obtaining these datums by creating point or line features is not only inefficient but also extremely labor-intensive. Summary of the Invention
[0004] To address the aforementioned issues, this application proposes a method for obtaining the reference of geometric elements, comprising: determining geometric elements through pre-set human-computer interaction software, and distinguishing the geometric elements to determine the unit type corresponding to the geometric elements, wherein the unit type includes feature units and topological units; determining reference elements according to the type, uniformly naming the reference elements, determining the geometric object name corresponding to the reference elements through a pre-set API, and determining the corresponding geometric type according to the geometric object name; determining the reference point and reference direction corresponding to the geometric type, and determining the coordinate value of the reference point and the direction vector value of the reference direction.
[0005] In one example, geometric elements are determined through pre-set human-computer interaction software, specifically including: enumerating and displaying all geometric elements in the human-computer interaction interface, the geometric elements including vertex topology type, point feature, edge topology type, line feature, face topology type, face feature, and planar feature; obtaining the geometric elements selected by the user, and excluding non-geometric type options among the geometric elements through the filtering mechanism of the human-computer interaction software.
[0006] In one example, the geometric elements are distinguished to determine the unit type corresponding to the geometric elements. Specifically, this includes: determining the geometric elements selected by the user; analyzing the name attributes of the geometric elements to determine the identifiers contained in the name prefix of the geometric elements; and determining the unit type based on the identifiers to distinguish whether the geometric elements are feature units or topological units.
[0007] In one example, a reference element is determined based on the type, and the reference element is uniformly named. Specifically, if the element type is a topological element, a name conversion operation is performed to convert the name of the geometric element selected by the user into a pre-set standard name format; if the element type is a feature element, the original name of the geometric element is used as the reference element, and the reference element is uniformly named.
[0008] In one example, determining the reference point and reference direction corresponding to the geometry type specifically includes: determining the corresponding acquisition algorithm based on the geometry type, so as to determine the reference point and reference direction through the acquisition algorithm.
[0009] In one example, the method further includes: if the geometry type is a solid or envelope type, obtaining the centroid coordinates of the solid as a reference point, with the reference direction determined according to the global coordinate system or a user-specified direction; if the geometry type is a surface type, obtaining the centroid position of the surface, and further obtaining the coordinates of the non-shear surface point closest to the centroid on the surface as a reference point, with the surface normal at the reference point as the reference direction; if the geometry type is a cylindrical or conical surface type, obtaining the position of the centroid, and projecting the centroid onto the axis of the cylindrical or conical surface to obtain... The reference point is the axis direction. If the geometry is a sphere, the center of the sphere is used as the reference point, and the vector from the center of the sphere to any direction or the fixed direction determined by the coordinate system is used as the reference direction. If the geometry is a plane, the centroid of the plane is used as the reference point, and the normal of the plane is used as the reference direction. If the geometry is a curve, the approximate center of the curve or the geometric center fitted by the points on the curve is used as the reference point, and the normal of the plane containing the approximate circle or the perpendicular direction of the tangent of the curve is used as the reference direction.
[0010] In one example, if the geometry type is a curve type, it specifically includes: if the curve is a closed curve, then by measuring the distance between multiple distant points on the curve, the two points with the greatest relative distance are found, and the midpoint or fitted circle center of these two points is calculated as the reference point; if the curve is an open curve, then an approximate circle is obtained by fitting points on the curve, with the center of the approximate circle as the reference point, and the normal of the plane containing the approximate circle as the reference direction.
[0011] In one example, after determining the reference point and reference direction corresponding to the geometry type, and determining the coordinate value of the reference point and the direction vector value of the reference direction, the method further includes: visually displaying the acquired reference point coordinate information and direction vector value through a pre-set user interface; and providing interactive functions through the user interface to allow users to verify, adjust, or recalculate the acquired reference point and reference direction.
[0012] On the other hand, this application also proposes a reference acquisition device for geometric elements, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the reference acquisition device for geometric elements to perform: the method described in any of the examples above.
[0013] On the other hand, this application also proposes a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to be the method described in any of the examples above.
[0014] This application uses human-computer interaction software to determine geometric elements, enumerate and filter non-geometric options, accurately obtain the elements required by the user, and is convenient and highly accurate. It distinguishes unit types based on name prefix identifiers, with clear logic, allowing for quick determination of geometric element attributes. Different naming methods are used for different unit types, standardizing the naming of reference elements and facilitating subsequent processing. Separate rules for obtaining reference points and directions are set for various geometric types, such as taking the centroid of solids and points near the centroid of curved surfaces, comprehensively considering and conforming to practical needs to ensure reasonable results. For curve types, different methods are used to determine the reference based on closure, making the methods scientific and effective. Finally, this application visualizes the obtained results and provides interactive functions, allowing users to intuitively view, verify, and adjust them, enhancing the practicality and flexibility of the method. It can be widely applied in various engineering and design fields involving geometric element processing, improving work efficiency and quality. Attached Figure Description
[0015] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating a method for obtaining the reference of a geometric element in an embodiment of this application; Figure 2 This is a schematic diagram illustrating the process of obtaining the reference point and reference direction in an embodiment of this application; Figure 3 This is a schematic diagram of the reference points and reference directions of the curved surface in the embodiments of this application; Figure 4 This is a schematic diagram of the reference point and reference direction of the cylindrical surface in the embodiments of this application; Figure 5 This is a schematic diagram of the reference point and reference direction of the curve in the embodiments of this application; Figure 6 This is a schematic diagram of a simple interactive interface for obtaining reference points and reference directions in an embodiment of this application; Figure 7 This is a schematic diagram of a reference acquisition device for geometric elements in an embodiment of this application. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0018] like Figure 1 As shown, in order to solve the above problems, this application provides a method for obtaining the reference of geometric elements, the method including: S101. Geometric elements are determined by pre-set human-computer interaction software, and the geometric elements are distinguished to determine the unit type corresponding to the geometric elements. The unit type includes feature units and topological units.
[0019] like Figure 2 As shown, when selecting and measuring geometry in CATIA software, Step 10: The process begins by selecting geometry. Step 20: Through human-computer interaction, select any desired geometry in CATIA software. Step 30: Determine the selection type based on the selected geometry name, which is divided into two types: "Feature Element" and "Topological Element". Then, obtain the reference element according to the selection type.
[0020] In one embodiment, when selecting any geometric element in the Catia software via human-computer interaction, this application comprehensively covers all available geometric types while effectively excluding the selection of non-geometric types, ensuring that the user can accurately select the geometric type that can be parsed by the subsequent program.
[0021] Specifically, it enumerates all available geometry types, including Vertex, Point, Zero Dim, Mono Dim, Bi Dim, TriDim, Line, Edge, Face, Plane, and Infinite Mono Dim, storing these geometry types in an array named Input Object Type. Then, it calls the Selection.SelectElement2 method, passing the Input Object Type array as a parameter, prompting the user to "select a geometry element" and setting a non-multi-select mode. If the user cancels the selection, the program exits the current selection process. Its code implementation can be as follows: Dim InputObjectType(10) InputObjectType(0) = "Point" InputObjectType(1) = "Vertex" InputObjectType(2) = "ZeroDim" InputObjectType(3) = "MonoDim" InputObjectType(4) = "BiDim" InputObjectType(5) = "TriDim" InputObjectType(6) = "Line" InputObjectType(7) = "Edge" InputObjectType(8) = "Face" InputObjectType(9) = "Plane" InputObjectType(10) = "MonoDimInfinite" Status = Selection.SelectElement2(InputObjectType, "Select a geometric element", False) If (Status = "cancel") Then Exit Sub In one embodiment, when processing user-selected geometric elements, it distinguishes between selected feature elements and topological element elements on features. This distinction helps the software perform precise operations based on different types, thus avoiding type errors. First, the name of the user-selected geometric element is obtained, and its type is determined by checking the prefix of the name. Typically, the prefix for the selected element name of a topological element is "Selection," while the name of a feature element does not have this specific prefix. Based on this rule, if the first nine characters of the name are "Selection," the geometric element is determined to be a "topological element"; otherwise, it is determined to be a "feature element," and the determination result is stored in a string variable named Geotype. The code implementation can be as follows: Dim Geotype As String If Left(Selection.Item(1).Value.Name, 9) = "Selection" Then Set Geotype = "Topological Unit" Else Set Geotype = "Feature Unit" End If S102. Determine reference elements according to the type, uniformly name the reference elements, and determine the geometric object name corresponding to the reference elements through a pre-set API, so as to determine the corresponding geometric type according to the geometric object name.
[0022] like Figure 2 As shown, in CATIA software, when selecting and measuring geometry, step 40 involves obtaining the measurement geometry type based on the reference element. This step is further subdivided into various geometry types, including solids or envelopes (S50), surfaces (S51), cylinders (S52), spheres (S53), cones (S54), planes (S55), curves (S56), circles (S57), lines (S58), and points (S59). For curves (S56), their attributes need to be further determined, classifying them as closed or open curves. For open curves, it is also necessary to determine whether they are infinitely long or finite in length. Finally, the coordinate values of the reference point and the reference direction vector values are obtained.
[0023] In one embodiment, during the process of obtaining reference elements based on the selected geometry type, firstly, for topological element elements, their selected names are intelligently converted into a naming format recognized by the software, and this conversion process is ensured to be compatible with other version suffix codes of Catia V5; secondly, regardless of whether the original element is a topological element or a feature element, the final obtained reference element name is uniformly named refobj. This design greatly facilitates the subsequent processing of the software to call reference elements according to a unified standard, effectively simplifying the code logic.
[0024] Different reference objects (refobj) are created based on the geometry type. Specifically, if the geometry type is "topological element," the name of the value from the first selected item is first obtained and assigned to the variable MyBRepName. Then, MyBRepName is processed through a series of string operations, including replacement and truncation, adding specific suffix information to form a BRep name format that meets the requirements. Afterward, the reference object refobj is created on the part1 object using the processed MyBRepName and the parent object of the first selected item. If the geometry type is not "topological element," the reference object refobj is created directly using the value of the first selected item on the part1 object as a parameter. The code implementation can be as follows: If Geotype = "Topological Unit" Then MyBRepName = Selection.Item(1).Value.Name MyBRepName = Replace(MyBRepName, "Selection_", "") MyBRepName = Left(MyBRepName, InStrRev(MyBRepName, "));")) MyBRepName = MyBRepName + ");WithPermanentBody;WithoutBuildError; _ WithSelectingFeatureSupport;MFBRepVersion_CXR"&catia.SystemConfiguration.Release&")" Set refobj = part1.CreateReferenceFromBRepName(MyBRepName,Selection.Item(1).Value.Parent) Else Set refobj = part1.CreateReferenceFromObject(Selection.Item(1).Value) End If In one embodiment, when retrieving reference elements based on the selected type, the measurement geometry type enumeration name is obtained from the measurement workbench via the CATIA V5 Automation API. The measurement workbench allows for the acquisition of measurement geometry type enumeration name serial numbers, which can then be renamed to facilitate identification.
[0025] First, a workbench object variable is declared and set to the workbench named "SPAWorkbench" in the currently active document. Next, using the workbench's method to obtain measurable objects, a measurable object is created based on the previously obtained reference object. Then, a variable is declared to store the geometry name enumeration values, and the geometry name of the measurable object is assigned to it. Subsequently, a string variable is declared, and a selection structure is used to assign the corresponding Chinese geometry type name to this string variable based on different geometry name enumeration values. For example, when the enumeration value is 2, the string variable is assigned "Solid or Envelope," and when the enumeration value is 3, it is assigned "Surface," etc., covering geometry type naming for various cases from 0 to 12. The code implementation can be as follows: Dim TheSPAWorkbench As Workbench Set TheSPAWorkbench = catia.ActiveDocument.GetWorkbench("SPAWorkbench") Set TheMeasurable = TheSPAWorkbench.GetMeasurable(refobj) Dim AGeometryName As CatMeasurableName AGeometryName = TheMeasurable.GeometryName Dim myGeometryName As String Select Case AGeometryName Case 0 myGeometryName = "Unknown type" Case 1 myGeometryName = "Unknown type" Case 2 myGeometryName = "Entity or Envelope" Case 3 myGeometryName = "Surface" Case 4 myGeometryName = "Cylinder" Case 5 myGeometryName = "Sphere" Case 6 myGeometryName = "cone" Case 7 myGeometryName = "Plane" Case 8 myGeometryName = "Curve" Case 9 myGeometryName = "Circle" Case 10 myGeometryName = "Line" Case 11 myGeometryName = "point" Case 12 myGeometryName = "Axis System" End Select S103. Determine the reference point and reference direction corresponding to the geometric type, and determine the coordinate value of the reference point and the direction vector value of the reference direction.
[0026] In one embodiment, the reference point and reference direction are determined based on the geometric enumeration type obtained from the measurement. Specifically, for geometry of the solid or envelope type, the software will automatically identify and determine the centroid coordinates of the solid or envelope as its reference point.
[0027] Its code implementation can be: If myGeometryName = "entity or envelope" Then Set ProductInertia = TheSPAWorkbench.GetMeasurable(refobj) ProductInertia.GetCOG COGArray Positionx1 = COGArray(0) Positiony1 = COGArray(1) Positionz1 = COGArray(2) End If In one embodiment, such as Figure 3 As shown, when obtaining the reference point and reference direction of a surface, the centroid of the surface is first obtained. Instead of directly projecting the centroid onto the surface, the coordinates of the point on the non-shear surface closest to the centroid are obtained; this point is the reference point, and the surface normal at this point is used as the reference direction. The innovation of this method lies in avoiding the error situation where the reference point and direction cannot be generated due to the centroid being projected onto the shear surface. Its code implementation can be as follows: If myGeometryName = "Surface" Then Set ProductInertia = TheSPAWorkbench.GetMeasurable(Selection.Item(1).Value) ProductInertia.GetCOG COGArray Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(COGArray(0), COGArray(1), COGArray(2)) hybridShapePointCoord1.Compute Set TheSPAWorkbench = catia.ActiveDocument.GetWorkbench("SPAWorkbench") Set TheMeasurable = TheSPAWorkbench.GetMeasurable(hybridShapePointCoord1) Dim Coordinates(8) TheMeasurable.GetMinimumDistancePoints refobj, Coordinates Positionx1 = Coordinates(3) Positiony1 = Coordinates(4) Positionz1 = Coordinates(5) Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1) Set hybridShapeLineNormal1 = hybridShapeFactory1.AddNewLineNormal(refobj, reference2, 0, 50, False) hybridShapeLineNormal1.Compute Set dir = part1.HybridShapeFactory.AddNewDirection(hybridShapeLineNormal1) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal End if In one embodiment, such as Figure 4 As shown, when obtaining the reference point and reference direction of a cylindrical or conical surface, for a generally selected incomplete cylinder or cone, its centroid position must first be determined, and then the centroid is projected onto the axis of the cylinder or cone. This projected point is the required reference point, and the axis direction is the reference direction. The code implementation can be as follows: If myGeometryName = "cylinder" or myGeometryName = "cone" Then Set hybridShapeAxisLine1 = hybridShapeFactory1.AddNewAxisLine(refobj) hybridShapeAxisLine1.AxisLineType = 3 If TypeName(Selection.Item(1).Value) = "HybridBody" Or TypeName(Selection.Item(1).Value) = "Body" Or TypeName(Selection.Item(1).Value) = "Part" Then Set ProductInertia = TheSPAWorkbench.Inertias.Add(Selection.Item(1).Value) ProductInertia.GetCOGPosition COGArray Else Set ProductInertia = TheSPAWorkbench.GetMeasurable(Selection.Item(1).Value) ProductInertia.GetCOG COGArray End If Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(COGArray(0), COGArray(1), COGArray(2)) Set reference3 = part1.CreateReferenceFromObject(hybridShapePointCoord1) Set reference4 = part1.CreateReferenceFromObject(hybridShapeAxisLine1) Set hybridShapeProject1 = hybridShapeFactory1.AddNewProject(reference3, reference4) hybridShapeProject1.SolutionType = 0 hybridShapeProject1.Normal = True hybridShapeProject1.SmoothingType = 0 hybridShapeProject1.ExtrapolationMode = 0 Set hybridShapePointCoord2 = hybridShapeFactory1.AddNewPointCoord(0#,0#, 0#) Set reference1 = part1.CreateReferenceFromObject(hybridShapeProject1) hybridShapePointCoord2.PtRef = reference1 hybridShapePointCoord2.Compute hybridShapePointCoord2.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) Set dir = part1.HybridShapeFactory.AddNewDirection(hybridShapeAxisLine1) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal End if In one embodiment, when obtaining the reference point of a sphere, the position of the sphere's center is directly obtained, and this center position is the required reference point. The code implementation can be as follows: If myGeometryName = "Sphere" Then Set hybridShapePointCenter1 = hybridShapeFactory1.AddNewPointCenter(refobj) hybridShapePointCenter1.Compute hybridShapePointCenter1.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) End if In one embodiment, when obtaining the reference point and reference direction of a plane, the reference point is determined by obtaining the centroid of the plane, and the reference direction is determined by obtaining the normal to the plane. Its innovation lies in the fact that the centroid can be obtained in the same way regardless of whether it is a plane in a topological structure or an infinitely large reference plane, avoiding the complexity of using different processing methods due to different plane types. Its code implementation can be as follows: If myGeometryName = "Plane" Then Set dir = part1.HybridShapeFactory.AddNewDirection(refobj) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal Set ProductInertia = TheSPAWorkbench.GetMeasurable(Selection.Item(1).Value) ProductInertia.GetCOG COGArray Positionx1 = COGArray(0) Positiony1 = COGArray(1) Positionz1 = COGArray(2) End if In one embodiment, such as Figure 5 As shown, different processing strategies are used for open and closed curves when obtaining the reference point and reference direction of the curve. For open curves, it is generally desirable to obtain the center and normal of its approximate circle; for closed curves, it is desirable to obtain the center and normal of its approximate circle or waist circle. The innovation of this method lies in its ability to automatically identify whether a curve is closed or open by determining whether the start and end points of the curve coincide, and then take appropriate processing measures. Its code implementation can be as follows: If myGeometryName = "Curve" Then Set hybridShapeDirection1 = hybridShapeFactory1.AddNewDirectionByCoord(1, 1, 1) Set hybridShapeExtremum1 = hybridShapeFactory1.AddNewExtremum(refobj,hybridShapeDirection1, 0) hybridShapeExtremum1.Compute Set Oref0 = part1.CreateReferenceFromObject(hybridShapeExtremum1) Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromPercent(refobj, Oref0, 1, False) hybridShapePointOnCurve1.Compute Set hybridShapePointOnCurve2 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromPercent(refobj, Oref0, 1, True) hybridShapePointOnCurve2.Compute Set hybridShapePointOnCurve3 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromPercent(refobj, Oref0, 0.5, False) hybridShapePointOnCurve3.Compute Set hybridShapePointOnCurve4 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromPercent(refobj, Oref0, 0.25, False) hybridShapePointOnCurve4.Compute Set Oref1 = part1.CreateReferenceFromObject(hybridShapePointOnCurve1) Set Oref2 = part1.CreateReferenceFromObject(hybridShapePointOnCurve2) Set Oref3 = part1.CreateReferenceFromObject(hybridShapePointOnCurve3) Set Oref4 = part1.CreateReferenceFromObject(hybridShapePointOnCurve4) Set TheSPAWorkbench = catia.ActiveDocument.GetWorkbench("SPAWorkbench") Set TheMeasurable = TheSPAWorkbench.GetMeasurable(Oref1) Dim MinDistance 'As double MinDistance = TheMeasurable.GetMinimumDistance(Oref2) If MinDistance = 0 Then Set hybridShapePointBetween1 = hybridShapeFactory1.AddNewPointBetween(Oref1, Oref3, 0.5, 1) hybridShapePointBetween1.Compute hybridShapePointBetween1.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) Set hybridShapePlane3Points1 = hybridShapeFactory1.AddNewPlane3Points(Oref1, Oref3, Oref4) hybridShapePlane3Points1.Compute Set dir = part1.HybridShapeFactory.AddNewDirection(hybridShapePlane3Points1) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal ElseIf MinDistance<>0 Then Set hybridShapePointOnCurve01 = hybridShapeFactory1.AddNewPointOnCurveFromPercent(refobj, 0, False) hybridShapePointOnCurve01.Compute Set hybridShapePointOnCurve02 = hybridShapeFactory1.AddNewPointOnCurveFromPercent(refobj, 0.5, False) hybridShapePointOnCurve02.Compute Set hybridShapePointOnCurve03 = hybridShapeFactory1.AddNewPointOnCurveFromPercent(refobj, 1, False) hybridShapePointOnCurve03.Compute Set Oref01 = part1.CreateReferenceFromObject(hybridShapePointOnCurve01) Set Oref02 = part1.CreateReferenceFromObject(hybridShapePointOnCurve02) Set Oref03 = part1.CreateReferenceFromObject(hybridShapePointOnCurve03) Set hybridShapeCircle3Points1 = hybridShapeFactory1.AddNewCircle3Points(Oref01, Oref02, Oref03) hybridShapeCircle3Points1.Compute Set hybridShapePointCenter1 = hybridShapeFactory1.AddNewPointCenter(hybridShapeCircle3Points1) hybridShapePointCenter1.Compute hybridShapePointCenter1.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) Set hybridShapePlane3Points1 = hybridShapeFactory1.AddNewPlane3Points(Oref01, Oref02, Oref03) hybridShapePlane3Points1.Compute Set dir = part1.HybridShapeFactory.AddNewDirection(hybridShapePlane3Points1) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal End If End If In one embodiment, when obtaining the reference point and reference direction of a circle, the center of the circle is used as the reference point, and the direction of the plane containing the circle is used as the reference direction. The code implementation can be as follows: If myGeometryName = "circle" Then Set hybridShapePlane1Curve1 = hybridShapeFactory1.AddNewPlane1Curve(refobj) hybridShapePlane1Curve1.Compute Set reference4 = part1.CreateReferenceFromObject(hybridShapePlane1Curve1) Set dir = part1.HybridShapeFactory.AddNewDirection(reference4) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal Set hybridShapePointCenter1 = hybridShapeFactory1.AddNewPointCenter(refobj) hybridShapePointCenter1.Compute hybridShapePointCenter1.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) End if In one embodiment, when obtaining the reference point and reference direction of a straight line, for a line segment, its midpoint is determined as the reference point; for an axis, in the CATIA software, the maximum length of the axis is 20000000 mm, and the projection point of the origin on the axis is set as the reference point. The innovation lies in judging whether the straight line is a line segment or an axis by measuring the length of the straight line. Its code implementation can be as follows: If myGeometryName = "Straight Line" Then Set dir = part1.HybridShapeFactory.AddNewDirection(refobj) Directionx2 = dir.GetXVal Directiony2 = dir.GetYVal Directionz2 = dir.GetZVal Dim Length Length = TheMeasurable.Length If Length<1999999>0 Then 'Judge it is not an infinitely long straight line Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveFromPercent(refobj, 0.5, False) hybridShapePointOnCurve1.Compute hybridShapePointOnCurve1.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) ElseIf Length>19999990 Then 'Judge it is an infinitely long straight line Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(0,0, 0) hybridShapePointCoord1.Compute Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1) Set hybridShapeProject1 = hybridShapeFactory1.AddNewProject(reference1, refobj) hybridShapeProject1.SolutionType = 0 hybridShapeProject1.Normal = True hybridShapeProject1.SmoothingType = 0 hybridShapeProject1.ExtrapolationMode = 0 hybridShapeProject1.Compute Set hybridShapePointCoord2 = hybridShapeFactory1.AddNewPointCoord(0,0, 0) Set reference3 = part1.CreateReferenceFromObject(hybridShapeProject1) hybridShapePointCoord2.PtRef = reference3 hybridShapePointCoord2.Compute hybridShapePointCoord2.GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) End If End If In one embodiment, the code implementation for obtaining the reference point of the geometry "point" can be as follows: If myGeometryName = "Point" Then Selection.Item(1).GetCoordinates GetMathcoor Positionx1 = GetMathcoor(0) Positiony1 = GetMathcoor(1) Positionz1 = GetMathcoor(2) Selection.Clear End If In one embodiment, such as Figure 6 As shown, by creating a debug window or user interface window, the acquired reference point coordinates can be displayed at a specified location S61 on the interface, and the direction vector value can be displayed at a specified location S62. When the user clicks the S60 button, the fuzzy selection program will be launched. The code implementation is as follows: Private Sub Command1_Click() PositionAndDirection Text1(0).Text = Val(Positionx1) Text1(1).Text = Val(Positiony1) Text1(2).Text = Val(Positionz1) If Directionx2 = 0 And Directiony2 = 0 And Directionz2 = 0 Then Text1(3).Text = "NULL" Text1(4).Text = "NULL" Text1(5).Text = "NULL" Else Text1(3).Text = Val(Directionx2) Text1(4).Text = Val(Directiony2) Text1(5).Text = Val(Directionz2) End If End Sub like Figure 7 As shown in the illustration, this application also provides a reference acquisition device for geometric elements, including: At least one processor; and, A memory that is communicatively connected to at least one processor; wherein, The memory stores instructions that can be executed by at least one processor to enable a reference acquisition device for a geometric element to perform the method as described in any of the embodiments above.
[0028] This application also provides a non-volatile computer storage medium storing computer-executable instructions, which are configured as described in any of the above embodiments.
[0029] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0030] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0031] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0032] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0033] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.
[0034] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0035] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0036] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0037] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0038] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0039] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0040] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0041] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0042] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0043] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for obtaining the reference of a geometric element, characterized in that, include: Geometric elements are determined by pre-set human-computer interaction software, and the geometric elements are distinguished to determine the unit type corresponding to the geometric elements. The unit type includes feature units and topological units. The reference element is determined according to the type, the reference element is uniformly named, and the geometric object name corresponding to the reference element is determined through a pre-set API, so as to determine the corresponding geometric type according to the geometric object name. Determine the reference point and reference direction corresponding to the geometric type, and determine the coordinate value of the reference point and the direction vector value of the reference direction.
2. The method according to claim 1, characterized in that, Geometric elements are determined through pre-configured human-computer interaction software, specifically including: In the human-computer interaction interface, all geometric elements are enumerated and displayed, including vertex topology type, point feature, edge topology type, line feature, face topology type, face feature, and planar feature; The system obtains the geometric elements selected by the user and uses the filtering mechanism of the human-computer interaction software to exclude non-geometric options from the geometric elements.
3. The method according to claim 1, characterized in that, The geometric elements are distinguished to determine the unit type corresponding to each geometric element, specifically including: Determine the geometric element selected by the user, analyze the name attribute of the geometric element, and determine the identifier contained in the name prefix of the geometric element; The unit type is determined based on the identifier to distinguish whether the geometric element is a feature unit or a topological unit.
4. The method according to claim 1, characterized in that, Based on the type, reference elements are determined, and these reference elements are uniformly named, specifically including: If the unit type is a topological unit, a name conversion operation is performed to convert the user-selected geometric element name into a pre-set standard name format; If the unit type is a feature unit, then the original name of the geometric element is used as a reference element, and the reference elements are uniformly named.
5. The method according to claim 1, characterized in that, Determining the reference point and reference direction corresponding to the geometric type specifically includes: The corresponding acquisition algorithm is determined based on the geometric type, and the reference point and reference direction are determined through the acquisition algorithm.
6. The method according to claim 5, characterized in that, The method further includes: If the geometry type is a solid or envelope type, the centroid coordinates of the solid are obtained as the reference point, and the reference direction is determined according to the global coordinate system or the direction specified by the user. If the geometry type is a surface type, the centroid position of the surface is obtained, and the coordinates of the non-shear surface point closest to the centroid on the surface are further obtained as the reference point, and the surface normal at the reference point is used as the reference direction. If the geometry is a cylindrical or conical surface, the position of the centroid is obtained, and the centroid is projected onto the axis of the cylindrical or conical surface to obtain a reference point, with the axis direction serving as the reference direction. If the geometry is a spherical surface, the center of the sphere is taken as the reference point, and the vector from the center of the sphere to any direction or the fixed direction determined by the coordinate system is taken as the reference direction. If the geometry type is planar, then the centroid of the plane is taken as the reference point, and the normal of the plane is taken as the reference direction. If the geometry type is a curve type, then based on the closure of the curve, the approximate center or geometric center of the circle fitted by the point on the curve is used as the reference point, and the normal direction of the plane containing the approximate circle or the perpendicular direction of the tangent of the curve is used as the reference direction.
7. The method according to claim 6, characterized in that, If the geometry type is a curve type, it specifically includes: If the curve is a closed curve, then by measuring the distance between multiple distant points on the curve, find the two points with the greatest relative distance, and calculate the midpoint or the center of the fitted circle of these two points as the reference point. If the curve is an open curve, an approximate circle is obtained by fitting points on the curve, with the center of the approximate circle as the reference point and the normal of the plane containing the approximate circle as the reference direction.
8. The method according to claim 1, characterized in that, After determining the reference point and reference direction corresponding to the geometric type, and determining the coordinate values of the reference point and the direction vector value of the reference direction, the method further includes: The acquired reference point coordinates and direction vector values are visualized through a pre-set user interface. The user interface provides interactive functionality, allowing users to verify, adjust, or recalculate the acquired reference points and reference directions.
9. A reference acquisition device for geometric elements, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the reference acquisition device for a geometric element to perform the method as described in any one of claims 1-8.
10. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are configured to be the method as described in any one of claims 1-8.