hi!
i have created an assembly and i want to have in c the name of thedimension mark. i have these equations in the equation manager:
"D3@MatrizL 7140070" = 256
"D1@MatrizL 7140070" = 300
"D3@MatrizL6117008" = 180
"D1@MatrizL6117008" = 203
but in the 4st equation, when b="D1@MatrizL6117008" i have an error91 in linec = swDim.FullName because swDim=nothing. why i have anerror only in this dimension mark?
thank you very much!
my code:
Sub mates(model As SldWorks.ModelDoc2)
Dim swEqnMgr As SldWorks.EquationMgr
Dim swDim As SldWorks.Dimension
Set swEqnMgr = model.GetEquationMgr
Dim nCount As Integer, i As Integer, iPos as integer
Dim a As String, b As String, c As String
nCount = swEqnMgr.GetCount
For i = 0 To nCount - 1
a = swEqnMgr.Equation(i)
iPos = InStr(1, a, "=")
b = Left(a, iPos - 2)
Set swDim = model.Parameter(b)
' when b="D1@MatrizL6117008"-->swdim =nothing-->error 91
c = swDim.FullName'error 91
Next i
End Sub
SolidworksApi macros
i have created an assembly and i want to have in c the name of thedimension mark. i have these equations in the equation manager:
"D3@MatrizL 7140070" = 256
"D1@MatrizL 7140070" = 300
"D3@MatrizL6117008" = 180
"D1@MatrizL6117008" = 203
but in the 4st equation, when b="D1@MatrizL6117008" i have an error91 in linec = swDim.FullName because swDim=nothing. why i have anerror only in this dimension mark?
thank you very much!
my code:
Sub mates(model As SldWorks.ModelDoc2)
Dim swEqnMgr As SldWorks.EquationMgr
Dim swDim As SldWorks.Dimension
Set swEqnMgr = model.GetEquationMgr
Dim nCount As Integer, i As Integer, iPos as integer
Dim a As String, b As String, c As String
nCount = swEqnMgr.GetCount
For i = 0 To nCount - 1
a = swEqnMgr.Equation(i)
iPos = InStr(1, a, "=")
b = Left(a, iPos - 2)
Set swDim = model.Parameter(b)
' when b="D1@MatrizL6117008"-->swdim =nothing-->error 91
c = swDim.FullName'error 91
Next i
End Sub
SolidworksApi macros