Hello everyone,
I´m trying to find a macro to be able to turn off all sketches. It should work if I have a part open, a simple assembly or a big assembly with sub-assemblies.
I know there is an option to hide them, but I would like to do it in one click.
Thank you all,
Diego
Solved! Go to Solution.
Solved by VdVeek. Go to Solution.
This is a VBA-macro to hide Sketches and workplanes in parts and assemblies. I use it on a daily basis.
Rob.
Thanks, macro is working perfectly.
But I realize that for my problem, press F10 is enough 😄
Thank you anyway,
D.
Hi
Thanks for the macro.
The macro is working fine to make all sketches visible.
once again when we run the macro to make all sketches invisible, the macro makes invisible only sketches that were made visible by the macro.
The initial sketches(manually turned visible in the browser) that were visible before the macro was run remains unchanged.
Please advice.
M.L.Kuselan
You might need to alter your Design View Represenations for those components that aren't responding. If these components are in an assembly, and you don't want to modify the individual Design View Representations, you will need to make sure their Representations aren't set as "Associative" within the assembly or sub-assembly.
Also, I've had an external iLogic rule that does the same thing, and I noticed that within the oPartDoc portion of your code you are redefining oDoc As Inventor.Document, as you did in the Assembly portion of your code, but it isn't needed for the Part portion of the code. So you could probably delete that line.
Wesley Crihfield
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