Hi
I copied the code from another post of same requirement and made some alteration.
But iam getting error (For Each oSketch In oSketches) Type Mismatch error
Please someone check and rectify.
Regards
M.L.Kuselan
Public Sub Skt_Invi_prox()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As AssemblyComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
Dim oLeafOccs As ComponentOccurrencesEnumerator
Set oLeafOccs = oCompDef.Occurrences.AllLeafOccurrences
Dim RefPartDef As PartComponentDefinition
Dim RefAssyDef As AssemblyComponentDefinition
Dim oOcc As ComponentOccurrence
Dim RefPlanes As WorkPlanes
Dim RefPlane As WorkPlane
Dim oSkeches As PlanarSketches
Dim oSkectch As PlanarSketch
Dim ProxyPlane As WorkPlaneProxy
Dim oSketchProxy As PlanarSketchProxy
For Each oOcc In oLeafOccs
MsgBox (oOcc.Name)
If oOcc.Suppressed = False Then
If oOcc.DefinitionDocumentType = kPartDocumentObject Then
Set RefPartDef = oOcc.Definition
Set RefPlanes = RefPartDef.WorkPlanes
Set oSkecthes = RefPartDef.Sketches
For Each RefPlane In RefPlanes
Call oOcc.CreateGeometryProxy(RefPlane, ProxyPlane)
ProxyPlane.Visible = False
Next
For Each oSketch In oSketches
MsgBox (oSketch.Name)
Call oOcc.CreateGeometryProxy(oSketch, oSketchProxy)
oSketchProxy.Visible = False
Next
ElseIf oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
RefAssyDef = oOcc.Definition
End If
End If
Next
ThisApplication.ActiveDocument.Update
End Sub