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
Solved! Go to Solution.
Solved by waynehelley. Go to Solution.
Solved by waynehelley. Go to Solution.
I found this link with posts from @Ktomberlin and @Curtis_Waguespack that may be helpful.
Let us know if you need more assistance.
Regards,
Jerry
@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
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
Can't find what you're looking for? Ask the community or share your knowledge.