Inventor Customization

Reply
Valued Contributor
nickv02
Posts: 68
Registered: ‎03-23-2012
Message 1 of 2 (165 Views)

How Does Inventor Name Views or Sketch Views for VB?

165 Views, 1 Replies
01-08-2013 11:20 AM

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.

 

 

ADN Support Specialist
philippe.leefsma
Posts: 576
Registered: ‎06-02-2009
Message 2 of 2 (146 Views)

Re: How Does Inventor Name Views or Sketch Views for VB?

01-14-2013 01:08 AM in reply to: nickv02

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:

 

"Input Variant value that specifies the to return. This can be either a numeric value indicating the index of the item in the collection or it can be a string indicating the sketch name. If an out of range index or a name of a non-existent sketch is specified, an error occurs."
 
In case the collection doesn't support indexing by name, the safest way is to iterate through all elements using index 1 to Count and check the "Name" property of each element.
 
I hope it helps.
 
Regards,
Philippe.


Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube