Есть текст:
Option Explicit
Public Type TSketchSgInFo
sSg_Id As String
dSg_Ln As Double
End Type 'TSketchSgInFo
Const sSketchName As String = "skMarker"
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.feature
Dim swSketch As SldWorks.sketch
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSketchSeg As SldWorks.SketchSegment
Dim pSketchSegRelMgr As SldWorks.SketchRelationManager
Dim vSketchSegRel As Variant 'Array of sketch segment relation
Dim vSketchSeg As Variant 'Array of sketch segment
Dim boolstatus As Boolean
Dim lSegCnt As Long
Dim lRelCnt As Long
Public clSkSegInFo As New Collection
Public mySgInFo As TSketchSgInFo
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swModel.ClearSelection2 True
boolstatus = swModel.Extension.SelectByID(sSketchName, "SKETCH", 0, 0, 0, True, 0, Nothing)
If boolstatus Then
Set swSelMgr = swModel.SelectionManager
Set swFeat = swSelMgr.GetSelectedObject5(1)
Set swSketch = swFeat.GetSpecificFeature2
swModel.ClearSelection2 True
vSketchSeg = swSketch.GetSketchSegments
For lSegCnt = 0 To UBound(vSketchSeg)
Set swSketchSeg = vSketchSeg(lSegCnt)
'Ignore construction lines
If swSketchSeg.ConstructionGeometry = False Then
'Select only sketch lines
If swSketchLINE = swSketchSeg.GetType Then
swSketchSeg.Select4 True, Nothing
Set pSketchSegRelMgr = swSketchSeg.GetSketch.RelationManager
vSketchSegRel = pSketchSegRelMgr.GetRelations(swSelectedEntities)
For lRelCnt = 0 To UBound(vSketchSegRel)
Select Case vSketchSegRel(lRelCnt).GetRelationType
Case swConstraintType_VERTICAL
mySgInFo.sSg_Id = "Line" + Str$(swSketchSeg.GetId(1)) + "@" + sSketchName
mySgInFo.dSg_Ln = swSketchSeg.GetLength
clSkSegInFo.Add mySgInFo
Case swConstraintType_HORIZONTAL: Exit For
End Select 'swConstraintType_VERTICAL
Next lRelCnt
swModel.ClearSelection2 True
End If 'swSketchLINE
End If 'Not ConstructionGeometry
Next lSegCnt
Else
MsgBox ("NOT selected")
Exit Sub
End If
End Sub
при F5 говорит: Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types
ругается на место: clSkSegInFo.Add mySgInFo
Что я не так делаю - подскажите please ......