![]() |
【转帖】open the equation manager of a componen
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 |
所有的时间均为北京时间。 现在的时间是 04:28 PM. |