Lisp articles on the application of CAD+API interface in Zhongwang (2)

In "Lisp articles (1) of Zhongwang CAD+API interface application", how to write Lisp programs in Zhongwang CAD+, how to load and run custom programs and share them, this time will be mentioned in the previous article. After a few questions continue to introduce some new commonly used functions, improve the centerline to generate this small program.

The previous article mentioned that the program can't automatically recognize the circle, can't generate the centerline in batches, there is no related layer, and the length of the centerline beyond the circle can't be selected. How can we improve the program, and the program will become very complicated. In fact, these requirements are very convenient to implement in the middle of CAD+. After the introduction of the last program, I believe that everyone is not so strange to Lisp. In general, the objects that we can draw manually can be drawn in the way of program calls. This is undoubted, everyone can fully use their imagination and make the boring design work more meaningful.

Let's take a look at the effects of the improved program and then analyze the new function used.

We can see from the above figure that there are many types of objects to be selected, including: circle, line, arc, polyline, then how can we exclude other objects by selecting only the circle by frame selection, which uses a choice The set function ssget, sent a filter condition to this function can be used to achieve the classification of the object.

Bulk generation is generally implemented by a loop function, which refers to the While function.

The layer can directly call the -Layer command through the command function to create a layer in the background.

The input value is entered using the getreal function keyboard.

Of course, there are many ways to implement a function. For example, the input function can also be selected in this example. The specific difference can be seen in the help. I hope that you can learn the application of a class of functions through a function, so that you can get twice the result with half the effort.

Compared with the previous version, this program mainly adds a selection set function. First, create a selection set by frame selection. The filter condition is “circle”, then measure the number of objects in the selection set (that is, how many circles), and then enter the loop. Recording information from the first object in the selection set (number is 0) until the center line is generated (this is the same as the program before the change), and the judgment begins to enter the next loop until the number of loops exceeds the end of the number of objects in the selection set. Such a program for automatic batch generation of centerlines is ready.

It can be seen that it is not difficult to write some small programs in Zhongwang CAD+. Some functions are very common functions. It is often these common functions that can solve the big problems in our work. Here are some of the entry-level knowledge of Lisp. These are not enough. I hope that the majority of CAD designers and enthusiasts can actively share the design experience and improve each other.

Another purpose of writing this article is to tell the vast number of friends in the design community. After several years of development, domestic software is not much different from foreign mainstream software in terms of function and interface. The service is unmatched by foreign software. I hope that Zhongwang Software will be able to set off the banner of domestic software as soon as possible. (Author: Wang, design engineers)

Passenger Elevator

Passenger elevator refers to the elevator designed for transporting passengers, which requires perfect safety facilities and certain interior decoration. It is divided into low speed ladder, medium speed ladder and high speed ladder. China Passenger Elevator,Residential Passenger Lifts manufacturers, welcome Electric Passenger Lift,Passenger Elevator Lift purchasers from worldwide to visit our site.

Passenger Elevator,Residential Passenger Lifts,Electric Passenger Lift,Passenger Elevator Lift

Suzhou Stable Trade Co., Ltd , https://www.stable-elevator.com