API: SelectByID woes

Oct 20, 2004 2 Replies

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


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

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.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required