国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

solidworks二次開發--10--從example中尋找

2024-07-21 02:15:49
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn


solidworks的api幫助還是很全面的,里面有好多見簡單而有效的程序,成天在api幫助里泡著,現在做程序的速度是越來越快。好像當年成天在excel中錄制宏看代碼的感覺。下面的程序是api幫助里的,它用來顯示裝配體的所有零部件。我給我的同事們用,他們覺得不錯 :)。程序使用了一個簡單的遞歸方法遍歷了裝配體。
make all assembly components visible example (vb)
this example shows how to make all assembly components visible.

 

'---------------------------------------

'

' preconditions: an assembly document is open.

'

' postconditions: any hidden assembly components are made visible.

'

'---------------------------------------

option explicit

public enum swcomponentvisibilitystate_e

}}-->    }}-->swcomponenthidden = 0

}}-->    }}-->swcomponentvisible = 1

end enum

 

sub traversecomponent _

( _

}}-->    }}-->swcomp as sldworks.component2, _

}}-->    }}-->nlevel as long _

)

}}-->    }}-->dim vchildcomparr }}-->              }}-->as variant

}}-->    }}-->dim vchildcomp }}-->                 }}-->as variant

}}-->    }}-->dim swchildcomp }}-->                }}-->as sldworks.component2

}}-->    }}-->dim swcompconfig }}-->               }}-->as sldworks.configuration

}}-->    }}-->dim spadstr }}-->                    }}-->as string

}}-->    }}-->dim i }}-->                          }}-->as long

}}-->    }}-->

}}-->    }}-->for i = 0 to nlevel - 1

}}-->        }}-->spadstr = spadstr + " }}--> }}-->"

}}-->    }}-->next i

}}-->    }}-->

}}-->    }}-->vchildcomparr = swcomp.getchildren

}}-->    }}-->for each vchildcomp in vchildcomparr

}}-->        }}-->set swchildcomp = vchildcomp

}}-->        }}-->

}}-->        }}-->debug.print spadstr & swchildcomp.name2 & " <" & swchildcomp.referencedconfiguration & ">"

}}-->        }}-->

}}-->        }}-->if swcomponenthidden = swchildcomp.visible then

}}-->            }}-->swchildcomp.visible = swcomponentvisible

}}-->        }}-->end if

}}-->        }}-->

}}-->        }}-->traversecomponent swchildcomp, nlevel + 1

}}-->    }}-->next

end sub

 

sub main()

}}-->    }}-->dim swapp }}-->                      }}-->as sldworks.sldworks

}}-->    }}-->dim swmodel }}-->                    }}-->as sldworks.modeldoc2

}}-->    }}-->dim swassy }}-->                     }}-->as sldworks.assemblydoc

}}-->    }}-->dim swconf }}-->                     }}-->as sldworks.configuration

}}-->    }}-->dim swrootcomp }}-->                 }}-->as sldworks.component2

}}-->    }}-->dim bret }}-->                       }}-->as boolean

}}-->    set swapp = application.sldworks

}}-->    }}-->set swmodel = swapp.activedoc

}}-->    }}-->set swconf = swmodel.getactiveconfiguration

}}-->    }}-->set swrootcomp = swconf.getrootcomponent}}-->}}-->

}}-->    }}-->debug.print "file = " & swmodel.getpathname

}}-->    traversecomponent swrootcomp, 1

end sub
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 类乌齐县| 木兰县| 罗山县| 枝江市| 松溪县| 韶山市| 海口市| 海淀区| 大新县| 山西省| 错那县| 上蔡县| 巫溪县| 乌兰察布市| 无棣县| 新邵县| 昌图县| 凉城县| 霞浦县| 富锦市| 邯郸市| 湘潭市| 吴堡县| 仙游县| 瑞丽市| 彰武县| 云浮市| 华池县| 禹城市| 长寿区| 龙川县| 南澳县| 北流市| 安庆市| 武宣县| 盐源县| 沂南县| 仁寿县| 台南市| 新巴尔虎左旗| 平顺县|