Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic automactly place parts list

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
Anonymous
7280 Views, 22 Replies

ilogic automactly place parts list

Hi All,

 

When placing a base view, I would like to have the part list inmediatly placed on the top right border. I have different parts list styles. One for assemblies, and one for individual parts. Is there a way to also incorporate this in the Ilogic rule?

 

Thanks

22 REPLIES 22
Message 21 of 23
JBerns
in reply to: Anonymous

@MichaëlStienstra ,

 

I found this link with posts from @Ktomberlin and @Curtis_Waguespack that may be helpful.

https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parts-list-style-with-ilogic/td-p/... 

 

Let us know if you need more assistance.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 22 of 23
engineeringSEZWD
in reply to: JBerns

@JBerns 

That worked just perfect awesome.

is there a way I can run this ilogic rule in all sheet combines in the same 2d file but only do on those one made of frame generator?

 

apart from that works perfect

here is the update ilogic rule to add the cut list part list as show in the picture.

Sub Main
' Set a reference to the active drawing document
Dim invDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = invDoc.ActiveSheet

' Delete existing parts lists if any
Try
DeletePartsList(oSheet)
Catch
End Try

' Set a reference to the first drawing view
Dim oDrawingView As DrawingView = oSheet.DrawingViews(1)
Dim oBorder As Border = oSheet.Border
Dim oPlacementPoint As Point2d

' Determine placement point based on border
If Not oBorder Is Nothing Then
xrev = oBorder.RangeBox.MinPoint.X + "17"
yrev = oBorder.RangeBox.MaxPoint.Y
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(xrev, yrev)
End If

' Define the parts list BOM type
Dim partsListBomType As PartsListLevelEnum = 46593

' Add a new parts list
Dim oPartsList As PartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint, partsListBomType)

' Set the parts list to the specific style "Cut List (ISO)"
Try
oPartsList.Style = invDoc.StylesManager.PartsListStyles.Item("Cut List (ISO)")
Catch ex As Exception
MessageBox.Show("The style 'Cut List (ISO)' could not be found. Please ensure it exists in the document.")
End Try
End Sub

Private Sub DeletePartsList(oSheet As Sheet)
' Delete existing parts lists on the sheet
Dim oPartList As PartsList
For Each oPartList In oSheet.PartsLists
oPartList.Delete()
Next
End Sub

Message 23 of 23
JBerns
in reply to: Anonymous

@engineeringSEZWD,

 

Here is some code to help you get started looping through all sheets and all views on a sheet:

 

 

' Get document info
Dim oDoc As Inventor.DrawingDocument = ThisDoc.Document
Dim oSheet As Inventor.Sheet
Dim oView As Inventor.DrawingView

' Loop through each sheet
For Each oSheet In oDoc.Sheets
	' Loop through each drawing view
	For Each oView In oSheet.DrawingViews
		' Report the referenced document (model) in the drawing view
		MsgBox(oView.ReferencedDocumentDescriptor.FullDocumentName)
		'''
		''' add code here to search for ref doc name
		''' if a match, add the parts list
		''' 
	Next
Next

 

 

Let us know if you need assistance.

 

Regards,

Jerry

 

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional

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

Post to forums  

Autodesk Design & Make Report