几何尺寸与公差论坛

 找回密码
 注册
查看: 671|回复: 0

【转帖】open the equation manager of a componen

[复制链接]
发表于 2009-4-12 21:57:56 | 显示全部楼层 |阅读模式
open the equation manager of a component
hi!
i have created an assembly and i'm editing all the parts to have their equations, so first i have to open their equation managers.
i have tried with this code but it opens the equation manager of the modeldoc (=of the assembly):
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim sweqnmgr as sldworks.equationmgr
dim swdim as sldworks.dimension
set swapp = createobject("sldworks.application")
set swmodel = swapp.activedoc
set sweqnmgr = swmodel.getequationmgr
dim ncount as integer, i as integer, ipos as integer
dim a as string
ncount = sweqnmgr.getcount
for i = 0 to ncount - 1
a = sweqnmgr.equation(i)
set swdim = swmodel.parameter(a)
cells(k, 3) = swdim.fullname
the problem is that i active the modeldoc and i have to active the component, so i turn the component into a modeldoc but it doesn´t work:
.....
dim c as sldworks.modeldoc2
set c = swcomp.getmodeldoc
set swdim = swmodel.parameter(b)
cells(k, 3) = swdim.fullname
can you help me?
thanks a lot!
i don't see where you get the equation manager for the component's document. did you just miss posting it? you at least need something like
dim c as sldworks.modeldoc2
set c = swcomp.getmodeldoc
set a = c.getequationmgr
i'll get you eh steve, if it's the last thing i dooooo!
thank you josh, you´re right!
i have done like this and it works:
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swassy as sldworks.assemblydoc
dim swchildcomp as sldworks.component2
dim vchildcomp as variant
dim sweqnmgr as sldworks.equationmgr
dim swdim as sldworks.dimension
dim c as sldworks.modeldoc2
set swapp = createobject("sldworks.application")
set swmodel = swapp.activedoc
set swassy = swmodel
dim a as boolean
dim i as integer
dim ncount as integer, j as integer
dim a as string
vchildcomp = swassy.getcomponents(false)
for i = 0 to ubound(vchildcomp)
set swchildcomp = vchildcomp(i)
a = swchildcomp.select3(true, nothing)
swmodel.editpart
set c = swcomp.getmodeldoc 'component --> modeldoc
set sweqnmgr = c.getequationmgr
ncount = sweqnmgr.getcount
for j = 0 to ncount - 1
a = sweqnmgr.equation(i)
set swdim = c.parameter(a)
cells(k, 3) = swdim.fullname
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 14:19 , Processed in 0.034755 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表