几何尺寸与公差论坛------致力于产品几何量公差标准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, 10:58 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】from macro to add-in

from macro to add-in
i have a macro that i have created with a userform and a set of modules. i would like to "convert" the macro to an add-in for solidworks. using vb express 2008 and the sw add-in included in the api sdk, i am able to create a new project. how can i bring the macro into the project so i can compile it as a dll add-in? should i export each module and userform individually, or is there a way to import it collectively? my understanding of add-ins are weak at best, so please be gentle.
thanks!
to defeat the wheat, go against the grain.
tom,
the macros that are created in solidworks use vba. vba and vb.net are similar, but it won't be a direct conversion. i do believe that there is a way to launch a macro from a solidworks add-in. i think that was discussed somewhere on this forum about a month or so ago. i know it's not what you are after, but i just wanted to throw it out there. sorry i couldn't be of much more help than this.
tony szuta
cswa, cswp, cswp-smtl
i start conversions by exporting modules from macro and importing into vb (i'm still on vb6!). then i write a class module for the addin functionality.
i think vb.net has a wizard that will convert exported modules for you.
i have a project for converting macros to vb6 addins. it's getting a bit dated, but may still have useful info for you.
tony, thanks for the info. do you know which thread it is? there's been a few, and it is hard to pinpoint which one. i will keep looking and working with your idea.
roland, i have made the project by following your steps, such as dragging the modules and form into the project and creating a class module with the implement code. however, my form is not being shown when i click on it. it has the code, but not the form. i wonder what i am missing? may i email you the code and you can tell me what i need to do?
thanks!
to defeat the wheat, go against the grain.
here is how you can call a solidworks macro:
retval = swapp.runmacro ( filepathname, modulename, procedurename )
tony szuta
cswa, cswp, cswp-smtl
how does the form look in you project pane (where the modules are listed)? does the form show as a "form" or as a "designers" object?
instead of drag-drop, try adding the form using "file --> import".
roland, i have exported each model as .bas files and the form as .frm and .frx files. to compile as i dll, i am hoping to use visual basic express 2008. this does not have a file>import option per se, though it does have a project>add existing item function. however, it doesn't directly import the form, though it can import the modules. is there a way to convert the form to vb.net?
to defeat the wheat, go against the grain.
i am looking at the swaddin and i am starting to understand how it works. i was initially frightened and intimidated by creating an add-in, but i believe it is starting to sink into my skull. i will let ye know if there be any skullduggery afoot.
ahhrrr! (why am i a pirate? one piece!)
to defeat the wheat, go against the grain.
edited: 06/13/2008 at 03:41 pm by tom fosler
quick
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
【转帖】install a .net dll add-in again yang686526 SolidWorks二次开发 0 2009-04-12 09:29 PM
【转帖】copy an existent sketch into a macro yang686526 SolidWorks二次开发 0 2009-04-12 08:31 PM
【转帖】install a .net dll add-in again yang686526 SolidWorks二次开发 0 2009-04-12 06:44 PM


所有的时间均为北京时间。 现在的时间是 08:35 PM.


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