A Question regarding the AddWithOrientation method

A Question regarding the AddWithOrientation method

Anonymous
Not applicable
275 Views
4 Replies
Message 1 of 5

A Question regarding the AddWithOrientation method

Anonymous
Not applicable
Here's another question from the "old dog" programmer, non-draftsman,
non-mechanical enginer (just so you know where I'm coming from).

This question is asked in the context of VBA code, not interactivly. Is that
always assumed when somebody posts to this particular group?

Anyway...

I'm wanting to "drill" some holes in an object that I just created. I know
(at least I think I know) that in order to do that, I have to create a new
sketch on a face of the object. On this sketch, I need to place the hole
feature at my desired X and Y, then procede from there.

I've been looking at some snippets of code in the Inventor programmers help
screens. This has been very helpful. In the AddWithOrientation method
example, it looks like this:

(blah blah blah).Sketches.AddWithOrientation( oExtrude.EndFaces.Item(1),
_

oPartCompDef.WorkAxes.Item(1), _

True, True, _

oPartCompDef.WorkPoints.Item(1), _

False)

My question is this. What is the Item(1) for? I tried to search for it, but
no luck.

When I look in the help file under EndFaces it shows a sample of code that
refers to EndFaces() without any referece to Item(1). If I understand this
correctly, the StartFaces is my initial sketch plane, the EndFace is the
opposite face (across the object), and SideFace is all others.

Thanks in advance for your help with this.

Eric
...an old dog learning new tricks
0 Likes
276 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Maybe a better question, after thinking about this for a little would be
this...

I understand now that the Item property is the pointer into the collection.
Let's say for an example I'm using the SideFaces or plain old Faces (there's
a Rod Stewart joke here somewhere), then specify the Item property. How do I
know which face of the object is Item(1) and which one is Item(2), etc?

Thanks in advance

Eric
...an old dog learning new tricks.



"Eric Schultz" wrote in message
news:C9FAE1BB97F175D3F285C76B15EFFA8E@in.WebX.maYIadrTaRb...
> Here's another question from the "old dog" programmer, non-draftsman,
> non-mechanical enginer (just so you know where I'm coming from).
>
> This question is asked in the context of VBA code, not interactivly. Is
that
> always assumed when somebody posts to this particular group?
>
> Anyway...
>
> I'm wanting to "drill" some holes in an object that I just created. I know
> (at least I think I know) that in order to do that, I have to create a new
> sketch on a face of the object. On this sketch, I need to place the hole
> feature at my desired X and Y, then procede from there.
>
> I've been looking at some snippets of code in the Inventor programmers
help
> screens. This has been very helpful. In the AddWithOrientation method
> example, it looks like this:
>
> (blah blah blah).Sketches.AddWithOrientation(
oExtrude.EndFaces.Item(1),
> _
>
> oPartCompDef.WorkAxes.Item(1), _
>
> True, True, _
>
> oPartCompDef.WorkPoints.Item(1), _
>
> False)
>
> My question is this. What is the Item(1) for? I tried to search for it,
but
> no luck.
>
> When I look in the help file under EndFaces it shows a sample of code that
> refers to EndFaces() without any referece to Item(1). If I understand this
> correctly, the StartFaces is my initial sketch plane, the EndFace is the
> opposite face (across the object), and SideFace is all others.
>
> Thanks in advance for your help with this.
>
> Eric
> ...an old dog learning new tricks
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Eric,

The short answer to your question is that you don't know which face Item(1)
is. I like to draw the analogy of using Inventor to flying an airplane.
Using Inventor interactively is like flying an airplane on a nice clear day
with and the ability to look out the window and determine where you are at
any time. Using Inventor through the API is like taping cardboard over all
the windows and forcing you to fly exclusively through the instruments.

In the case of finding a particular face there are a few tools in the API to
help you do this. First, is that for some features we segment the faces
into categories to help isolate the face(s) of interest. For example, the
extrusion feature supports the SideFaces, StartFaces, and EndFaces
properties. In many cases these will provide direct access to the face you
need. Another function useful for finding a particular face is the
LocateUsingPoint method. If you know where the face is located you can use
this method to get the actual face. Another function is the FindUsingRay
method. Using this you can define a ray (or vector) through space and get
the faces that are intersected by this ray. One other technique that is
often combined with any of the previous methods is to query the geometry of
the faces to find the one that matches the criteria you need. For example,
you might create an extrusion, get the sidefaces, and then query each of
these faces looking for one with a particular normal.

It's not near as easy as just pointing the face you want on the screen, but
it is possible to find specific faces.

-Brian

"Eric Schultz" wrote in message
news:BECD858478AF4C6EBFB98C6E259A015A@in.WebX.maYIadrTaRb...
> Maybe a better question, after thinking about this for a little would be
> this...
>
> I understand now that the Item property is the pointer into the
collection.
> Let's say for an example I'm using the SideFaces or plain old Faces
(there's
> a Rod Stewart joke here somewhere), then specify the Item property. How do
I
> know which face of the object is Item(1) and which one is Item(2), etc?
>
> Thanks in advance
>
> Eric
> ...an old dog learning new tricks.
>
>
>
> "Eric Schultz" wrote in message
> news:C9FAE1BB97F175D3F285C76B15EFFA8E@in.WebX.maYIadrTaRb...
> > Here's another question from the "old dog" programmer, non-draftsman,
> > non-mechanical enginer (just so you know where I'm coming from).
> >
> > This question is asked in the context of VBA code, not interactivly. Is
> that
> > always assumed when somebody posts to this particular group?
> >
> > Anyway...
> >
> > I'm wanting to "drill" some holes in an object that I just created. I
know
> > (at least I think I know) that in order to do that, I have to create a
new
> > sketch on a face of the object. On this sketch, I need to place the hole
> > feature at my desired X and Y, then procede from there.
> >
> > I've been looking at some snippets of code in the Inventor programmers
> help
> > screens. This has been very helpful. In the AddWithOrientation method
> > example, it looks like this:
> >
> > (blah blah blah).Sketches.AddWithOrientation(
> oExtrude.EndFaces.Item(1),
> > _
> >
> > oPartCompDef.WorkAxes.Item(1), _
> >
> > True, True, _
> >
> > oPartCompDef.WorkPoints.Item(1), _
> >
> > False)
> >
> > My question is this. What is the Item(1) for? I tried to search for it,
> but
> > no luck.
> >
> > When I look in the help file under EndFaces it shows a sample of code
that
> > refers to EndFaces() without any referece to Item(1). If I understand
this
> > correctly, the StartFaces is my initial sketch plane, the EndFace is the
> > opposite face (across the object), and SideFace is all others.
> >
> > Thanks in advance for your help with this.
> >
> > Eric
> > ...an old dog learning new tricks
> >
> >
>
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Thanks Brian! I'll keep working on it and hopefully it'll soon "click" for
me.

As I'm developing this program, I can do this kind of testing to determine
which face is Item(1), etc. Can I say with certainty that Face.Item(3) will
always be the same face, no matter how many times I run this routine, or are
these assigned randomly?

Also, thank you for the analogy of piloting a plane. I am going to print
that out, frame it and hang it on the wall. That way, when I'm asked how
things are going and why it's taking so long, I can point to that.

Eric
...an old dog learning new tricks...



"Brian Ekins (Autodesk)" wrote in message
news:C763DFE4096AE9B9149BDD3E40818923@in.WebX.maYIadrTaRb...
> Eric,
>
> The short answer to your question is that you don't know which face
Item(1)
> is. I like to draw the analogy of using Inventor to flying an airplane.
> Using Inventor interactively is like flying an airplane on a nice clear
day
> with and the ability to look out the window and determine where you are at
> any time. Using Inventor through the API is like taping cardboard over
all
> the windows and forcing you to fly exclusively through the instruments.
>
> In the case of finding a particular face there are a few tools in the API
to
> help you do this. First, is that for some features we segment the faces
> into categories to help isolate the face(s) of interest. For example, the
> extrusion feature supports the SideFaces, StartFaces, and EndFaces
> properties. In many cases these will provide direct access to the face
you
> need. Another function useful for finding a particular face is the
> LocateUsingPoint method. If you know where the face is located you can
use
> this method to get the actual face. Another function is the FindUsingRay
> method. Using this you can define a ray (or vector) through space and get
> the faces that are intersected by this ray. One other technique that is
> often combined with any of the previous methods is to query the geometry
of
> the faces to find the one that matches the criteria you need. For
example,
> you might create an extrusion, get the sidefaces, and then query each of
> these faces looking for one with a particular normal.
>
> It's not near as easy as just pointing the face you want on the screen,
but
> it is possible to find specific faces.
>
> -Brian
>
> "Eric Schultz" wrote in message
> news:BECD858478AF4C6EBFB98C6E259A015A@in.WebX.maYIadrTaRb...
> > Maybe a better question, after thinking about this for a little would be
> > this...
> >
> > I understand now that the Item property is the pointer into the
> collection.
> > Let's say for an example I'm using the SideFaces or plain old Faces
> (there's
> > a Rod Stewart joke here somewhere), then specify the Item property. How
do
> I
> > know which face of the object is Item(1) and which one is Item(2), etc?
> >
> > Thanks in advance
> >
> > Eric
> > ...an old dog learning new tricks.
> >
> >
> >
> > "Eric Schultz" wrote in message
> > news:C9FAE1BB97F175D3F285C76B15EFFA8E@in.WebX.maYIadrTaRb...
> > > Here's another question from the "old dog" programmer, non-draftsman,
> > > non-mechanical enginer (just so you know where I'm coming from).
> > >
> > > This question is asked in the context of VBA code, not interactivly.
Is
> > that
> > > always assumed when somebody posts to this particular group?
> > >
> > > Anyway...
> > >
> > > I'm wanting to "drill" some holes in an object that I just created. I
> know
> > > (at least I think I know) that in order to do that, I have to create a
> new
> > > sketch on a face of the object. On this sketch, I need to place the
hole
> > > feature at my desired X and Y, then procede from there.
> > >
> > > I've been looking at some snippets of code in the Inventor programmers
> > help
> > > screens. This has been very helpful. In the AddWithOrientation method
> > > example, it looks like this:
> > >
> > > (blah blah blah).Sketches.AddWithOrientation(
> > oExtrude.EndFaces.Item(1),
> > > _
> > >
> > > oPartCompDef.WorkAxes.Item(1), _
> > >
> > > True, True, _
> > >
> > > oPartCompDef.WorkPoints.Item(1), _
> > >
> > > False)
> > >
> > > My question is this. What is the Item(1) for? I tried to search for
it,
> > but
> > > no luck.
> > >
> > > When I look in the help file under EndFaces it shows a sample of code
> that
> > > refers to EndFaces() without any referece to Item(1). If I understand
> this
> > > correctly, the StartFaces is my initial sketch plane, the EndFace is
the
> > > opposite face (across the object), and SideFace is all others.
> > >
> > > Thanks in advance for your help with this.
> > >
> > > Eric
> > > ...an old dog learning new tricks
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Regarding Item(3) always being the same face, you shouldn't count on it. It
may be consistant in most cases or for this version, but it could possibly
change. So, you should explictly identify it somehow rather than rely on
its position within the collection.

-Brian

"Eric Schultz" wrote in message
news:8101F8CD7331DAA2B5935D3D794E3E81@in.WebX.maYIadrTaRb...
> Thanks Brian! I'll keep working on it and hopefully it'll soon "click" for
> me.
>
> As I'm developing this program, I can do this kind of testing to determine
> which face is Item(1), etc. Can I say with certainty that Face.Item(3)
will
> always be the same face, no matter how many times I run this routine, or
are
> these assigned randomly?
>
> Also, thank you for the analogy of piloting a plane. I am going to print
> that out, frame it and hang it on the wall. That way, when I'm asked how
> things are going and why it's taking so long, I can point to that.
>
> Eric
> ...an old dog learning new tricks...
>
0 Likes