Chapter 3
An urgent problem that needs flexible code
Overview
This chapter gives an overview of one of the issues we have to solve: Draw information from a large CAD / CAM database to serve a complex expensive analysis program. Due to the continuous evolution of the CAD / CAM system, this problem urgently needs a flexible code.
In this chapter, I have an overview of CAD / CAM issues, vocabulary in this field, and important features of the problem.
Draw information from a CAD / CAM system
I have to review my previous design, which is it leads to me, let me get these insights included in this book.
At that time, I made a support work in a design center. There, engineers use a CAD / CAM system to paint for metal plate components. Figure 3-1 shows an example of these components.
My problem is to write a computer tool to absorb information from the CAD / CAM system for an expert system in a specific way. This expert system needs this information to control the manufacturing of the part. Since it is very complicated and will have a longer life than the current version of the CAD / CAM system, I want the information you want to easily adapt to the revision of this CAD / CAM system.
Figure 3-1 Example of a metal plate
What is an expert system?
The expert system is a special computer system that uses the rules of human experts to make automation decisions. Building an expert system contains two steps. First, obtain the estimation set of experts used for decision-making and completion tasks. Next, this rule set is implemented in a computer system; this step usually uses some business available expert system tools. For analysts, the first step is a far more difficult task.
Understand the words
The first task in the analysis is to understand the glossary used by users and experts in the field. The most important terms that are used are used to describe the size and geometry of the metal plate.
As shown in FIG. 3-1, a metal plate is cut to a specific size and cut from it. Experts use the general name "characteristics" to call these shear blocks. A metal plate can be fully specified by its external size and the characteristics it contain.
Table 3-1 describes the type-characteristic of the shape that can be found in a metal plate. They are the shape that the system must be processed.
Table 3-1 The shape shaped description tank can be found in the metal in a metal plate, and ends in a constant width in a metal. The groove can be towards any angle. It is usually used to cut them with a slot. There are three slots on the left side of Figure 3-1; one horizontally oriented, the other two vertically orientations. Circular cutting on the cave metal plate. Generally, they are generally cut by a wide-varying drill bit. Figure 3-1 There is a hole in the left side by three slots, and there is a big hole in the right side of the metal plate. Cutting blocks or rounded edges. Use a high pressure puncher to impact metal plates in a huge force. Figure 3-1 has three shear blocks; one of the lower right is 45 degrees. The special shape is not a preformed shape of the groove, hole or shear block. At this point, a dedicated punch is created to quickly create them. The power outlet is an ordinary "special" instance. The star shape in Figure 3-1 is a special shape. Any other shape of irregular shapes. Use a combination tool to create them. Figure 3-1 The irregularly shaped object in the lower right is an irregular shape.
CAD / CAM experts also use additional terms in Table 3-2, which is important for understanding.
Table 3-2 Additional CAD / CAM Vocabulary Term Description Geometry to a sheet of metal plate: The position and size of each characteristic, and the outer shape of the metal plate. Part metal plate itself. I need to store geometries of each part. A recordset for storing a component geometry in a data set or model CAD / CAM database. NC and NC set CNC (NC) machines. A specialized manufacturing tool, which is controlled by computer program, using a variety of cutting heads to cut metal. Typically, the computer program is entered geometry, which consists of a set of commands called NC sets.
Description problem
I want to design a program that allows an expert system to open and read a model, which contains a part of a part. I want to analyze the geometry of this part and to build this metal plate for CNC (NC) machine production. In this example, I only care about the metal plate components. Of course, this CAD / CAM system can also handle many other types of components.
From the high level, I hope this system can perform the following steps:
l Analyze the metal sheet.
l The features included in these metal sheets are to see how they should produce them.
l Generate a set of instructions that are manufactured by manufacturing equipment. This set of instructions is called an NC set or numerical control set.
l Send these instructions to the manufacturing device when I want to generate any parts in these components.
The difficulty of this programming task is that I cannot simply analyze the characteristics from the data set and generate NC set commands. These commands to be used, their types, and the order they are used depend on those characteristics and features and other characteristics.
For example, let's look at a shape consisting of several characteristics:
Figure 3-2 A cutting block with two grooves. Left: The part is when the component is completed. Right: In fact it consists of three characteristics.
In fact, in order to make up the shape of the left, I need to get the three characteristics on the right. It is especially important to realize this. Because engineers using this CAD / CAM are usually based on how to consider how to form complex shapes. They know that this will make the parts manufactured faster.
The problem is that I can't consider the relationship between these three characteristics, which generates NC set commands and wants to correctly produce components - there is usually a particular order problem. In this example, if I am like Figure 3-3, first generate a slot and generate a shear block, then when shearing block (remember, the shear block is generated using high pressure punching machine) this metal The board will be bent because the slot will first impair the resistance to fight the metal plate.
Figure 3-3 A failure method. Such order will result in weaken, curved metal plates.
To create the shape shown in Figure 3-2, I must first punch the bumper first, and then do it for the groove. This is feasible because the groove is generated by the planer with a trench. As shown in Figure 3-4, in fact, the cutting blocks can be made to make this work easier, not more difficult.
Fortunately, some people have developed rules for the expert system. I don't have to worry about this. I spend time to explain these complex issues is to let you understand what information needs to be understood.
Figure 3-4 Expert cutting method. This method will produce the correct cutting block.
Important challenges and methods
This CAD / CAM system is constantly evolving and changing. The real problem I face is that when the system changes, it is possible to continue to use that expensive expert system.
My situation is like this: they are using a version V1 of the CAD / CAM system, and a new version V2 will soon be generated. Although these two versions are provided by a vendor, they are not compatible.
Due to various technologies and management reasons, it is impossible to translate the model from a version to the next version. Therefore, this expert system needs to support two versions of the CAD / CAM system.
In fact, the situation is worse than two different versions of the CAD / CAM system. I know that shortly, the third version will be available, but I don't know when this will happen. In order to save the company's investment on the expert system, I want to use the system architecture shown in Figure 3-5.
Figure 3-5 Senior view of my solution
In other words, the application can initialize everything so that the expert system can use the appropriate CAD / CAM system. However, the expert system must have the ability to use any of these versions. So I need to make the expert system, V1 and V2 look the same.
In the geometric suction level is certain, it is certainly necessary, but it does not need to characterize the characteristics. This is because the expert system needs to know which type of feature it processes. However, we don't want to make any changes to the expert system when the V3 of the CAD / CAM system occurs. The basic understanding of the surface-to-object design suggests that I will have a high-level map similar to Figure 3-6.
That is, the expert system is associated with the MODEL class and the CAD / CAM system. The main class is responsible for this initialization of the correct version of Model (ie V1MODEL or V2MODEL).
Now, I will describe these two CAD / CAM systems and how they work. Unfortunately, they are very distorted guys.
Figure 3-6 Class diagram of my solution. [1]
Version 1 is essentially a set of subroutines. In order to obtain information from the model, a series of calls must be performed. A typical query is as follows:
Steps do 1 in CAD / CAM version 1. Open the model XYZ and return a handle 2. Store this handle as h 3. The model of h references, tell me how much characteristics, store it as N 4. Each feature in the model (from 1 to n)
4A. The model of h references, tells me the ID of the i-I element, store it as ID 4b. The model of the H reference, tell me the identity type of ID, store it as T
4c. The model of h references, tells me the X coordinate value of the ID, store it as X (based on type, using T to determine the correct routine)
This system is difficult to get along, it is clear that it is not object-oriented. No matter who to use this system, he must manually protect the context of each query. Each call must know what characteristics it uses.
CAD / CAM sellers aware of the inherent limitations of such systems. The primary motivation they build V2 is to make it object-oriented. Therefore, the geometry in V2 is stored in the object. When the system requests a model, it returns an object of a code model. This model object contains a set of objects, each object represents a feature. Since the problem is based on characteristics, then V2 is used to express these features and I have mentioned: slots, holes, shear blocks, special shapes, and irregularity, it is not surprising. .
Therefore, in V2, I can get a set of objects, which are corresponding to the characteristics existing in the metal plate. The UML chart in Figure 3-7 shows these features.
Figure 3-7 Characteristics of V2
Among them, OOG represents an object-oriented geometry, it is only used to remind V2 is an object-oriented system.
to sum up
In this chapter, I describe the CAD / CAM problem.
l I must use the same way to draw information from different CAD / CAM systems. This will allow company an investment huge system (expert system) to continue to work whenever the CAD / CAM system changes.
l I have two systems, although they contain exactly the same information, but their implementation is very different.
This task has many similarities between other issues I have encountered in the project. There is a different special system there, but I hope to allow other objects to communicate with these different implementations.
[1] This picture and all other maps in this book use the Unified Modeling Language (UML) tag method. See Chapter 2 "UML - Unified Modeling Language", you can get a description of the UML tag method.