09-20-2016
02:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-20-2016
02:48 PM
Hi PhilLindsay4781,
I followed you over here from the other thread.
Have a look at this example, it looks for 2 named parts list styles:
- PartsList_Internal
- PartsList_External
It gets input from the user and then sets the style for an existing, or newly placed parts list.
Using this example you would only have one button on your form, that would be called something like:
Create or Update Parts List
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
iLogicVb.UpdateWhenDone = True
Dim bStyle As Boolean
bStyle = InputRadioBox("Select one:", "Internal", "External", True, "iLogic")
Dim sStye As String
'set the parts list style names to use
If bStyle = True Then
sStyle = "PartsList_Internal"
Else
sStyle = "PartsList_External"
End If
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
' Set a reference to the first drawing view on
' the sheet. This assumes the first drawing
' view on the sheet is not a draft view.
Dim oDrawingView As DrawingView
Try
oDrawingView = oSheet.DrawingViews(1)
Catch
MessageBox.Show("No View found. Can not continue", "iLogic")
Return
End Try
' Set a reference to th sheet's border
Dim oBorder As Border
oBorder = oSheet.Border
Dim oPlacePoint As Point2d
If Not oBorder Is Nothing Then
' A border exists. The placement point
' is the top-right corner of the border.
oOffset = -1.42875 'user defined offset
oX = oBorder.RangeBox.MaxPoint.X + oOffset
oY = oBorder.RangeBox.MaxPoint.Y
oPlacePoint = ThisApplication.TransientGeometry.CreatePoint2d(oX,oY)
Else
' There is no border
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(20, 20)
iLogicVb.UpdateWhenDone = True
End If
' Get the style.
Dim oStyle As Style
For Each aStyle As Style In oDrawDoc.StylesManager.PartsListStyles
If aStyle.Name = sStyle Then
oStyle = aStyle
Exit For
End If
Next
Dim oPartslist As PartsList
Try
'look for the first parts list found on the sheet
'if succesful finding it,
'tell the user,then Do Nothing
oPartslist = oSheet.PartsLists(1)
Catch
' Create the parts list.
oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacePoint)
End Try
'set the style
oPartsList.Style = oStyle