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:獲得當前工程圖關聯的模型的配置

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