In the third quarter of 2012, Zhongwang Company released a new generation of products with new cores: Zhongwang CAD+. As a supporter of domestic CAD software, I conducted a download test. After using it, I really had a refreshing feeling, new features. A lot of friends have done in-depth evaluation, I will not join in the fun, here I want to express my own opinion on the API interface of the software. The improvement of the CAD+ interface in the new version is obvious. In addition to the expansion of the function library, the interface compatibility has also been enhanced a lot. This is undoubtedly good news for the connection of some old software.
As a popular platform software, CAD has basically covered all the functions needed in daily design. Sometimes, in order to simplify some drawing steps and improve drawing efficiency, it has to rely on some secondary development programs. Here I take the centerline of the circle as an example to introduce some of the calling methods of the common Lisp functions provided in Zhongwang CAD+.
The centerline is very widely used in our drawing process. If we only need to draw several steps in the CAD platform (without any secondary development software), if we write a Lisp program, we only need one command. . About the introduction of Lisp, you can go online to view, here is not a detailed explanation. Emphasize that Lisp can be written very casually. Basically, there is no need to compile the environment. Word, txt, etc. can be used for writing. Compile and change the extension to .lsp. Some basic library functions can be queried by the developers of the CAD+Help menu.
Here is a statement, I am not engaged in software development, just an ordinary design engineer, Lisp programming is a beginner, if you have the following content, I hope you can give advice. This article is mainly intended to share experiences with you in order to improve together.
Let's get to the point below, let's take a look at how the program implements the centerline in one step.
The above picture is the source code of this program. You can see that there are a lot of parentheses in it. This is a feature of Lisp. This is why some people call it the language of brackets. It is important to note that the brackets must match. More or less programs will report an error. I will briefly explain the meaning of the above code. If there is any unclear introduction, you can still go to the developer help mentioned above.
First of all, the first line defines the start of the applet and the command name, which means that I can use this program as long as I enter ZXX after the program. The latter pair of parentheses is used to define the type of the latter variable. This is followed by a chance to explain it in detail. This can be temporarily ignored for newcomers.
The second line is the combination of the assignment function and the selection function, assigning the selected circle to temp (custom variable)
The third line gets the composition information of the circle, such as layer, center, radius, color, and so on.
The fourth and fifth lines get the center and radius, which is convenient for drawing the center line.
The sixth and seventh lines are the real purpose of the program: start drawing lines.
The eighth line exits silently.
Such a few lines of simple code to achieve the center line drawing, which is mainly used in the setq-assignment function, command-execute command function (equivalent to we directly enter the command in the CAD command line), polar- equivalent to the angle + length inside the CAD The relative coordinates, the "+"-operator, that is, the addition, the rest are not listed one by one, let's help in the query. This is just a simple example. In order to perfect it, we can also create related layers, layer jumps, etc. before drawing lines. These can be called with commands to call related commands.
The program can be written and verified in CAD. The method is also very simple. You can drag and drop the program directly into the drawing area to load (the old version is expected to drag and drop the CAD to the command line), or you can use the ap command to load the dialog box. The latter one has the added advantage that you can load frequently used programs into the startup group so that the software is not loaded.
The result of the program execution.
So we have achieved the goal of generating the centerline in one step, but the program still has many shortcomings, such as selecting objects can only be circles (non-circular objects will be wrong), can not be batch generated, the length of the circle is not adjustable, etc. The program will be adjusted according to the existing problems. For details, please refer to the Lisp article (2) of the CAD+API interface application. The above is my experience in learning in CAD+, I hope that it can play a role in attracting jade, and I hope that you can pay more attention to the growth of domestic software and support domestic software.
L-Shape / Rectangle Shower Enclosures
Zhongshan Jianjie Sanitary Ware Co.,Ltd , https://www.janjieshowerdoor.com