Modeling and drafting methods, control systems, storage media and equipment for stamping dies
By employing multi-process allocation and automated drafting methods, the problems of low efficiency, poor stability, and large human error in existing drafting technologies have been solved, enabling rapid and accurate mold design and production.
Patent Information
- Application Number
- CN202411445549.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-10-16
AI Technical Summary
Existing drafting techniques are inefficient, unstable, and susceptible to human error when dealing with complex mold designs. They also rely on design experience, leading to increased production efficiency and costs.
By employing a multi-process allocation and automated drafting method, and utilizing the NXOpen API and Windows API to perform part feature analysis, annotation matching, and view projection, combined with a human-computer interaction interface and task allocation unit, the drafting efficiency and accuracy are improved.
It enables rapid batch production of engineering drawings, reducing labor and time costs, improving drafting efficiency and stability, and reducing human error.
Smart Images

Figure CN119538512B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of intelligent mold design and manufacturing, and particularly to a modeling and drawing method, control system, storage medium and equipment for stamping dies. Background Technology
[0002] In the context of the rapid development of modern engineering technology and manufacturing, the efficiency of product design and mold development directly affects a company's market competitiveness. However, the drafting technologies commonly used in the market today mainly include single-process software operation, closed internal drafting modes, and methods that heavily rely on manual drawing. These traditional technical solutions are becoming increasingly limited when facing ever-growing demands for complexity and precision. In the process of implementing the inventive technical solutions in the embodiments of this application, the inventors of this application have discovered that the above-mentioned technologies have at least the following technical problems:
[0003] 1. Efficiency bottleneck: Due to limitations in computing resource allocation, single-process drafting software is slow to respond when processing large-scale or highly complex mold designs, making it difficult to meet the needs of rapid design verification and iteration, thus delaying the product launch speed.
[0004] 2. Stability challenges: The drafting process, which relies on manual operation, is susceptible to subjective factors. In addition, the stability of a single-process system under high load is a problem. Frequent software crashes and data recovery requirements seriously affect the continuity of design work and project progress.
[0005] 3. Lack of accuracy: Although manual drawing can reflect the designer's creativity and flexibility, human error is hard to avoid in mold design that pursues micron-level precision. Moreover, the cumulative error is easy to generate in multiple revisions, which reduces the quality and consistency of the final product.
[0006] 4. Technical and experience barriers: Traditional drafting methods rely heavily on the professional skills and rich experience of designers. For complex mold design, newly hired or less experienced designers often need a long learning curve, which limits the overall productivity and innovation of the team. The design of large and complex molds often involves countless adjustments and optimizations. This process is not only time-consuming, but also requires a lot of human and material resources, which significantly increases the company's operating costs. Summary of the Invention
[0007] This invention provides a modeling and drafting method, control system, storage medium, and equipment for stamping dies, which solves the technical problems of limitations in existing drafting techniques. It has wide applicability, enables rapid batch production of engineering drawings, improves drafting efficiency, and reduces labor and time costs.
[0008] This invention provides a modeling and drafting method for stamping dies, which includes the following steps:
[0009] Step S1: Configure processing standards;
[0010] Step S2: Start the interface program, select the output format and fill in the common information, and serialize the common information and customer configuration information on the interface to form a ui.bin file;
[0011] Step S3: Task allocation. Based on the information in the ui.bin file, all selected parts are marked by attributes, and all parts are linked individually by layer to a temporary component temp.part for use by the subprocesses. Multiple subprocesses are created, and tasks are assigned to them. At the same time, the subprocess list is maintained to monitor the status of subprocesses, clear terminated processes, and add new processes.
[0012] Step S4: Perform the task of feature analysis, annotation matching, view projection and layout of the part, and finally export the DWG file.
[0013] The configuration processing standard in step S1 includes customer configuration information, which includes processing color, annotation format, screw type, part attribute name and tolerance.
[0014] Step S2 includes the following steps:
[0015] Step S21: Select the output format and fill in the relevant information in the human-computer interaction interface;
[0016] Step S22: Select the parts to be drawn. Two selectors are provided: a regular view part selector and a lightweight view part selector.
[0017] Step S23: Serialize the interface information. Serialize the state information of the buttons on the interface, the input information of the text boxes, and the handle information of all part entities in the selector into a .bin file on the local disk in binary format.
[0018] Step S24: Pass the path information of the current drawing file as a parameter of the function to the called program.
[0019] Step S3 includes the following steps:
[0020] Step S31: Load drawing file. After the program starts, it first obtains the drawing file path passed by the interface program from the parameter list of the entry function main, and loads the drawing file data through the function provided by NXOpen API.
[0021] Step S32: Obtain serialization information. On the specified path, read the handle information of all selected parts from the generated .bin file;
[0022] Step S33: Mark the part entities. Using the functions provided by the NXOpen API, retrieve all selected parts from the loaded drawing file based on the handle information, and mark the part entities with the attribute name "selected".
[0023] Step S34: Use the functions provided by the NXOpen API to obtain the layer attributes of each part entity, group parts with the same layer together, and store all groups in the list groupList;
[0024] Step S35: Traverse the list and call the working program to process each group of parts: Take out each group in turn, create a temporary drawing file through NXOpen API, link all the part entities in the group to the temporary drawing file, and save the temporary drawing file to the specified path on the local disk; create a process to start the working program drawer.exe through the function provided by Windows API, and store the process handle in a data table processMap of map structure type;
[0025] Step S36: Task check. After the task is assigned and all child processes exit the active state, check whether the DWG drawing file corresponding to each layer of part exists in the specified file directory using the methods provided by the C++ standard library. If the file does not exist, it means the task has failed. Then, restart the working process and reassign the failed task for execution. After the task is completed, check whether the drawing file corresponding to the task has been generated. If the task fails a second time, execute all the output parts of the task layer separately, filter out the failed parts, and record the number and layer information of the failed parts in the form of a log to a local txt file. After the program ends, open the file and display it to the user for viewing.
[0026] Step S4 includes the following steps:
[0027] Step S41: Load the task file. When the working program drawer.exe is started, the path of the task file **.prt is obtained through the parameter list of the program entry function main, and the file is opened through the unfun api to load the part data into memory.
[0028] Step S42: Read the configuration table and load the basic attribute configuration table, tolerance configuration table, feature annotation table, and design standard table;
[0029] Step S43: Read part attribute information and obtain all attribute names specified by the user;
[0030] Step S44: Feature analysis, including planar groove analysis, through groove analysis, countersunk hole analysis, and thread hole analysis; Step S45: Machining annotation matching, read all information in the feature annotation configuration table, and match corresponding machining annotation entries for all features stored in lists such as SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList, and ScrewStructList according to the feature type, structure, surface color, layer, diameter, etc., and fill in the diameter and depth parameters of each feature into the entry;
[0031] Step S46: Drafting;
[0032] Step S47: Export DWG file. After all parts in the current layer have been drawn, use the NXOpen::DxfdwgCreator interface provided by NXOpen to export the current drawing page to the specified path to generate a DWG file.
[0033] The drawing process in step S46 includes the following steps:
[0034] Step S461: Create a drawing, reserving a view area of 10000 for each part. Then, based on the number of parts in the current layer (viewCount), obtain the width sheetW = viewW * viewCount and the height sheetW = viewH of the drawing. Then, create the drawing using the function UF_DRAW_create_drawing.
[0035] Step S462: Create a temporary view based on the view matrix, and iterate through each output part in sequence:
[0036] Step S463: Calculate the view layout. Calculate the projection coordinates of each view of the part and the length and width of the area occupied by all views based on the length, width and height information of the part. Then, calculate the actual size of the drawing frame based on the scale of the drawing frame. Then, scale the size of the standard font of the drawing frame according to the scale of the standard drawing frame size and the actual drawing frame size to obtain the fontSize of the annotation font of the current part view.
[0037] Step S464: Projecting the view. First, hide all parts and only show the part currently being drawn. Then, use the function UF_DRAW_import_view to project the temporary view of the previously created part into a 2D view, which is the main view of the part. Then, use the function UF_DRAW_add_orthographic_view to project the side view of the part based on the main view.
[0038] Step S465, primitive annotation: Integrate the processing annotations of all features in lists such as SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList, and ScrewStructList, classify and count all features with the same annotation terms, sort features with the same primitive letters but different terms, and append the sequence number to the letter as the labeled primitive;
[0039] Step S466: Create a processing annotation. When the total height of the annotation + the total height of the view < the total length of the view × 0.75, place the annotation in the lower left corner of the view area; when the total height of the annotation < the height of the front view, place the annotation on the right side of the front view; when the total height of the annotation < the total height of the view, place the annotation on the right side of the view area; when the total height of the annotation > the total height of the view, and the total height of the view < the total length of the view, divide the annotation into multiple blocks and place them below the view area; when the total height of the annotation > the total height of the view, and the total height of the view > the total length of the view, divide the annotation into multiple blocks and place them on the right side of the view area.
[0040] Step S467: Set the view style and extract the view curves.
[0041] The present invention also provides a control system for modeling and drawing stamping dies, and a method for modeling and drawing said stamping die, comprising:
[0042] Configuration information unit, used to configure processing standards;
[0043] The human-computer interaction interface unit is used to select the output format and fill in common information, and serializes the common information on the interface and the customer configuration information into a ui.bin file;
[0044] The task allocation unit is used to mark all selected parts by attributes according to the information in the ui.bin file, and link all parts by layer to a temporary part temp.part for use by the child processes; it creates multiple child processes and assigns tasks to them; at the same time, it maintains a list of child processes, monitors the status of child processes, clears terminated processes and adds new processes;
[0045] The execution unit is used for feature analysis, annotation matching, view projection, and layout of the part, and finally exports the DWG file.
[0046] The present invention also provides a computer storage medium storing computer instructions, which, when invoked, are used to execute the modeling and drawing method for the stamping die.
[0047] The present invention also provides an electronic device comprising: a processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform a modeling and drafting method for the stamping die.
[0048] One or more technical solutions provided in this invention have at least the following technical effects or advantages:
[0049] By adopting the modeling and drafting methods, control systems, storage media, and equipment for stamping dies, the technical limitations of existing drafting techniques have been solved. This technology has wide applicability, enables rapid batch production of engineering drawings, improves drafting efficiency, and reduces labor and time costs. Attached Figure Description
[0050] Figure 1 This is a flowchart of a modeling and drafting method for a stamping die according to Embodiment 1 of this application. Detailed Implementation
[0051] The modeling and drawing method, control system, storage medium, and equipment for stamping dies in this application solve the technical problems of limitations in existing drawing techniques, have wide applicability, realize the rapid batch production of engineering drawings, improve drawing efficiency, and reduce labor and time costs.
[0052] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0053] Example 1
[0054] Embodiment 1 of this application provides a modeling and drawing method for stamping dies, which includes the following steps: Step S1, configuring machining standards;
[0055] Step S2: Start the interface program, select the output format and fill in the common information, and serialize the common information and customer configuration information on the interface to form a ui.bin file;
[0056] Step S3: Task allocation. Based on the information in the ui.bin file, all selected parts are marked by attributes, and all parts are linked individually by layer to a temporary component temp.part for use by the subprocesses. Multiple subprocesses are created, and tasks are assigned to them. At the same time, the subprocess list is maintained to monitor the status of subprocesses, clear terminated processes, and add new processes.
[0057] Step S4: Perform the task of feature analysis, annotation matching, view projection and layout of the part, and finally export the DWG file.
[0058] The configuration processing standard in step S1 includes customer configuration information, which includes processing color, annotation format, screw type, part attribute name and tolerance.
[0059] Step S2 includes the following steps:
[0060] Step S21: Select the output format and fill in the relevant public information in the interface program;
[0061] Step S22: Select the parts to be drawn. Two selectors are provided: a regular view part selector and a lightweight view part selector.
[0062] The drawing generated by the part selector in the regular view is a standard drawing with complete annotation information. The lightweight view selector is an alternative for the design of highly complex parts such as casting mold bases and parts with many surfaces. This is because drawing these parts in the conventional way in older design software such as NX8.5 can easily cause the modeler to crash or freeze. The lightweight view ignores and simplifies some view details, allowing the drawing to be generated smoothly.
[0063] Step S23: Serialize the interface information. Serialize the state information of the buttons on the interface program, the input information of the text boxes, and the handle information of all part entities in the selector into a .bin file on the local disk in binary format.
[0064] Step S24: The Windows API-provided function shellexe calls Allocator.exe, an intermediate program responsible for task allocation and worker process scheduling, and passes the current image file path information as a parameter to the called program.
[0065] In the first embodiment of this application, step S3 includes the following steps:
[0066] Step S31: Load drawing file. After the program starts, it first obtains the drawing file path passed by the interface program from the parameter list of the entry function main, and loads the drawing file data through the function provided by NXOpen API.
[0067] Step S32: Obtain serialization information. On the specified path, read the handle information of all selected parts from the generated .bin file;
[0068] Step S33: Mark the part entities. Using the functions provided by the NXOpen API, retrieve all selected parts from the loaded drawing file based on the handle information, and mark the part entities with the attribute name "selected".
[0069] Step S34: Use the functions provided by the NXOpen API to obtain the layer attributes of each part entity, group parts with the same layer together, and store all groups in the list groupList;
[0070] Step S35: Traverse the list and call the worker program to process each group of parts: Take out each group sequentially, create a temporary drawing file using the NXOpen API, link all part entities in that group to the temporary drawing file, and save the temporary drawing file to the specified path on the local disk; create a process to start the worker program drawer.exe using functions provided by the Windows API, and store the process handle in a map-structured data table processMap (the key is the process creation timestamp, and the val is the process handle value) for subsequent monitoring and maintenance; for performance reasons, before creating a new worker process, the liveness status of processes in the processMap table is checked. If the number of existing active processes is less than 4, a new worker process will be created; otherwise, the assigned process will sleep for 3 seconds before the next process check. (During the check, a timeout judgment is performed on the processes in the list based on their creation timestamps; if a child process survives for more than a reasonable time, the process will be forcibly terminated).
[0071] Step S36: Task check. After the task is assigned and all child processes exit the active state, check whether the DWG drawing file corresponding to each layer of part exists in the specified file directory using the methods provided by the C++ standard library. If the file does not exist, it means the task has failed. Then, restart the working process and reassign the failed task for execution. After the task is completed, check whether the drawing file corresponding to the task has been generated. If the task fails a second time, execute all the output parts of the task layer separately, filter out the failed parts, and record the number and layer information of the failed parts in the form of a log to a local txt file. After the program ends, open the file and display it to the user for viewing.
[0072] In the first embodiment of this application, step S4 includes the following steps:
[0073] Step S41: Load the task file. When the working program drawer.exe is started, the path of the task file **.prt is obtained through the parameter list of the program entry function main, and the file is opened through the unfun api to load the part data into memory.
[0074] Step S42: Read the configuration table and load the basic attribute configuration table, tolerance configuration table, feature annotation table, and design standard table;
[0075] Step S43: Read part attribute information and obtain all attribute names specified by the user; then, through some function interfaces provided by NXOpen API, read some attributes that have been pre-assigned to the part entity, which mainly include: part number, part name, part specifications, view matrix, view zero point coordinates, material, weight, page number and other basic information.
[0076] Step S44: Feature analysis, including planar groove analysis, through groove analysis, countersunk hole analysis, and threaded hole analysis;
[0077] Among them, through the NXOpen API:
[0078] Planar groove analysis:
[0079] Based on the plane's normal and coordinates, filter out all recessed planes planeFace1 on the part entity whose normals are parallel to the view direction and whose coordinates are 0.5mm below the upper surface of the part and 0.5mm above the lower surface of the part.
[0080] Get all adjacent faces of planeFace1, filter them out and store all the faces whose plane normal is perpendicular to the view direction, whose cylindrical surface axis is parallel to the view direction, and whose maximum coordinates are in the positive direction of planeFace1 in the list slideFaceList;
[0081] The front and back of the plane groove are determined by comparing the normal and view direction of planeFace1. The depth from planeFace1 to the surface of the part entity is obtained, as well as the color bottomFaceColor and the side color slideFaceColor of planeFace1. The center point centerPt of planeFace1 is obtained as the annotation point.
[0082] Store all the above data in a data structure called SlotPlannarStruct, and then store SlotPlannarStruct in a list called SlotPlannarStructList.
[0083] Through-slot analysis:
[0084] Based on the normal of the plane, filter out all planes planeFace1 on the part entity whose normals are parallel to the view direction. Then, obtain all loops loopList on planeFace1 through the function UF_MODL_ask_face_loops and filter out planes with less than 2 loops.
[0085] Iterate through the loopList and get the number of edges for each loop. If the number is greater than 1, get the faces based on all the edges on the loop, exclude planeFace1, and take all the faces whose plane normal is perpendicular to the view direction and whose cylindrical axis is parallel to the view direction as the side surface slideFaceList of the slot.
[0086] Traverse the list slideFaceList, and sequentially take the offset point ptMidOffset, which is offset by 0.1mm from the midpoint of the horizontal edge on the side slideFace1 surface in the direction of (planar normal, end point of the cylindrical arc edge to the center of the arc). Use the function UF_MODL_trace_a_ray to perform ray detection in both the positive and negative directions of the view to determine whether the slot is a through slot. If it is, get the color slideFace1 (slideFaceColor) and get the center point centerPt of the slot as the annotation point.
[0087] Store all the above data into a data structure TongCaoStruct, and then store TongCaoStruct into a list TongCaoStructList.
[0088] Countersunk hole analysis:
[0089] Based on the plane's normal, select all planes headFaceList on the part entity whose normals are parallel to the view direction. Then, filter out planes in the list whose longest side is not an arc based on the edges on the plane. Filter out the outer surfaces of all entities in the list based on the coordinates. Finally, use the function UF_MODL_ask_face_loops to get all loops loopList on each plane in the list and exclude planes with fewer than 2 loops.
[0090] Iterate through the list headFaceList, and get all the adjacent faces adjFacesList of each face headFace1 in turn. Then, filter out two concentric cylindrical faces cylinder1 and cylinder2. Determine whether cylinder1 and cylinder2 are located on opposite sides of headFace1 by using the coordinates of the three faces headFace1, cylinder1, and cylinder2. If so, get their adjacent faces by using cylinder1 and cylinder2 respectively. Determine whether there is a third-level cylindrical face cylinder3 by using the concentricity.
[0091] (Here, countersunk holes are defined up to three levels.) Arrange cylinder1, cylinder2, and cylinder3 in ascending order of hole diameter, and obtain the countersunk planes headFace1 and headFace2 between them. Obtain the cylindrical surface colors cylinder1Color, cylinder1Color, and cylinder1Color. Obtain the countersunk surface colors headFace1Color and headFace2Color. Determine the orientation (front / back) of the countersunk hole by comparing the normal of the countersunk surface with the view direction (FontOrBack). Obtain the diameters of the cylindrical surfaces cylinder1diam, cylinder2diam, and cylinder3diam, obtain the depths of the countersunk planes depth1 and depth2, and obtain the center Pt of the largest cylindrical surface cylinder3diam as the annotation point.
[0092] Store all the above data in a data structure called ScrewWhitHeadStruct, and then store ScrewWhitHeadStruct in a list called ScrewWhitHeadStructList.
[0093] Tooth hole analysis:
[0094] Based on the axis of the cylindrical surface, obtain a cylinder list of all cylindrical surfaces whose axes are parallel to the view direction, and then exclude all non-closed cylindrical surfaces in the cylinder list based on whether the horizontal and vertical dimensions of each cylindrical surface are equal to the diameter of the cylinder.
[0095] Iterate through each cylindrical surface (cylinder1) in cylinderList, obtain the adjacent faces of cylindrical surface (cylinder1) using the function UF_MODL_ask_adjac_faces, and find the plane or conical surface whose normal is parallel to the cylindrical surface and whose horizontal and vertical dimensions are equal to the diameter of the cylinder as the bottom face (bottomFace). If there is no such surface, the cylindrical surface is a through hole (holeType=1); otherwise, it is a blind hole (holeType=0). Obtain the diameter (diam), depth (depth), and color (cylinder1Color) of cylindrical surface (cylinder1), obtain the center (centerPt) of cylindrical surface (cylinder1) as the annotation point, and obtain the bottom face color (bottomFaceColor) of the blind hole. Store all the above data in a data structure (ScrewStruct), and then store ScrewStruct in a list (ScrewStructList).
[0096] Step S45: Processing annotation matching. Read all information in the feature annotation configuration table. Based on the feature type, structure, surface color, layer, diameter, and other data, match the corresponding processing annotation entries for all features stored in lists such as SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList, and ScrewStructList. Fill in the diameter and depth parameters of each feature into the entry.
[0097] Step S46: Drafting;
[0098] Step S47: Export DWG file. After all parts in the current layer have been drawn, use the NXOpen::DxfdwgCreator interface provided by NXOpen to export the current drawing page to the specified path to generate a DWG file.
[0099] The drawing process in step S46 includes the following steps:
[0100] Step S461: Create a drawing, reserving a view area of 10000 in width and 10000 in height for each part (viewW = 10000, viewH = 10000). Then, based on the number of parts in the current layer (viewCount), obtain the width sheetW = viewW * viewCount and the height sheetW = viewH of the drawing. Finally, create the drawing using the function UF_DRAW_create_drawing.
[0101] Step S462: Create a temporary view based on the view matrix, and iterate through each output part in sequence: Since the placement of each part in the drawing file is not fixed, we must project the part onto the drawing plane according to the specified orientation when drawing; to do this, we first need to create a temporary working view tempView according to the view matrix of the part (similar to taking a picture at a selected angle). This temporary view is the key object for projecting the 2D engineering drawing; here we use the function interfaces uc6434 and uc6450 provided by NX to achieve this. Function interface uc6434 is responsible for creation, and function interface uc6450 is responsible for saving.
[0102] Step S463: Calculate the view layout. First, calculate the projection coordinates of each view of the part and the length and width of the area occupied by all views based on the length, width and height information of the part. Then, calculate the actual size of the drawing frame based on the scale of the drawing frame. Then, scale the size of the standard font of the drawing frame according to the scale of the standard drawing frame size and the actual drawing frame size to obtain the fontSize of the annotation font of the current part view.
[0103] Step S464: Project view. First, hide all parts and only show the part currently being drawn. Then, use the function UF_DRAW_import_view to project the temporary view of the part created earlier into a 2D view as the main view of the part. Then, use the function UF_DRAW_add_orthographic_view to project the side view (front, back, left, right) of the part based on the main view.
[0104] Step S465, primitive annotation: Integrate the processing annotations of all features in lists such as SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList, and ScrewStructList, classify and count all features with the same annotation terms, sort features with the same primitive letters but different terms, and append the sequence number to the letter as the labeled primitive;
[0105] Graphic element annotation interference avoidance:
[0106] Considering the problem of interference when the primitives labeled in the view are too dense, the following solution is made: use the function UF_VIEW_map_model_to_drawing to map the label points centerPt of all features to the main view to obtain the 2D point p1;
[0107] Measure the approximate conversion coefficients of the font size and character width and height based on the font type of the graphic element. For example (font type: Fangsong, alignment: bottom left, character spacing 0.5, character width-to-height ratio 0.7, measurement result: font size conversion coefficient: width 0.5, height 1.0 Note: the more accurate the conversion coefficient, the better).
[0108] Sort all 2D points of the graphic elements from top to bottom in the y direction;
[0109] After sorting, check each annotation point p1 in sequence and all annotation points p2 within a range of twice the character height below it. Compare the distance in the x and y dimensions with the character width and character height of the primitives p1 and p2 to determine whether primitives p1 and p2 interfere. If they do, move the position of the annotation point of primitive p2 down (offset one character height below the vertical height of the annotation point p1).
[0110] Finally, all element annotations are created on the main view using NXOpen::CreateDraftingNoteBuilder.
[0111] Step S466: Create machining annotations. The arrangement of machining annotations should take into account the overall layout of the view and the fullness of the drawing. When the total height of the annotation + the total height of the view < the total length of the view × 0.75, the annotation is placed in the lower left corner of the view area; when the total height of the annotation < the height of the front view, the annotation is placed on the right side of the front view; when the total height of the annotation < the total height of the view, the annotation is placed on the right side of the view area; when the total height of the annotation > the total height of the view, and the total height of the view < the total length of the view, the annotation is divided into multiple blocks and placed below the view area; when the total height of the annotation > the total height of the view, and the total height of the view > the total length of the view, the annotation is divided into multiple blocks and placed on the right side of the view area; (the length of the annotation is equal to the number of annotation characters × font size × font length coefficient, and the height is equal to the number of annotation lines × font size × font height coefficient).
[0112] Step S467: Set view style and extract view curves. Since multiple parts on the same layer are projected onto the same drawing sheet, to prevent the views of different parts from overlapping and interfering with each other, all parts except the current zero must be hidden before each projection. Furthermore, the current part must be hidden before the next part is output after the current part is drawn. Due to the association between the view and the part, the view will also disappear. Therefore, when setting the view style, the edges of the parts associated with the view must be extracted as curves to decouple the view from the part, so that the view will not change with the state of the part.
[0113] This can be achieved through the interfaces provided by NXOpen:
[0114] drawView1->Style()->General()->SetExtractedEdges(Preferences::GeneralExtr actedEdgesOptionNonAssociative).
[0115] Example 2
[0116] Embodiment 2 of this application provides a control system for modeling and drawing stamping dies, and a method for modeling and drawing the stamping die, comprising:
[0117] Configuration information unit, used to configure processing standards;
[0118] The human-computer interaction interface unit is used to select the output format and fill in common information, and serializes the common information on the interface and the customer configuration information into a ui.bin file;
[0119] The task allocation unit is used to mark all selected parts by attributes according to the information in the ui.bin file, and link all parts by layer to a temporary part temp.part for use by the child processes; it creates multiple child processes and assigns tasks to them; at the same time, it maintains a list of child processes, monitors the status of child processes, clears terminated processes and adds new processes;
[0120] The execution unit is used for feature analysis, annotation matching, view projection, and layout of the part, and finally exports the DWG file.
[0121] Example 3
[0122] Embodiment 3 of this application provides a computer storage medium storing computer instructions, which, when invoked, are used to execute the modeling and drawing method of the stamping die.
[0123] Example 4
[0124] Embodiment 4 of this application provides an electronic device, which includes: a processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform a modeling and drawing method for the stamping die.
[0125] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention 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.
[0126] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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 illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0127] 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.
[0128] 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.
[0129] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0130] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A modeling drafting method of a press die, characterized by, The method comprises the following steps: Step S1, configuring processing standards; Step S2, starting an interface program, selecting a drawing format and filling in public information, and serializing the public information and customer configuration information on the interface to form a ui.bin file; The step S2 comprises the following steps: Step S21, selecting a drawing format and filling in related information in a man-machine interface; Step S22, selecting drawing parts, and providing two selectors, including a conventional view part selector and a lightweight view part selector; Step S23, serializing interface information, serializing the state information of buttons, the input information of text boxes, and the handle information of all part entities in the selectors on the interface to a.bin file on a local disk in a binary format; Step S24, passing path information of a current drawing file to a called program as a function parameter; Step S3, task allocation, marking all selected parts by attributes according to the information in the ui.bin file, and linking all parts to a temporary part temp.part according to layers for use by a child process; creating multiple child processes, and allocating tasks to the child processes; meanwhile, maintaining a child process list, monitoring the state of the child processes, and clearing an end process and adding a new process; The step S3 comprises the following steps: Step S31, loading a drawing file, obtaining a drawing file path passed by an interface program from a parameter list of an entry function main after program startup, and loading drawing data by a function provided by an NXOpen Api; Step S32, obtaining serialized information, reading handle information of all selected parts from a generated.bin file on a specified path; Step S33, marking part entities, obtaining all selected parts from a loaded drawing file according to handle information by a function provided by an NXOpen Api, and marking the part entities by an attribute name selected; Step S34, obtaining layer attributes of each part entity by a function provided by an NXOpen Api, grouping parts with the same layer, and storing all groups in a list groupList; Step S35, traversing the list, and calling a work program to process each group of parts: sequentially taking out each group, linking all part entities in the group to a temporary drawing file by creating a temporary drawing file through an NXOpen Api, and saving the temporary drawing file to a specified path on a local disk; creating a process to start the work program drawer.exe by a function provided by a Windows api, and storing a process handle in a data table processMap of a map structure type. Step S36, task check, when the task is assigned and all sub-processes exit the active state, check whether there is a DWG drawing file corresponding to each layer part in the specified file directory by using a method provided by a c++ standard library. If the file does not exist, it means that the task fails, and then the working process is started again, the failed task is re-assigned and executed, and after the end, it is checked whether the drawing file corresponding to the task is generated. If the task fails twice, all the parts of the layer are separated and executed to filter out the failed parts, and the number and layer information of the failed parts are recorded in a local txt file in the form of a log. After the program ends, the file is opened to show the user for reading. Step S4, execute the task, analyze the features of the part, match the annotations, project the view and layout, and finally export the DWG file.
2. A method of modeling and drafting a stamping die according to claim 1, wherein: The configuration processing standard in step S1 includes customer configuration information, and the customer configuration information includes processing color, annotation format, screw model, part attribute name and tolerance marking.
3. The modeling and drafting method of a punch press die according to claim 1, wherein, The step S4 includes the following steps: Step S41, load the task file, when the working program drawer.exe is started, the task file path **.prt passed through the parameter list of the program entry function main is obtained, the file is opened through unfun api, and the part data is loaded into the memory; Step S42, read the configuration table, load the basic attribute configuration table, the tolerance configuration table, the feature annotation table and the design standard table; Step S43, read the part attribute information, obtain all the attribute names specified by the user; Step S44, feature analysis, including plane slot analysis, through slot analysis, screw whit head hole analysis and screw hole analysis; Step S45, processing annotation matching, read all the information in the feature annotation configuration table, match the corresponding processing annotation entries in the SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList and ScrewStructList lists according to the type, structure, surface color, layer and diameter data of the features, and fill the diameter and depth parameters of each feature into the entries; Step S46, drawing; Step S47, export the dwg file, after all the parts in the current layer are drawn, the current drawing sheet is exported to the specified path to generate the dwg file through the interface NXOpen::DxfdwgCreator provided by NXOpen.
4. The modeling and drafting method of a press die according to claim 3, wherein The drawing in step S46 includes the following steps: Step S461, create a drawing, reserve a view area of 10000*10000 for each part, then obtain the width sheetW=viewW*viewCount and height sheetW=viewH of the drawing according to the number of part drawing in the current layer viewCount, and then create the drawing through the function UF_DRAW_create_drawing. Step S462, creating temporary view according to view matrix, traversing each drawing part in turn: Step S463, calculating view layout, calculating projection coordinates of each view of the part and length and width of the area occupied by all views according to the length, width and height information of the part, and then calculating the size of the actual frame according to the proportion of the frame size and the size of the actual frame; then scaling the size of the standard font of the frame according to the proportion of the standard frame size and the actual frame size, to obtain the label font size fontSize of the current part view; Step S464, projecting view, first hiding all parts and displaying only the current drawing part; then projecting the temporary view of the part created in the previous step as a 2D view through the function UF DRAW_import_view, as the main view mainView of the part; then projecting the side view of the part based on the main view mainView through the function UF DRAW_add_orthographic_view; Step S465, feature labeling, integrating the machining annotations of all features in the SlotPlannarStructList, TongCaoStructList, ScrewWhitHeadStructList, and ScrewStructList lists, classifying and counting the number of features with the same annotation word, sorting features with the same letter and different words, and concatenating the serial number to the letter as the labeled feature; Step S466, creating machining annotations, when the overall height of the annotations + the overall height of the view < the overall length of the view × 0.75, the annotations are placed in the lower left corner of the view area; when the overall height of the annotations < the height of the front view, the annotations are placed to the right of the front view; when the overall height of the annotations < the overall height of the view, the annotations are placed to the right of the view area; when the overall height of the annotations > the overall height of the view, and the overall height of the view < the overall length of the view, the annotations are divided into multiple blocks and placed below the view area; when the overall height of the annotations > the overall height of the view, and the overall height of the view > the overall length of the view, the annotations are divided into multiple blocks and placed to the right of the view area; Step S467, setting view style, extracting view curve.
5. A control system for modeling and drafting of a stamping die for use in the method of modeling and drafting of a stamping die according to any one of claims 1-4, characterized in that, Comprising: a configuration information unit for configuring machining standards; a human-computer interaction interface unit for selecting drawing formats and filling in public information, serializing the public information and customer configuration information on the interface to form a ui.bin file; selecting the format of the drawing and filling in the related information in the human-computer interaction interface; selecting drawing parts, providing two selectors, including a regular view part selector and a lightweight view part selector; serializing interface information, serializing the state information of the buttons, the input information of the text boxes, and the handle information of all part entities in the selectors on the interface to a.bin file on the local disk in binary format; passing the path information of the current drawing to the called program as a parameter of the function; Task allocation unit, in order to mark all selected parts by attribute according to the information in ui.bin file, and link all parts to a temporary part temp.part according to layer for sub-process; create multiple sub-processes, and allocate tasks to sub-processes; maintain sub-process list, monitor sub-process state, and add new process to clear end process; Load the drawing, the program starts to get the drawing path passed by the interface program from the parameter list of the main function, and loads the drawing data through the function provided by the NXOpen Api; Get serialization information, read the handle information of all selected parts from the generated.bin file on the specified path; Mark part entity, get all selected parts from the loaded drawing according to the handle information through the function provided by the NXOpen Api, and mark the part entity with the attribute name selected; Get the layer attribute of each part entity through the function provided by the NXOpen Api, divide the parts with the same layer into a group, and store all groups in the list groupList; Traverse the list, call the work program to process each group of parts: take out each group in turn, link all part entities in the group to a temporary drawing through the NXOpen Api, and save the temporary drawing to the specified path on the local disk; Create a process to start the work program drawer.exe through the function provided by the Windows api, and store the process handle in a map structure type data table processMap; Task inspection, when the task allocation is completed and all sub-processes exit the active state, check whether there is a DWG drawing file corresponding to each layer part in the specified file directory through the method provided by the c++ standard library, if the file does not exist, it means that the task fails, then start the work process again, reassign and execute the failed task, and check whether the drawing file corresponding to the task is generated after ending, if the task fails twice, separate all the parts of the task layer, screen out the failed parts, and record the number and layer information of the failed parts in a local txt file in the form of a log, open the file to show the user for reading after the program ends; Task execution unit, used for feature analysis, annotation matching, view projection and layout of parts, and finally export DWG file.
6. A computer storage medium, the computer storage medium stores computer instructions, the computer instructions are called to execute the modeling and drawing method of the stamping die according to any one of claims 1-4.
7. An electronic device, wherein, The electronic device includes a processor and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the modeling and drawing method of the stamping die according to any one of claims 1-4.
Citation Information
Patent Citations
Method for on-line monitoring transformer substation based on multi-process architecture
CN105096210A
Parallel method and system for vector space overlay analysis in geographic information system
CN107066542A