hi!
i have created an assembly and i'm editing all the parts to havetheir equations, so first i have to open their equation managers.
i have tried with this code but it opens the equation manager ofthe 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 thecomponent, so i turn the component into a modeldoc but itdoesn´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!SolidworksApi macros
i have created an assembly and i'm editing all the parts to havetheir equations, so first i have to open their equation managers.
i have tried with this code but it opens the equation manager ofthe 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 thecomponent, so i turn the component into a modeldoc but itdoesn´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!SolidworksApi macros