基于 VB对 AutoCAD二次开发的电机模型自动绘制系统
2021-08-20陈家新何乔
陈家新 何乔



摘要:电机模型绘制是永磁电机设计过程中的一个关键环节。永磁电机在设计时,需要经常调整一些尺寸,若手动在 AutoCAD中绘制电机模型,则非常耗费时间且容易出错。针对永磁电机模型在绘制过程中效率低下的问题,考虑运用参数化的思想,开发一套系统实现模型自动绘制。而采用 AutoCAD 内置的开发工具进行二次开发,又会带来使用不方便和拓展性差的问题。使用Visu- al Basic语言对 AutoCAD进行二次开发,针对一款永磁同步电机实现了参数化绘图,并能调整优化参数,自动批量化地绘制。绘制好的电机模型均以 DXF 格式保存在指定的文件夹内,为后续的电机优化提供了大量的样本。绘制系统界面简洁、操作方便、自动化程度高,为以后电机产品的设计提供了思路。
关键词:永磁电机;Visual Basic;AutoCAD;参数化
中图分类号:TP391.72文献标志码:A
文章编号:1009-9492(2021)11-0017-04
开放科学(资源服务)标识码(OSID):
Automatic Drawing System of Motor Model Based on Secondary Development of AutoCAD with VB
Chen Jiaxin1,He Qiao2
(1.School of Mechanical Engineering, Donghua University, Shanghai 201620, China;2.School of Information Science and Technology, Donghua University, Shanghai 201620, China)
Abstract: Drawing of motor modelis a key link in the design process of permanent magnet motor. In the design of permanent magnet motor, it is necessary to adjust some sizes frequently. If the motor model is drawn manually in AutoCAD, it is very time-consuming and error-prone. Aiming at the problem of low efficiency in the drawing process of permanent magnet motor model, a system was developed to realize the automatic drawing of permanent magnet motor model by using parameterization idea. However, using the built-in development tools of AutoCAD for secondary development will bring the problems of inconvenience and poor expansion, so Visual Basic language was used to the secondarydevelopmentof AutoCAD,theparametricdrawingof apermanentmagnetsynchronousmotor wasrealized,inaddition,the parameters were adjusted to be optimized and draw mass models according to these parameters. The drawn motor models were stored in the specified folder in DXF format, which provided a large number of samples for the subsequent motor optimization. The drawing system has the advantages of simple interface, convenient operation and high degree of automation, which provides ideas for the design of motor products in the future.
Key words: permanent magnet motor; Visual Basic; AutoCAD; parameterized
0 引言
电机的模型绘制是电机产品在设计中的一个基础环节[1]。在使用等效磁路法对永磁电机进行分析和优化时,为了找到电机的最佳设计结果,通常需要不断调整电机某几处的尺寸数据,每调整一次则要在 AutoCAD中重新绘制一张电机的模型。为了使设计方案尽可能覆盖更大的范围,会绘制上百张甚至更多的模型,手工绘制会大幅降低电机设计的效率,同时也很容易出错。因此,设计出一款高效、简洁的电机模型绘制系统是一件十分有必要的事。
传统的基于 AutoCAD 的二次开发思路是利用 Auto- CAD 内置的开发工具(Auto Lisp 语言、VBA 等)[2],开发设计脚本语言,当需要绘制特定图形的时候,在 Auto- CAD中手动加载对应的脚本文件即可。……
