Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating drawings for similar or different parts used in subassemblies

1 REPLY 1
SOLVED
Reply
Message 1 of 2
alundr
520 Views, 1 Reply

Creating drawings for similar or different parts used in subassemblies

These are my two scenarios.

 

1.  Assembly

1.1  Subassembly1

1.1.1  Part1

1.2  Subassembly2

1.2.1  Part1

 

1.  Assembly

1.1  Subassembly1

1.1.1  Part1

1.2  Subassembly2

1.2.1  Part2

 

How do I write my code so that I call for the correct number of drawings for the part?  If I call for the drawings to be made at the subassembly level, I could end up making 2 drawings for the same part.  This does not work for scenario 1 but does work for scenario 2 because the parts are different.  So I will need to call for the drawings to be made from the assembly level.  How do I sort the parts to know if I need to make one or two drawings?

1 REPLY 1
Message 2 of 2
alundr
in reply to: alundr

Got it...  

ListOfDrawingParts gives me a list of the unique parts with the 32digit part number.

CenterPlateDrawingList gives me the number of unique parts of the type CenterPlate.

You can see in the image that while there are two divverent center plates, there is a common BottomPan.

Thanks for looking

 

 

Parameter Rule ListOfDrawingParts As List
	ListOfDrawingParts = {}
	
	Dim tempDoc As Any 
	Dim tempPN As String 

	
	For x=1 To length(root.children)

		tempDoc = nth(x,root.children)
		tempPN = iv_PropertyGet(tempDoc,"Part Number")
							
		
		If find(tempPN, ListOfDrawingParts, key := :second) = NoValue  Then
			ListOfDrawingParts = ListOfDrawingParts + {{nth(x,root.children),tempPN}}
		End If
		
		If nth(x,root.children).iskindof?(:IvMateConstraint) Or _
			nth(x,root.children).iskindof?(:IvInsertConstraint) Or _
			nth(x,root.children).iskindof?(:IvWorkPlane) Then
		
		ElseIf nth(x,root.children).iskindof?(:CoilAssembly) Then 
			For y=1 To length(nth(x,root.children).children)

				
				If nth(y,nth(x,root.children).children).iskindof?(:IvMateConstraint) Or _
					nth(y,nth(x,root.children).children).iskindof?(:IvInsertConstraint) Or _
					nth(y,nth(x,root.children).children).iskindof?(:IvWorkPlane) Then
		
				ElseIf nth(y,nth(x,root.children).children).iskindof?(:IvAssemblyDocument) Then 
				
					tempDoc = nth(y,nth(x,root.children).children)
					tempPN = iv_PropertyGet(tempDoc,"Part Number")
										
					
					If find(tempPN, ListOfDrawingParts, key := :second) = NoValue  Then
						ListOfDrawingParts = ListOfDrawingParts + {{nth(y,nth(x,root.children).children),tempPN}}
											
						For z=1 To length(nth(y,nth(x,root.children).children).children)
							If nth(z,nth(y,nth(x,root.children).children).children).iskindof?(:IvMateConstraint) Or _
								nth(z,nth(y,nth(x,root.children).children).children).iskindof?(:IvInsertConstraint) Or _
								nth(z,nth(y,nth(x,root.children).children).children).iskindof?(:IvWorkPlane) Then
							
							Else
							
								tempDoc = nth(z,nth(y,nth(x,root.children).children).children)
								tempPN = iv_PropertyGet(tempDoc,"Part Number")
								
								If find(tempPN, ListOfDrawingParts, key := :second) = NoValue Then
									ListOfDrawingParts = ListOfDrawingParts + {{nth(z,nth(y,nth(x,root.children).children).children),tempPN}}
								End If
							
							End If
						Next
					End If 

				Else
											
					tempDoc = nth(y,nth(x,root.children).children)
					tempPN = iv_PropertyGet(tempDoc,"Part Number")
					
					If find(tempPN, ListOfDrawingParts, key := :second) = NoValue Then
						ListOfDrawingParts = ListOfDrawingParts + {{nth(y,nth(x,root.children).children),tempPN}}
					End If

				End If
			Next
			
		End If
	Next

	ListOfDrawingParts = sort(ListOfDrawingParts,:Ascending, key := :second)


End Rule


Parameter Rule CenterPlateDrawingList As List
	CenterPlateDrawingList = {}
	For x=1 To length(ListOfDrawingParts)
		If subString(second(nth(x,ListOfDrawingParts)),1,11) = "CenterPlate" Then
			CenterPlateDrawingList = CenterPlateDrawingList + {nth(x,ListOfDrawingParts)}
		End If
	Next
End Rule

 Capture.JPG

 

 

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

Post to forums