Hi,
I'm using VB Express 2010...
I can get information if the part or sub part of the assembly selected below code:
Dim asmDoc As Document 'AssemblyDocument
asmDoc = inv_App.ActiveDocument
Dim invDocument As Document = Nothing
Dim compOcc As ComponentOccurrence = Nothing
If TypeOf inv_App.ActiveDocument.SelectSet.Item(1) Is ComponentOccurrence Then
compOcc = inv_App.ActiveDocument.SelectSet.Item(1)
invDocument = compOcc.Definition.Document
invDocumentTakas = invDocument
TextBoxWeight.Text = compOcc.MassProperties.Mass
end if
But I need to get information main bruch of the file also. For instance: I opened an assebmly and I can select the main branch in model browser. Or I open single file and I want to select top branch (opened part) in model browser.
But in this case CompanentOccurence is not working unfortunatelly... How can I know/check if the main (top) branch of the single opened part or assembly?...
regards,
Mucip:)
Hi,
I found the solution and wanted to share with you...
Dim invDocument As Document = Nothing
Dim compOcc As ComponentOccurrence = Nothing
Dim PartOcc As PartComponentDefinition = Nothing
Dim AsmOcc As AssemblyComponentDefinition = Nothing
If TypeOf inv_App.ActiveDocument.SelectSet.Item(1) Is ComponentOccurrence Then
compOcc = inv_App.ActiveDocument.SelectSet.Item(1)
invDocument = compOcc.Definition.Document
invDocumentTakas = invDocument
FormOzellikGuncelle.TextBoxAgirlik.Text = compOcc.MassProperties.Mass
ElseIf TypeOf inv_App.ActiveDocument.SelectSet.Item(1) Is PartComponentDefinition Then
PartOcc = inv_App.ActiveDocument.SelectSet.Item(1)
invDocument = PartOcc.Document
invDocumentTakas = invDocument
FormOzellikGuncelle.TextBoxAgirlik.Text = PartOcc.MassProperties.Mass
ElseIf TypeOf inv_App.ActiveDocument.SelectSet.Item(1) Is AssemblyComponentDefinition Then
AsmOcc = inv_App.ActiveDocument.SelectSet.Item(1)
invDocument = AsmOcc.Document
invDocumentTakas = invDocument
FormOzellikGuncelle.TextBoxAgirlik.Text = AsmOcc.MassProperties.Mass
Else
MsgBox("Selected is not part or asm!")
Return
End If
Can't find what you're looking for? Ask the community or share your knowledge.