part and assembly reference in drawing

part and assembly reference in drawing

Anonymous
Not applicable
1,639 Views
31 Replies
Message 1 of 32

part and assembly reference in drawing

Anonymous
Not applicable

ihi!

 

I wonder if it's possible to see with ilogic if a part exciste in all others view (in assembly) of the same sheet?

 

Thanks for your help!

 

0 Likes
1,640 Views
31 Replies
Replies (31)
Message 2 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

I am not sure I understand exactly what you need but here is a rule that I came up with using the Inventor API. In my tests I have several views and am cropping them so that it only shows some of the drawingcurves. When I run the rule it tells me correctly if an occurrence is showing in that view or not.

 

Notice that it uses the DrawingCurves property of the DrawingView and passes in an occurrence. The returned DrawingCurvesEnumerator will be different for each occurrence. (if it is not showing in the view the count is zero) This could be enhanced to handle sub assemblies. Currently it is just testing the top level occurrences.

 

 

 Dim oDoc As DrawingDocument    

 oDoc = ThisDoc.Document

 Dim oDrawView As DrawingView  

 For Each oDrawView In oDoc.ActiveSheet.DrawingViews

       Dim refDocDesc = oDrawView.ReferencedDocumentDescriptor    

       Dim oAssembly = refDocDesc.ReferencedDocument

      Dim oOcc As ComponentOccurrence    

      For Each oOcc In oAssembly.ComponentDefinition.Occurrences

           Dim oDrawCrvsEnum As DrawingCurvesEnumerator    

           oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)

           If oDrawCrvsEnum.Count > 1 Then        

               myString = myString & oOcc.Name & " is showing in " & oDrawView.Name & vbCr

           Else

              myString = myString & oOcc.Name & " is NOT showing in " & oDrawView.Name & vbCr  

          End If

       Next 'occurrence

       Next 'DrawingViews      

MessageBox.Show(myString, "Title")

 

 

 

I believe something like this can meet your requirement.

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 32

Anonymous
Not applicable

Thanks Wayne for your reply 🙂

 

i test that today!

0 Likes
Message 4 of 32

Anonymous
Not applicable

work great Wayne 🙂

 

I have change your rule for my application, if in this list my selection part in view (NOM) exciste, i enter more code

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
entity = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kDrawingViewFilter,
"SÉLECTIONNE UNE VUE")
modelName = IO.Path.GetFileName(ActiveSheet.View(entity.Name).ModelDocument.FullFileName)
NOM = Left(modelName, Len (modelName) -4) & ":1"

Dim oDrawView As DrawingView
For Each oDrawView In oDoc.ActiveSheet.DrawingViews
Dim refDocDesc = oDrawView.ReferencedDocumentDescriptor
Dim oAssembly = refDocDesc.ReferencedDocument
Dim oOcc As ComponentOccurrence
For Each oOcc In oAssembly.ComponentDefinition.Occurrences
Dim oDrawCrvsEnum As DrawingCurvesEnumerator
oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)
If oDrawCrvsEnum.Count > 1 Then
myString = myString & oOcc.Name & vbCr
Else If oOcc.Name = NOM Then 'if name in list = NOM
Goto MESSAGE
Else
myString = myString & oOcc.Name & " is NOT showing in " & oDrawView.Name & vbCr
End If
Next 'occurrence
Next 'DrawingViews

MESSAGE:
MessageBox.Show(myString, "Title")
'MORE CODE HERE......

 

Sorry for my horrible english 😞

 

0 Likes
Message 5 of 32

Anonymous
Not applicable

MY SELECTED VIEW.JPG

my selected part in view

0 Likes
Message 6 of 32

Anonymous
Not applicable

it's not a solution it's a question for you 😉

 

i want to know if it's possible, if my selected part (NOM) exciste in this list show a message or enter more code?

 

And if i have a PresentationDocument in this page the rule dont work?

0 Likes
Message 7 of 32

Anonymous
Not applicable

dont work too if i have a sub assembly in assembly

0 Likes
Message 8 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Can you attach a set of files that will allow me to recreate this problem and researh for a solution?

 

Thanks,



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 9 of 32

Anonymous
Not applicable

Thanks again Wayne for all your reply and help!

0 Likes
Message 10 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Here is a rule that has a recursive function (it can call itself). This rule gets the parts and sub assemblies of the selected drawing view in my tests. I am still not sure if this is what you need but I hope this can show how  you can get to the subassemblies. You can edit this and pass in the occurence or part to a call to DrawingView.DrawingCurves() to determine if that sub assembly or part is displayed in a drawing view. 

 

Also I do not see an .ipn file in the attachments. Please explain what I need to do to recreate the error you mention.

 

 

'wB added Sub Main

Sub Main()

 

Dim oDoc As DrawingDocument   

oDoc = ThisDoc.Document

entity = ThisApplication.CommandManager.Pick(

               SelectionFilterEnum.kDrawingViewFilter,

               "SLECT VIEW")

modelName = IO.Path.GetFileName(ActiveSheet.View(entity.Name).ModelDocument.FullFileName)

NAME = Left(modelName, Len (modelName) -4) & ":1"

'MessageBox.Show(NAME, "Title")

'wB commented

'Dim oDrawView As DrawingView

'wB added

Dim oDrawView As DrawingView = entity

 

'wB commented

'For Each oDrawView In oDoc.ActiveSheet.DrawingViews

Dim refDocDesc = oDrawView.ReferencedDocumentDescriptor   

Dim oAssembly = refDocDesc.ReferencedDocument

Dim oOcc As ComponentOccurrence

 

'wB added

myString = "Top level assembly = " & modelName & vbCr

 

For Each oOcc In oAssembly.ComponentDefinition.Occurrences

'MessageBox.Show("In For each oOcc loop")

Dim oDrawCrvsEnum As DrawingCurvesEnumerator   

oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)

If oDrawCrvsEnum.Count > 1 Then        

'wB commented

'myString = myString & oOcc.Name & vbCr

'wB added

'if it is an assembly call GetOccName and put the occurrence name in myString

If (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

               'myString = myString + "In Main " &  GetOccName(oOcc.SubOccurrences, myString)

               'myString = "In Main " &  GetOccName(oOcc.SubOccurrences, myString)

 

               myString = myString & "SubAssembly " & vbCr

               myString = myString & oOcc.Definition.Document.DisplayName & vbCr

               'MessageBox.Show("In If assembly document myString = " & myString)

               myString = GetOccName(oOcc.SubOccurrences, myString)

End If

'wB added

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then

               'myString = myString & "Part " & vbCr

               myString = myString & oOcc.Definition.Document.DisplayName & vbCr

End If

'wB commented

'Else If oOcc.Name = NAME Then 'if name is in this list = NAM

'wB commented

'Goto MESSAGE

End If

Next 'occurrence

'wB commented

'Next 'DrawingViews

 

MESSAGE:

MessageBox.Show(myString, "Title")

'enter more code here

 

'my problem is dont show part in sub assembly and if i have a ipn in the page i have a error message?

End Sub

 

'wB added

Private Function GetOccName(oOccs As ComponentOccurrences, str1 as String) As String

    Dim oOcc As ComponentOccurrence

    For Each oOcc In oOccs

     '   MessageBox.Show("In For each loop" & oOcc.Name)

                              If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then ' part

 

                                             str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

        ElseIf (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

            str1 = str1 & "SubAssembly " & vbCr

                                             str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

                                  str1 = GetOccName(oOcc.SubOccurrences, str1)

        End If

                             

    Next

               'MessageBox.Show(Str1 & vbCr & " Returning from GetOccName")

               Return str1

End Function

 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 11 of 32

Anonymous
Not applicable

Thanks again for your time Wayne, it's kind 🙂

 

your rule work great in selected view, that i want but for all drawing view in sheet, but the same problem if i have a drawing view with ipn inside again

a error message.

0 Likes
Message 12 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Did the files you attached previously have a drawing view with an ipn inside? If not please provide the files that will allow me to recreate the error you are getting.

 

Also you can change the rule so it goes through all of the drawing views on the sheet. The rule I initally posted on this thread did that. I simplified the last rule I posted so it just went through the occurrences in the selected drawing view.

 

Thanks,



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 13 of 32

Anonymous
Not applicable

this is the file!

0 Likes
Message 14 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Thanks for the .ipn file. I created a view using that file. When I run the rule I get this error:

Error in rule: Rule1, in document: TEST123.idw

Public member 'ComponentDefinition' on type 'PresentationDocument' not found.

 

This is becuase this line is using the ComponentDefinition property.

For Each oOcc In oAssembly.ComponentDefinition.Occurrences

 

The problem is that the variable named oAssembly is not an AssemblyDocument but is a PresentationDocument 

Dim refDocDesc = oDrawView.ReferencedDocumentDescriptor   

Dim oAssembly = refDocDesc.ReferencedDocument

 

 

A PresentationDocument does not have a ComponentDefinition property. You could add an if statement and have different code run based on the type of document. Here is a rule I have. When you need to figure out how to get Inventor API code to work it really helps to use VBA to test it and get it working. You can then move it over to a rule and make the changes neccessary to get it working as a rule. (very much like VB.NET) Please keep in mind that this is just a quick example and I did not test for every possibility. (I just tested with drawing veiws that use an assembly and a presentation document.

 

 

This rule now has an if statement. If it is a presentation document then it assigns to the oAssembly variable using this code:

  oAssembly = oReferencedDoc.ReferencedDocuments(1) 

 

 

 

'wB added Sub Main

Sub Main()

 

Dim oDoc As DrawingDocument   

oDoc = ThisDoc.Document

entity = ThisApplication.CommandManager.Pick(

               SelectionFilterEnum.kDrawingViewFilter,

               "SLECT VIEW")

modelName = IO.Path.GetFileName(ActiveSheet.View(entity.Name).ModelDocument.FullFileName)

NAME = Left(modelName, Len (modelName) -4) & ":1"

'MessageBox.Show(NAME, "Title")

'wB commented

'Dim oDrawView As DrawingView

'wB added

Dim oDrawView As DrawingView = entity

 

'wB commented

'For Each oDrawView In oDoc.ActiveSheet.DrawingViews

Dim refDocDesc = oDrawView.ReferencedDocumentDescriptor   

Dim oReferencedDoc = refDocDesc.ReferencedDocument

Dim oAssembly

Dim oOcc As ComponentOccurrence

 

If oReferencedDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then

    MessageBox.Show("this is an Assembly", "Title")

               oAssembly = oReferencedDoc

ElseIf oReferencedDoc.DocumentType = kPresentationDocumentObject Then

     MessageBox.Show("this is a presentation document", "Title")

               oAssembly = oReferencedDoc.ReferencedDocuments(1)  

               ' Return

End If

 

 

 

'wB added

myString = "Top level doc  = " & modelName & vbCr

 

For Each oOcc In oAssembly.ComponentDefinition.Occurrences

'MessageBox.Show("In For each oOcc loop")

Dim oDrawCrvsEnum As DrawingCurvesEnumerator   

oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)

If oDrawCrvsEnum.Count > 1 Then       

'wB commented

'myString = myString & oOcc.Name & vbCr

'wB added

'if it is an assembly call GetOccName and put the occurrence name in myString

If (oOcc.DefinitionDocumentType = kAssemblyDocumentObject)
Then

            

               myString = myString & "SubAssembly " & vbCr

               myString = myString & oOcc.Definition.Document.DisplayName & vbCr

               myString = GetOccName(oOcc.SubOccurrences, myString)

End If

 

'wB added

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then

               'myString = myString & "Part " & vbCr

               myString = myString & oOcc.Definition.Document.DisplayName & vbCr

End If

'wB commented

'Else If oOcc.Name = NAME Then 'if name is in this list = NAM

'wB commented

'Goto MESSAGE

End If

Next 'occurrence

'wB commented

'Next 'DrawingViews

 

MESSAGE:

MessageBox.Show(myString, "Title")

'enter more code here

 

'my problem is dont show part in sub assembly and if i have a ipn in the page i have a error message?

End Sub

 

'wB added

Private Function GetOccName(oOccs As ComponentOccurrences, str1 as String) As String

    Dim oOcc As ComponentOccurrence

    For Each oOcc In oOccs

     '   MessageBox.Show("In For each loop" & oOcc.Name)

                              If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then ' part

 

                                             str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

        ElseIf (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

            str1 = str1 & "SubAssembly " & vbCr

                                             str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

                                  str1 = GetOccName(oOcc.SubOccurrences, str1)

                                            

                                             Dim oDoc2 As DrawingDocument   

                                             oDoc2 = ThisDoc.Document

                                             Dim oDrawCrvsEnum2 As DrawingCurvesEnumerator

                                             Dim oDrawView2 = oDoc2.ActiveSheet.DrawingViews(3)

                                             oDrawCrvsEnum2 = oDrawView2.DrawingCurves(oOcc)

                                             MessageBox.Show(oDrawCrvsEnum2.count)

                                            

                                            

        End If

                             

    Next

               'MessageBox.Show(Str1 & vbCr & " Returning from GetOccName")

               Return str1

End Function

 

 

 

Wayne,

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 15 of 32

Anonymous
Not applicable

Hi Wayne 🙂

 

Dont work with single part now 🙂

 

it's possible to see all part in sheet, same to your first rule?

 

Thanks again, it's really appriciate!

0 Likes
Message 16 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Here is an update to the rule. It has the for each loop to go through all of the drawing views. A MessageBox is displayed for every view showing the name of the top level document. (part, assembly or presentation) It then gathers the names of sub assemblies and parts. I believe this is close to what you need. Please try to make it do what you need if there is something missing.

 

'wB added Sub Main

Sub Main()

Dim oDoc As DrawingDocument

oDoc = ThisDoc.Document

 

Dim refDocDesc

Dim oReferencedDoc

Dim oAssembly

Dim oPart

Dim oOcc As ComponentOccurrence

Dim ModelName

Dim NAME

 

For Each oDrawView In oDoc.ActiveSheet.DrawingViews

'MessageBox.Show("right after for each", "Title")

refDocDesc = oDrawView.ReferencedDocumentDescriptor

oReferencedDoc = refDocDesc.ReferencedDocument

 

If oReferencedDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then

MessageBox.Show("this is an Assembly", "Title")

oAssembly = oReferencedDoc

'modelName = IO.Path.GetFileName(oAssembly.FullFileName)

'MessageBox.Show("FullFileName = " & oAssembly.FullFileName, "Title")

'NAME = Left(modelName, Len (ModelName) -4) & ":1"

NAME = oAssembly.DisplayName ' & ":1"

myString = myString & "Top level Assembly = " & NAME & vbCr

 

ElseIf oReferencedDoc.DocumentType = kPresentationDocumentObject Then

MessageBox.Show("this is a presentation document", "Title")

oAssembly = oReferencedDoc.ReferencedDocuments(1)

modelName = IO.Path.GetFileName(oAssembly.FullFileName)

NAME = Left(modelName, Len (modelName) -4) & ":1"

myString = myString & "Top level Presentation doc = " & NAME & vbCr

' Return

 

ElseIf oReferencedDoc.DocumentType = kPartDocumentObject

oPart = oReferencedDoc

MessageBox.Show("This is a Part document " & oPart.FullFileName, "Title")

'Do something here with the part

 

' Go to the next DrawingView in the for next loop

Continue For

 

End If

 

'wB added

For Each oOcc In oAssembly.ComponentDefinition.Occurrences

 

Dim oDrawCrvsEnum As DrawingCurvesEnumerator

oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)

 

If oDrawCrvsEnum.Count > 1 Then

'wB added

'if it is an assembly call GetOccName and put the occurrence name in myString

If (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

'MessageBox.Show("In For each oOcc loop")

myString = myString & "SubAssembly " & vbCr

myString = myString & oOcc.Definition.Document.DisplayName & vbCr

myString = GetOccName(oOcc.SubOccurrences, myString)

End If

 

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then

myString = myString & oOcc.Definition.Document.DisplayName & vbCr

End If

 

End If

Next 'occurrence

Next 'DrawingViews

 

MESSAGE:

MessageBox.Show(myString, "Title")

 

End Sub

 

 

Private Function GetOccName(oOccs As ComponentOccurrences, str1 as String) As String

Dim oOcc As ComponentOccurrence

For Each oOcc In oOccs

'MessageBox.Show("In For each loop" & oOcc.Name)

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then ' part

str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

ElseIf (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

str1 = str1 & "SubAssembly " & vbCr

str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

str1 = GetOccName(oOcc.SubOccurrences, str1)

Dim oDoc2 As DrawingDocument

oDoc2 = ThisDoc.Document

 

End If

Next

'MessageBox.Show(Str1 & vbCr & " Returning from GetOccName")

Return str1

End Function

 

 

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 17 of 32

Anonymous
Not applicable

Hi Wayne, thanks you very much for all your works and times 🙂

 

Work great, now i want to add more code if my select view with part in exciste in this list, it's possible?

 

0 Likes
Message 18 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

I am not sure what you are asking for here.  

 

If you want to get the selected drawing view you could do that. One of the rules in this post had the user select a drawing view. If you don't have them select the drawing view then it would need to be selected before you run the rule.  The code could compare the selected drawing view with the drawing views in the for each loop. You could get a variable with part name and use an if statement to determine if it is in a drawing view. 

 

If this does not help please include the code you have tried that is not working.

 

Thanks,  



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 19 of 32

Anonymous
Not applicable
hi!

I know for the selected drawing view, i want to know, how to add a code in rule who determine if this part selected in view exciste in this show list created by your rule?

Sorry again fro my horrible english, i try 😉
0 Likes
Message 20 of 32

wayne.brill
Collaborator
Collaborator

Hi,

 

Here is another rule to try. An edge in a DrawingView needs to be selected. If a edge (DrawingCurveSegment) is not selected it displays a message and returns.

 

This example gets the display name of the document the selected edge belongs to. It uses name to find out if that part is in one of the other views.

 

Sub Main()

 

Dim oDoc As DrawingDocument

oDoc = ThisDoc.Document

 

Dim refDocDesc

Dim oReferencedDoc

Dim oAssembly

Dim oPart

Dim oOcc As ComponentOccurrence

Dim ModelName

Dim NAME

 

Dim selObj

Dim partNameToTest

'see if there is something selected

If oDoc.SelectSet.Count > 0 Then

'Get the first selected entity

selObj = oDoc.SelectSet(1)

'MessageBox.Show(TypeName(selObj), "Title")

'see if the selected entity is a DrawingCurve

If TypeName(selObj) = "DrawingCurveSegment" Then

 

'get the name of the file the selected DrawingCurveSegment is in

 Dim oCompDef As ComponentDefinition

  oCompDef = selObj.Parent.ModelGeometry.Parent.ComponentDefinition

  partNameToTest = oCompDef.Document.DisplayName

 ' MessageBox.Show(partNameToTest, "Title")

 Else

 MessageBox.Show("Selected object not an edge in a view", "Title")

 Return

End If ' Select object type

Else

    MessageBox.Show("Select an edge in a view", "Title")

    Return

End If ' SelectSet.Count

 

 

For Each oDrawView In oDoc.ActiveSheet.DrawingViews

myString = myString & "View " & oDrawView.Name & vbCr

 

refDocDesc = oDrawView.ReferencedDocumentDescriptor

oReferencedDoc = refDocDesc.ReferencedDocument

 

If oReferencedDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then

'MessageBox.Show("this is an Assembly", "Title")

oAssembly = oReferencedDoc

'modelName = IO.Path.GetFileName(oAssembly.FullFileName)

'MessageBox.Show("FullFileName = " & oAssembly.FullFileName, "Title")

'NAME = Left(modelName, Len (ModelName) -4) & ":1"

 

NAME = oAssembly.DisplayName ' & ":1"

myString = myString & "Top level Assembly = " & NAME & vbCr

 

ElseIf oReferencedDoc.DocumentType = kPresentationDocumentObject Then

'MessageBox.Show("this is a presentation document", "Title")

oAssembly = oReferencedDoc.ReferencedDocuments(1)

modelName = IO.Path.GetFileName(oAssembly.FullFileName)

NAME = Left(modelName, Len (modelName) -4) & ":1"

myString = myString & "Top level Presentation doc = " & NAME & vbCr

' Return

 

ElseIf oReferencedDoc.DocumentType = kPartDocumentObject

oPart = oReferencedDoc

'MessageBox.Show("This is a Part document " & oPart.FullFileName, "Title")

'Do something here with the part

' Go to the next DrawingView in the for next loop

Continue For

End If

 

 

For Each oOcc In oAssembly.ComponentDefinition.Occurrences

 

Dim oDrawCrvsEnum As DrawingCurvesEnumerator

oDrawCrvsEnum = oDrawView.DrawingCurves(oOcc)

' MessageBox.Show(oDrawCrvsEnum.count)

If oDrawCrvsEnum.Count > 0 Then

 

'wB added

'if it is an assembly call GetOccName and put the occurrence name in myString

If (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

 

 

myString = myString & "SubAssembly " & vbCr

myString = myString & oOcc.Definition.Document.DisplayName & vbCr

'MessageBox.Show(myString)

myString = GetOccName(oOcc.SubOccurrences, myString,partNameToTest )

 

End If

 

 

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then

 ' MessageBox.Show(oOcc.Definition.Document.DisplayName)

  If oOcc.Definition.Document.DisplayName = partNameToTest Then

     myString = myString & partNameToTest & " is in this view !!!" & vbCr

 Else

    myString = myString & oOcc.Definition.Document.DisplayName & vbCr

 End If

End If

 

End If

 

Next 'occurrence

Next 'DrawingViews

 

MessageBox.Show(myString, "Title")

 

End Sub

 

Private Function GetOccName(oOccs As ComponentOccurrences, str1 as String, partNameToTest As String) As String

Dim oOcc As ComponentOccurrence

For Each oOcc In oOccs

'MessageBox.Show("In For each loop" & oOcc.Name)

If (oOcc.DefinitionDocumentType = kPartDocumentObject) Then ' part

 

  If oOcc.Definition.Document.DisplayName = partNameToTest Then

      str1 = str1 & partNameToTest & " is in this view !!!" & vbCr

    'MessageBox.Show(partNameToTest & " is in this view ", "Title")

  Else

      str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

  End If

 

ElseIf (oOcc.DefinitionDocumentType = kAssemblyDocumentObject) Then

str1 = str1 & "SubAssembly " & vbCr

str1 = str1 & oOcc.Definition.Document.DisplayName & vbCr

str1 = GetOccName(oOcc.SubOccurrences, str1, partNameToTest)

 

Dim oDoc2 As DrawingDocument

oDoc2 = ThisDoc.Document

 

End If

 

Next

 

'MessageBox.Show(Str1 & vbCr & " Returning from GetOccName")

 

Return str1

 

End Function

 

 

Maybe this is close to what you need.

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes