摘 要: 闡述了SolidWorks二次開發(fā)原理,提出了基于零件尺寸遍歷的尺寸驅(qū)動建模二次開發(fā)方法并詳細論述了開發(fā)思路。以VBA為開發(fā)工具,運用SolidWorks API技術(shù),實現(xiàn)了此方法在SolidWorks中的應(yīng)用。該方法對傳統(tǒng)的尺寸驅(qū)動建模進行了改進,使尺寸驅(qū)動建模具有普遍適用性,可大大提高產(chǎn)品設(shè)計效率。
關(guān)鍵詞: 尺寸遍歷; 尺寸驅(qū)動; VBA; 二次開發(fā)
中圖分類號:TP391 文獻標志碼:A 文章編號:1006-8228(2013)01-14-03
Secondary development of dimension-driven model construction based on Solidworks
Wu Zhilin, Zhang Kaihuan
(School of Mechanical Engineering, Nanjing University of Science and Technology, Nanjing, Jiangsu 210094, China)
Abstract: The basic principles of secondary development of SolidWorks are introduced. A dimension-driven and dimension-traversal method of building models is proposed. Using VBA as the development tool,this method is achieved based on SolidWorks API technology. The traditional secondary development of SolidWorks is improved based on dimension-driven model which makes the modeling process easier and improves the efficiency of product design.
Key words: dimension-driven; dimension- traversal; VBA; secondary development
0 引言
SolidWorks是一款優(yōu)秀的三維工程軟件,因其操作簡單、功能強大、具有很好的開放性和兼容性而為廣大機械設(shè)計工程師所接受。但SolidWorks畢竟是國外軟件,與我國國家標準在很多方面有所不同,多年來,針對SolidWorks軟件的二次開發(fā)工作從未間斷。
在系列零件設(shè)計及形狀相似的模型建模方面,傳統(tǒng)的SolidWorks的二次開發(fā)主要有兩種:一是使用系列零件設(shè)計表;二是定制尺寸驅(qū)動窗體[1-2]。這兩種方法都有其不足之處:系列零件設(shè)計表需要設(shè)計者先輸入大量特定的尺寸數(shù)據(jù),使用時若表中沒有需要的系列,仍需要對模型進行重新建模;定制尺寸驅(qū)動窗體只針對某特定形狀的零件,不具有普遍性,例如,定制的平鍵尺寸驅(qū)動窗體只能在平鍵建模時使用,螺栓建模時將無法使用。
本文以SolidWorks自帶的VBA為開發(fā)工具,提出了基于SolidWorks尺寸驅(qū)動建模的二次開發(fā)方法,該方法與定制尺寸驅(qū)動窗體有相似之處,但在模型針對性方面做了改進,使尺寸驅(qū)動建模具有普遍性。任何在設(shè)計時標注了尺寸的模型,都可以使用該方法輕松快速地實現(xiàn)模型尺寸數(shù)據(jù)更改,從而幫助設(shè)計者大大提高工作效率。……