API: SelectByID woes

I am creating an app to make a custom BOM that I will use on our parts manual. Mostly because there are times when you want some sub-assemblies but not all. I am trying to reselect the component that the balloon is attached to so that if I close the program it can repopulate the work that has already been done. To do this I named the balloon note so that it can be parsed it contains a word so that I know it was created by the macro the count which should be the same as the balloon's item number The origional component name and the number of parents up from the origional component that is desired in the bom.

all is going well but I can't figure out how to reselect the origional component. I tried the following

Loc = BalloonNote.GetAttachPos Retval = DocExt.SelectByID("", "COMPONENT", Loc(0), Loc(1), Loc(2), False,

1, Nothing)

In theory this should select the component under the selection point which is the arrow point of the balloon this actually selected something

Also Loc = BalloonNote.GetAttachPos Retval = DocExt.SelectByID("140245-1", "COMPONENT", Loc(0), Loc(1), Loc(2), False, 1, Nothing)

again in theory it should select the component using it's name but it is a sub component this selected nothing, so I also tried,

Loc = BalloonNote.GetAttachPos Retval = DocExt.SelectByID("SomeSubAsm\140245-1", "COMPONENT", Loc(0), Loc(1), Loc(2), False, 1, Nothing)

which is the same thing just it is using the full component name. this also selected nothing

after each of these I used Dim C as component2

set C = selman.getselectedobject5(1) and set C = selman.getselectedobjectsComponent(1)

this threw an error saying the type didn't match. clear as mud?

Any Ideas?

Corey

Reply to
Corey Scheich
Loading thread data ...

Further If I filter "COMPONENT" it selects the apropriate component but when I pass it to an explicitly defined variable of type Component2 it throws a type mis-match error there must be something wrong.

Corey

Reply to
Corey Scheich

Corey-

I've never used but the older version (Set objComponent = objSelection.GetComponent) works in a drawing document with a face selected. Haven't tried it with an edge. Here's the current version of the command:

component = SelectionMgr.GetSelectedObjectsComponent2 ( atIndex )

Hope this helps,

-Jason S.

Reply to
Jason Swackhamer

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.