Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
koenroovers
913 Views, 8 Replies

Position partslist Ilogic

Hello Everyone,

 

I have searched the forum for this solution but i can't seem to find the exact solution.

I have a Ilogic to auto place a predefined style partlist on my drawing. It also reorders the partlist according to my preferences.

 

The problem is that i can't get the position correct. I want it to be on the position of the blue point.

I've tried the offset possibility. But my problem was that if i place a different assembly with a different partlist the offset position changes. So no fixed value.

 

Can somebody please help me correct my Ilogic Code?

 

Kind regards,

Koen Roovers

 

 

koenroovers_0-1658219035332.png

 

iLogicVb.UpdateWhenDone = True   

' 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    
	oX = oBorder.RangeBox.MaxPoint.X 
	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

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)
	MessageBox.Show("There is an existing Parts List", "iLogic")
	
Catch
	' Create the parts list.  
	oPartslist = oSheet.PartsLists.Add(oDrawingView, oPlacePoint)
	'set parts list to a specific style
oPartslist.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Purchase List (Kieu)")

Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartsList1.Sort("Opmerkingen", 1, "Kodenummer", 1)
oPartsList1.Renumber
	
End Try