
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Goal:
I am trying to use iLogic to insert a parts list, prompt user for parts list style, and position the parts list to the top left.
Problem:
I can use a static 2d point to position the parts list, but because the style can be changed, the size typically also changes and then the table ends up hanging off to the left of the sheet - since the reference point for the parts list is to the top right. In the code below I am attempting to first create the parts list positioned at the Border.RangeBox.MinPoint (essentially 0,0), and then reposition it using Border.RangeBox.MaxPoint.Y (the top of the border) and offsetting the table in the X direction by PartsList.RangeBox.MaxPoint.X (the overall width of the table). This results in the table being positioned correctly in the Y direction, but the X offset isn't right. This tells me that either PartsList.RangeBox.MaxPoint.X isn't actually representing the overall width of the table, or I am doing something else wrong here.
Can someone with more knowledge in iLogic than myself take a look at the code and help me out? Thanks!
Sub Main() 'Declare local variables Dim oDrawDoc As DrawingDocument Dim oSheet As Sheet Dim oDrawingView As DrawingView Dim oPlacementPoint As Point2d Dim oPartsList As PartsList Dim oBorder As Border Dim oStyle As String Dim oPlaceX As Double Dim oPlaceY As Double 'initialize variables oDrawDoc = ThisApplication.ActiveDocument oSheet = oDrawDoc.ActiveSheet oDrawingView = oSheet.DrawingViews(1) oBorder = oSheet.Border 'user input - select parts list style oStyle = InputListBox("Choose Parts List Style", MultiValue.List("PartsListStyle"), "Custom Parts List (ANSI)", "Parts List Style", "List Prompt") 'create parts list oPartsList = oSheet.PartsLists.Add(oDrawingView, oBorder.RangeBox.MinPoint) oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item(oStyle) 'reposition parts list to top left oPlaceX = oBorder.RangeBox.MinPoint.X + oPartsList.RangeBox.MaxPoint.x oPlaceY = oBorder.RangeBox.MaxPoint.Y oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oPlaceX,oPlaceY) oPartslist.position = oPlacementPoint End Sub
Solved! Go to Solution.