SolidWorks二次开发学习笔记


<iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-1508116105633727&amp;dt=1180609858567&amp;lmt=1180609131&amp;format=468x60_as&amp;output=html&amp;correlator=1180609858557&amp;url=http%3A%2F%2Fwww.julysoft.info%2Fcn%2Fad.htm&amp;ad_type=text_image&amp;flash=9&amp;u_h=768&amp;u_w=1024&amp;u_ah=738&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"></iframe>
                                                     快搜风暴2.0(Quickso Storm)

1.     
SldWorks

a)        GetActiveConfigurationName(string filePath):获取指定SldWorks文件的当前配置名称.注意一点的是,此指定文件不需要打开.

b)        IActiveDoc:获得当前操作的文档

c)        IactiveDoc.GetPathName:获得当前操作文档的路径全称,如果当前不存在文件返回null,如果当前文件未保存返回空

d)        GetConfigurationNames(string filePath):获取指定SldWorks文件的配置名称集合.此文件不需要打开

e)        GetConfigurationCount(string filePath):获得指定SldWorks文件的配置名称数量,此文件不需要打开

f)        GetOpenDocument(string fileName):获得指定文件名称(最好包含扩展名,否则可能得不到正确的结果)ModuleDoc2. 注意,文件必须是被打开的,否则得不到正确的结果. 他和IActiveDoc返回的内容一样,不一样的是IActiveDoc返回的当前的,而此函数返回的是指定的名称的,不一定是当前文档.

g)        GetPreviewBitmap(string filePath,string configName):获得指定文件的指定配置的预览图. 此图和打开窗口的右侧预览相同

h)        NewDocument(string tempPath,long papersize,double width,double height):利用指定的模板文件tempPath创建一个新文档.

i)        OpenDoc6(string filePath,int type,int options,string configName,ref int errors,ref int warings):以指定的参数打开指定文件.参数包括:文件名称/ 打开类型 / 打开方式 / 指定配置 / 传出错误号 / 传出警告号

j)        PreviewDoc(IntPtr handle,string filePath):将指定文件的图像预览描绘到指定Handle的窗口

k)        QuitDoc(string filePath):不经过保存,直接关闭指定文件

l)        CloseDoc(string filePath):关闭文件

m)        RevisionNumber():返回当前正在操作的SldWorks的版本号

2.      SldWorks.ModelDoc2

a)        AddConfiguration3(string name,string memo,string lName,int options):以指定的参数添加一个新配置,参数包括:配置名称 / 配置描述 / 配置别名 / 方式

b)        DeleteConfiguration2(string name):删除指定名称的配置

c)        GetConfigurationNames():获得当前文档的所有配置名称集合

d)        AddCustomInfo3(string configName,string field,string type,string value):向当前文档的当前配置添加自定义属性

e)        DeleteCustomInfo2(string configName,string fieldName):删除指定配置的指定属性

f)        GetCustomInfoCount2(string configName):获得指定配置的自定义属性的数量

g)        GetCustomInfoNames2(string configName):获得指定配置的自定义属性的名称集合

h)        GetCustomInfoType3(string configName,string fieldName):获得指定配置指定属性名称的自定义属性的类型

i)        GetCustomInfoValue(string configName,string fieldName):获得指定配置指定属性名称的自定义属性的值

j)        Save3(int options,int error,int waring):保存当前文件

k)        GetActiveConfiguration():获得当前文档的当前配置

3.      SldWorks.ModelDoc2.AssemblyDoc

a)        AddComponent4(string filePath,string configName,int x,int y,int z):在指定的位置插入指定配置的文件,只适用于装配体文件. 另外要插入的文件必须是被加载到内存中的,欲加载到内存中,可以通过ISldWorks::OpenDoc6函数来实现,细节问题:加载完毕后需要将文件关闭,利用ISldWorks::CloseDoc

4.      SldWorks.ModelDoc2.AssemblyDoc.Component2

a)        GetRootComponent():获得当前根Component2

b)        IGetChildCount():获得当前装配体的子装配数量

c)        GetChildren():获得当前装配的子Component2集合

5.      SldWorks.ModelDoc2.DrawingDoc

a)        GetFirstView():获得当前视图

b)        IView.GetNextView():获取当前sheet的第一个view,这个才是我们应用的视图

6.      SldWorks.ModelDoc2.DrawingDoc.View

a)        GetReferenceModelName():获得当前工程图关联的模型名称(全路径)

b)        ReferencedDocument:获得当前工程图关联的模型ModelDoc2

c)        ReferencedConfiguration:获得当前工程图关联的模型的配置

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章