Message 1 of 9

Not applicable
12-26-2012
09:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(Image attached). I am using Inventor 2013 and Visual Basic 2010 Express. I created a sketch within one of my views on my .idw. I would like to turn this sketch on or off based on the input from a variable that is read elsewhere. I have used the following code from the help file with no luck so far.
Public Sub SketchEdit() Dim oDrawDoc As DrawingDocument oDrawDoc = _invApp.ActiveDocument ' Determine if there are any sheet overlay sketches. Dim oSketches As DrawingSketches oSketches = oDrawDoc.ActiveSheet.Sketches If oSketches.Count = 0 Then Exit Sub End If ' Set a reference to the first sketch. Dim oSketch As DrawingSketch oSketch = oSketches.Item(4) oSketch.Edit() If vValue_Closer = "" Then oSketch.LineWeight = 0 Else oSketch.LineWeight = 0.007 End If ' Return from edit mode. oSketch.ExitEdit() End Sub
The code errors out on the line 'osketch = osketches.item(4)'. I have tried using a number like that, and I have also tried using the actual name of the sketch. Neither works.
oSketch = oSketches.Item("Closer_Reinf")
Any advice on what to edit here to get it to look at my Closer_Reinf sketch to hide it/unhide it ?
Solved! Go to Solution.