Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to make part selected in model browser?

2 REPLIES 2
Reply
Message 1 of 3
mucip
336 Views, 2 Replies

How to make part selected in model browser?

Hi,

I'm using VB 2010 express. My code is getting selected part and changing some "Design Tracking Properties" of it. But when I change the properties focus goes from the selected part/sub?... How can I make part selected again? How can I make it focused...

 

I need like below like code:

 

invDocument.SetFocus or invDocuments.MakeItSelected like...

 

 

My Code is below:

 

Dim asmDoc As AssemblyDocument
        asmDoc = inv_App.ActiveDocument
        '********
        Dim invDocument As Document = Nothing
        Dim compOcc As ComponentOccurrence = Nothing


        If asmDoc.SelectSet.Count <> 1 Then
            MsgBox("You should select only one part or sub!")
            Return
        End If

        If TypeOf inv_App.ActiveDocument.SelectSet.Item(1) Is ComponentOccurrence Then

            compOcc = inv_App.ActiveDocument.SelectSet.Item(1)
            invDocument = compOcc.Definition.Document          
        Else
            MsgBox("Selected is not part or sub!")
            Return
        End If

 

Then I change the properties....

 

 

 

Regards,

Mucip:)

 

 

2 REPLIES 2
Message 2 of 3
ADNpati
in reply to: mucip

 

Hi mucip,

 

add a condition like thins in your code to select a part or assembly in Inventor.

 

oPorpertyValue = oPropSets.Item("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}").ItemByPropId(kCategoryDocSummaryInformation).Value

 

If oPorpertyValue = oOccPopertyList.Value Then
oAsmDoc.SelectSet.Select oAsmDoc.ComponentDefinition.occurrences(w).SubOccurrences(x).SubOccurrences(y)
End If

 

That part may be in occurrences or sub occurrences level. Make sure you do kow it change my code to suite your requirment.

 

Cheers.

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
Message 3 of 3
mucip
in reply to: ADNpati

Hi,

I didi not understand your example? Please could you explain little bit more?...

 

Regards,

Mucip:)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report