Get full document name of sub assy by picking model leader note

Get full document name of sub assy by picking model leader note

tim11_manhhieu
Advocate Advocate
269 Views
3 Replies
Message 1 of 4

Get full document name of sub assy by picking model leader note

tim11_manhhieu
Advocate
Advocate

Can i get full path of sub assy NDA006848.iam when i pick ① leader note?

 

Option Explicit

Sub yyyyyyy()

Dim oLeader As ModelLeaderNote
Set oLeader = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kModelAnnotationFilter, "Select: ")

End Sub

 

tim11_manhhieu_0-1744096483054.png

 

 

0 Likes
Accepted solutions (1)
270 Views
3 Replies
Replies (3)
Message 2 of 4

Stakin
Collaborator
Collaborator
Message 3 of 4

Stakin
Collaborator
Collaborator
Accepted solution
Sub Main()
	Dim oSS As SelectSet= ThisApplication.ActiveDocument.SelectSet
	oSS.Select(ThisApplication.CommandManager.Pick(SelectionFilterEnum.kModelAnnotationFilter, "Select a ModelAnnotation"))	 
	Dim  oNote As ModelLeaderNote = oSS.Item(1)	 
	 Dim oOccEnumerator As ComponentOccurrencesEnumerator 
	 oOccEnumerator = oNote.Definition.Intent.Geometry.ContainingOccurrence.OccurrencePath
	 Dim oFullFileName As String
	 oFullFileName=oOccEnumerator(1).Definition.Document.FullFileName
	 MessageBox.Show("1st Level Occ(Part/Sub Asm) Name:" & oOccEnumerator(1).Name & vbLf & 
	 			"1st Level Occ(Part/Sub Asm)  FileName:" & oFullFileName & vbLf & 
	 			"Leaf Occurrence(Part) Name:" & oOccEnumerator(oOccEnumerator.Count).Name & vbLf & 
	 			"Leaf Occurrence(Part) FileName:" & oOccEnumerator(oOccEnumerator.Count).Definition.Document.FullFileName, "oNote associate")
End Sub
0 Likes
Message 4 of 4

tim11_manhhieu
Advocate
Advocate

Appreciate it.

VBA for who need.

Option Explicit

Sub xxx()

Dim oNote As ModelLeaderNote
Set oNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kModelAnnotationFilter, "Select: ")

Dim oOccEnumerator As ComponentOccurrencesEnumerator
Set oOccEnumerator = oNote.Definition.Intent.Geometry.ContainingOccurrence.OccurrencePath

Dim oFullFileName As String
oFullFileName = oOccEnumerator(1).Definition.Document.fullFilename

Debug.Print oFullFileName

End Sub

 

 

0 Likes