Using Inv 2013 and VB 2010. I am trying to reference a sketch within a drawing view, but I am having a hard time figuring out which view number and sketch number to use. I thought I had it figured out, but apparently I was wrong.
For example, see the 2 attached pics, Drawing A and Drawing B. For Drawing A I had the sketch reference set as
Dim oSheet1_View As DrawingView = oDrawDoc.Sheets(1).DrawingViews(3) Dim oSketch As DrawingSketch oSketch = oSheet1_View.Sketches.Item(1)
Drawing View 3, as it was the 3rd Drawing View in the list, and Sketch #1 within that Drawing View. I thought this was how it worked, because it worked with my code and it hid the sketch. However, moving on to Drawing B, I used the same code, and it does not reference that sketch at all. It did nothing to it. Even though the Flange_Holes sketch is in the same position. 3rd View down the list, 1st sketch.
So how does Inventor reference these views and sketches? Is it in order of creation? Is there a way to reference it by the what the sketch is named instead of trying to decipher the number it's assigned? I have a lot of drawings already made, and I'm not positive the views were taken and created in the same exact order each time.
Any help is appreciated, thanks.
Hi There,
Some collections support selection by index and by name, simply look at the help files if the Item method takes a variant as input, for example the "DrawingSketches.Item" method has the following comments: