几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 01:16 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】part configurations macro

part configurations macro
i have a part that has a lot of configurations, over 500 to be exact. it is a heater cartridge that has different diameters, length, voltage, wattage, with overbraid, without ob, etc... and the problem is that the configuration names are the part numbers. everyone here is use to locating the proper one by looking at the discription. now, they open an excel spread sheet, find the description and get the part number, then go back to the model and search till they find the right corosponding configuration (part number). i wrote a macro that will dropdown a list of descriptions and when selected it changes to the correct configuration. the only problem is i have to scroll through 500 descriptions at once. does anyone have any ideas how i can catagorize things so that they are easier to find? i am very limited in vb and i want to make sure it is possible before i spend a lot of time on this.
thanks so much,
todd
todd,
why don't you use a configurator? it would be just for you...
regards, basil
"and when you loose control,
you'll reap the harvest you have sown..." (c) pink floyd
solidworks 2008 x64 sp5.0 (production)
solidworks 2009 x64 sp2.0 (testing)
windows xp x64 sp2
core2quad 6600, 4gb ram, 500gb sata, ati firegl v7700 1024mb (softmodded from hd3850), 19" tft
if you are looking up the parts in a spreed sheet and you have the part number/configuration, why not put a textbox on your form. you could copy paste the number from the speed sheet to the form. pressing a button could read the text box and change to the correct configuration.
dan miel
sw2008
todd,
without knowing the product, it's hard to say how to categorize it better. would it make it easier if you had a few selections to make to ween down the number of descriptions?
for example... you could have 3 comboboxes. the first would have ranges of lengths. the options could be something like 1-4", 4-8", 8-12". the second combobox could be wattage ranges. then the third would only contain the descriptions that match the previous 2 selections.
if you post a trimmed down version of your file... say, take the configurations down to only 10 or so, i could take a crack at it.
kevin bennett
kevinsbennett@navitech.us
what field are you using for description? i presume it is the configuration specific field "description" ?
well anyway, save waiting i presumed it was. go to
thanks guys for the responses.
basil, i thought about using a configurator, but i'm not sure how to change the configuration when the design table closes. i want to be able to make a selection per description and automatically set it to the proper configuration (part number) without having to search for the part number and do it manually. is possible to set this up in the configurator?
dan, that is a good thought, but i still would like to get away from having to open the spread sheet to get the part number.
kevin, i thought about that too, but my vb is limited and i am not too sure how to do that. i will post the code i have and maybe you can give me an example.
luke, i am using description in configuration specific.
thanks again guys for the help.
todd
todd, thought so, in that case download my program in the last post, will do it all for you. if you want to know how to program it yourself my book will explain it
kevin,
here's a sample from the code i am using to select a description from a combo box which changes to the proper configuration. if you or anyone else has any suggestions, please fire away. i really liked your suggestion about having several combos to help narrow things down.
thanks,
todd
private sub commandbutton1_click()
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
'changes configurations
if cmb_configuration.value = "heater cartridge, 1/2""d x 6-3/4"" l, 480v/300w, 30"" ss braid on 36"" mge high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx21a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "lj6nx26a"
end if
if cmb_configuration.value = "heater cartridge, 1/2""d x 5-3/4""l, 220v/400w, 30"" ss braid on 36"" mge high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx24a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "lj6nx24a"
end if
if cmb_configuration.value = "heater cartridge, 1/2""d x 4-3/4""l, 220v/775w" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "lj6nx21a"
end if
if cmb_configuration.value = "heater cartridge, 5/8""d x 6""l, 220v/875w, 42"" ss braid on 48"" mge high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "lltax144a"
end if
if cmb_configuration.value = "heater cartridge, 5/8""d x 6""l, 220v/800w, 42"" ss braid on 48"" mge high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ll6ax115a"
end if
if cmb_configuration.value = "heater cartridge, 5/8""d x 5""l, 220v/450w, 36"" ss braid on 42"" mge leads" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ll5ax98a"
end if
if cmb_configuration.value = "heater cartridge, nonstick, 5/8""d x 4-1/4""l, 240v/600w, 42"" ss braid on 48"" mge high temp lead" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ll4ex10an"
end if
if cmb_configuration.value = "heater cartridge, nonstick, 3/4""d x 6""l, 380v/500w, 48"" mge high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ln6ax39an"
end if
if cmb_configuration.value = "heater cartridge, nonstick, 3/4""d x 6""l 220v/500w, 48"" mgt high temp leads" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ln6ax32an"
end if
if cmb_configuration.value = "heater cartridge, nonstick, 3/4""d x 5-1/4""l, 240v/500w, 48"" mge high temp lead" then
boolstatus = part.extension.selectbyid2("lj6nx26a@heater_test.sldprt", "configurations", 0, 0, 0, false, 0, nothing, 0)
part.showconfiguration "ln5ex9an"
end if
end sub
private sub userform_initialize()
'populate configuration drop-down list
cmb_configuration.additem "heater cartridge, 1/2""d x 6-3/4"" l, 480v/300w, 30"" ss braid on 36"" mge high temp leads"
cmb_configuration.additem "heater cartridge, 1/2""d x 5-3/4""l, 220v/400w, 30"" ss braid on 36"" mge high temp leads"
cmb_configuration.additem "heater cartridge, 1/2""d x 4-3/4""l, 220v/775w"
cmb_configuration.additem "heater cartridge, 5/8""d x 6""l, 220v/875w, 42"" ss braid on 48"" mge high temp leads"
cmb_configuration.additem "heater cartridge, 5/8""d x 6""l, 220v/800w, 42"" ss braid on 48"" mge high temp leads"
cmb_configuration.additem "heater cartridge, 5/8""d x 5""l, 220v/450w, 36"" ss braid on 42"" mge leads"
cmb_configuration.additem "heater cartridge, nonstick, 5/8""d x 4-1/4""l, 240v/600w, 42"" ss braid on 48"" mge high temp lead"
cmb_configuration.additem "heater cartridge, nonstick, 3/4""d x 6""l, 380v/500w, 48"" mge high temp leads"
cmb_configuration.additem "heater cartridge, nonstick, 3/4""d x 6""l 220v/500w, 48"" mgt high temp leads"
cmb_configuration.additem "heater cartridge, nonstick, 3/4""d x 5-1/4""l, 240v/500w, 48"" mge high temp lead"
end sub
private sub commandbutton2_click()
unload userform1
end sub
luke, i just download the program and will give it a try. i will also check out your book. thanks again for the help.
luke,
sorry, but how do you start your program?
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】execute a sw macro from a macro of another software, is it possible yang686526 SolidWorks二次开发 0 2009-04-13 10:46 AM
【转帖】custom property macro bugging ou yang686526 SolidWorks二次开发 0 2009-04-13 10:09 AM
【转帖】custom properties for multiple part configurations yang686526 SolidWorks二次开发 0 2009-04-13 10:08 AM
【转帖】macro for inserting and mating a new part in an assembly yang686526 SolidWorks二次开发 0 2009-04-12 09:38 PM
【转帖】copy an existent sketch into a macro yang686526 SolidWorks二次开发 0 2009-04-12 08:31 PM


所有的时间均为北京时间。 现在的时间是 12:27 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多