Keyboard shortcut for toggling "dimension visibility" in sketches?

Keyboard shortcut for toggling "dimension visibility" in sketches?

jeanchile
Advisor Advisor
768 Views
3 Replies
Message 1 of 4

Keyboard shortcut for toggling "dimension visibility" in sketches?

jeanchile
Advisor
Advisor

Hello all,

 

Just as I said above: is there a keyboard shortcut for toggling just the dimension visibility in a sketch (not "alt+V" to toggle the entire sketch)?

 

We use a lot of complex sketches in our design-work, and they are usually near the top of our "top-down" methods. It appears the current 3D Connexion driver doesn't have a command for this either, but we can program any of the buttons with a keyboard shortcut though, so...

 

The image below is actually a "small" version of what I'm talking about. They're usually ten times worse.

Screenshot 2024-11-05 125641.png

Inventor Professional
0 Likes
769 Views
3 Replies
Replies (3)
Message 2 of 4

Gabriel_Watson
Mentor
Mentor
I don't think there is anything else besides the ALT > V > O > uncheck the box for sketches.

Maybe if you open up a DWG/IDW and modify the styles for dimension layers, but it's a long shot.
Message 3 of 4

jeanchile
Advisor
Advisor

Thank you. I'm familiar with that option but sadly, we need to control each sketch on an individual basis. We have the entire sketch (Alt+V) programmed into one button already. Would be nice to turn off all the dimensions on those busy ones easier.

 

I'm intrigued by your DWG layer thing, but I'll have to investigate that later when I have more time to play (we're planning a "drawing" style overhaul that rolls out January 1, so it'll work out later.).

 

Thank you for your help!

Inventor Professional
0 Likes
Message 4 of 4

kerem.izmirli
Contributor
Contributor

Hi @jeanchile,

 

This sort of post could be assisted with in the iLogic forums perhaps, but I saw your post and thought this is something I may be able to do. I have found a few bits and pieces from different codes over the years and just chopped it up a bit and created a rule for you to perform what you're after, with option to turn sketch dimensions off or on.

For it to work you have to have at least one sketch selected, and with the selection of sketches, run the rule and you get an input box to select whether you want to turn Dim visibility off or on.

 

This code may not be the most clean or efficient way to do this, but I don't really have much experience with it and have just taught myself by looking at and adapting others codes/rules. Hope this is helpful.

 

Sub Main()
	
'Make a ref to active doc
Dim oDoc As Inventor.Document
oDoc = ThisApplication.ActiveDocument

'selected components collection
Dim oSelected As ObjectCollection
oSelected = ThisApplication.TransientObjects.CreateObjectCollection

Dim oCount As Integer
oCount = oDoc.SelectSet.Count

'Check that at least 1 is selected
If oCount = 0 Then
	MessageBox.Show("Please select a sketch.", "iLogic")
	Exit Sub 'bail out
End If

'add to Object Collection
Dim i As Long
For i = 1 To oCount
	If oDoc.SelectSet.Item(i).Type = _
		ObjectTypeEnum.kComponentOccurrenceObject Then
		oSelected.Add (oDoc.SelectSet.Item(i))
	End If
Next

' Decide if you want to turn on or off the dimensions of your selected sketches:
    wfBoolean = InputRadioBox("Toggle Sketch Dimension Visibility", "On", "Off", False, "Sketch Dimension Visibility")
    For Each o2DSketch As Sketch In oDoc.ComponentDefinition.Sketches
		o2DSketch.DimensionsVisible = wfBoolean

		Next
		

'get names item name from collection
For Each oItem In oSelected
	oMsg = oMsg & vbLf & oItem.Name
Next

MessageBox.Show(oCount & " Sketch Dimensions Updated" & vbLf & oMsg, "iLogic")

End Sub

 

If you have any questions feel free to ask, I'll be happy to assist where I can 🙂

 

Cheers,

Kerem

0 Likes