Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JelteDeJong
in reply to: ppolcynBNVFN

try this:

Dim doc = ThisApplication.ActiveDocument
Dim sheet As Sheet = doc.ActiveSheet
Dim baseView As DrawingView = sheet.DrawingViews.Item(1)
Dim refDoc As Document = baseView.ReferencedDocumentDescriptor.ReferencedDocument

Dim border = sheet.Border
Dim placementPoint = border.RangeBox.MaxPoint
If border Is Nothing Then
    placementPoint = ThisApplication.TransientGeometry.CreatePoint2d(sheet.Width - 2.54 / 2, sheet.Height - 2.54)
End If


Dim partsList As PartsList
Try
    partsList = sheet.PartsLists(1)
Catch
    partsList = sheet.PartsLists.Add(baseView, placementPoint)
End Try

If refDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
    partsList.Style = doc.StylesManager.PartsListStyles.Item("Assembly List")
ElseIf refDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
    partsList.Style = doc.StylesManager.PartsListStyles.Item("Parts List Dimensionless")
End If

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com