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

cosmosworks macro using ms visual c++
hello all,
i am trying to setup an instance of the cosmosworks object to write a macro. i have the solidworks application object ready and usable, i just can't figure out how to do it for the cosmosworks object. if someone has any knowledge, any at all, i would greatly appreciate the help.
brendan leahy
add a reference to cosmosworkslib
dim cw as cosmosworks
dim cwo as object
dim cwmodel as cwmodeldoc
dim cwstudymgr as cwstudymanager
dim cwstudy as cwstudy
dim errcode as long
' presuming the cosmosworks dll has been loaded...
set cwo = swapp.getaddinobject("cosmosworks.cosmosworks")
if cwo is nothing then
' error here
end if
set cw = cwo.cosmosworks
set cwmodel = cw.activedoc()
set cwstudymgr = cwmodel.studymanager()
if cwstudymgr is nothing then
' error here
end if
set cwstudy = cwstudymgr.createnewstudy("my static study name", 0, cwmixedelementmesh, errcode)
if cwstudy is nothing then
' error here
end if
' and define your enums like so...
public enum cwanalysistype
cwstaticanalysis = 0
cwfrequencyanalysis = 1
cwbucklinganalysis = 2
cwthermalanalysis = 3
cwnonlinearanalysis = 5
end enum
public enum cwmeshelementtype
cwsolidelementmesh = 0
cwmidsurfshellelementmesh = 1
cwrefsurfshellelementmesh = 2
cwmixedelementmesh = 3
cwbeamelementmesh = 4
cwpointelementmesh = 5
end enum
public enum cwrestrainttype
cwrestraintfixed = 0
cwrestraintimmovable = 1
cwrestraintsymmetric = 2
cwrestraintrollersupport = 3
cwrestrainthinge = 4
cwrestraintcomponents = 5
cwrestraintflatsurf = 6
cwrestraintcylindricalsurf = 7
cwrestraintsphericalsurf = 8
cwrestraintcyclicsymmetry = 9
end enum
and so on. i think you get the general idea see how you go with that first
awesome, thank you for helping, though i should have stated that i was working in c++. nonetheless, i am grateful for your help. i have a couple questions about possibly writing this in c++. how does one reference the cosmosworks library in visual c++? do you know the name of the file i need to reference? is there a *.h file i need to include in my function to get it to work?
just use the #import statement and import the following file:
c:\program files\solidworks\cosmosworks\cosworks.tbl
wow... so thats the file.. i looked through my folder structure and i don't have it. i currently have cosmosworks sp 0.0. could that be the problem? i am guessing that if anything that it is on a later service pack?
brendan
p.s. you have been the most significant help i have had on this subject. thank you!
you should have the file. try a search on the c:\program files folder for ".tbl" and take a look at all library files that appear. it may be in a different location based on your os or install.
hrmm.... i don't seem to have it at all. is there a place i could go and download it? is it on the install disk?
nevermind.... i actually got it... thank you again for all the help you gave me.
brendan leahy
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
Scheme 程序语言介绍之一 huangyhg 专家系统 6 2010-02-18 01:22 PM
【转帖】copy an existent sketch into a macro yang686526 SolidWorks二次开发 0 2009-04-12 08:31 PM
【转帖】用Visual C#做托盘程序 yogy C# 0 2007-08-01 02:52 PM


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


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