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:)
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.