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

[iLogic] Control Position of Parts List

Anonymous

[iLogic] Control Position of Parts List

Anonymous
Not applicable

Hello all,

 

I am creating a drawing controlled by ilogic. The assembly can vary in size considerably so I have set the IDW to change between sheet size A3 and A2 accordingly using ilogic. However, when the sheet size is changed, the parts list stays in a static position.

 

Currently, the parts list is situated in the top right corner up against the title block and the border. So when changing from Size A3 to Size A2, the parts list ends up in the middle of the page. Is there anyway i can control the position of the parts list so it changes with the sheet size chage?

 

I know I could simply move the partslist to the bottom left corner, which is a work around. However, I'd like to be able to keep the drawings in line with the company standard.

 

As always, any help is appreciated

 

Many Thanks

0 Likes
Reply
Accepted solutions (3)
3,774 Views
12 Replies
Replies (12)

skyngu
Collaborator
Collaborator

get partslist's property position, hope it helps.

 

'get paper size and set position

dim newposition as point2d

newposition = oPartslist.position

 

newposition.x=35

newposition.y=10

 

oPartslist.position = newposition

Autodesk Inventor Professional 2019
0 Likes

Anonymous
Not applicable

I need exactly this.

This code is not working for me,

Anyone can help me?

Thanks

0 Likes

Anonymous
Not applicable

This Work, but if i need to fix it to left bottom corner then what?

0 Likes

skyngu
Collaborator
Collaborator
try this:
'Add Parts List on right top corner of border
Dim oPartsListPosition As Point2d
Set oPartsListPosition = oSheet.Border.RangeBox.MaxPoint

Set oPartsList = oSheet.PartsLists.Add(oDoc, oPartsListPosition, kStructured, , , True)

that is on right top corner. the rangebox.minpoint fit your need
Autodesk Inventor Professional 2019
0 Likes

Anonymous
Not applicable

I cant get i to place it right,( in the left corner by a cordinate. )

 

 

 

 

0 Likes

MechMachineMan
Advisor
Advisor

So change the x and y values.

 

Place it where you want it, and write code that will grab it's x/y position, than insert that into your original code

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

MechMachineMan
Advisor
Advisor
Accepted solution
Imports System.Windows.Forms

Sub Main()
Dim doc As DrawingDocument
    doc = ThisApplication.ActiveDocument

Dim oSketched As SketchedSymbol = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingSketchedSymbolFilter, "Select corresponding symbol")

Dim pt As Point2d
pt = oSketched.Position

 MsgBox("X: " & pt.X & vbLf & "Y: " & pt.Y)
 Clipboard.SetText("X: "& pt.X & " Y: "& pt.Y)
End Sub

 

Use something similiar to this. 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Anonymous
Not applicable

I am using this code, but it uses the wrong point on the partlist. i need to fix it in the BottonLeft corner for the partlist. 

 

SyntaxEditor Code Snippet

On Error Resume Next
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oPartsList As PartsList
oPartsList = oDrawDoc.ActiveSheet.PartsLists.Item(1)

Dim newposition2 As point2d
newposition2 = oPartslist.position
''
newposition2.x=41
newposition2.y=6.53
'' 
oPartslist.position = newposition2
0 Likes

GosponZ
Collaborator
Collaborator
Accepted solution
'activating this command part list table will be inserted and will sit on top of title block on lower right corner

' add partslist table

oDrawDoc = ThisDoc.Document
 'Set a reference to the active sheet.
    Dim oSheet As Sheet
      oSheet = oDrawDoc.ActiveSheet
    Dim oBorder As Border = oSheet.Border
    ' Set a reference to the first drawing view 

 
    Dim oDrawingView As DrawingView
      oDrawingView = oSheet.DrawingViews(1)
      
If Not oBorder Is Nothing Then
	oPlacementPoint = oBorder.RangeBox.MaxPoint
Else
	oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width, oSheet.Height)
End If


    
   
    ' Create the parts list.
    Dim oPartsList As PartsList
     oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)

     
   
minXpoint = oSheet.TitleBlock.RangeBox.MinPoint.x
minYpoint = oSheet.TitleBlock.RangeBox.MaxPoint.Y
maxXpoint = oPlacementPoint.x
dPointx = oSheet.PartsLists.Item(1).RangeBox.MinPoint.X - minXpoint
dPointY = oSheet.PartsLists.Item(1).RangeBox.MinPoint.Y - minYpoint
maxYpoint = oPlacementPoint.Y - dPointY
    
Dim newmin, newmax As Point2d
newmin = ThisApplication.TransientGeometry.CreatePoint2d(minXpoint, minYpoint)
newmax = ThisApplication.TransientGeometry.CreatePoint2d(maxXpoint, maxYpoint)
oSheet.PartsLists.Item(1).Delete
oPartsList = oSheet.PartsLists.Add(oDrawingView, newmax)

 

 Try this one, working for me for long time, but it doesn't work with assembly

Anonymous
Not applicable
Accepted solution

Thank you very much, this leaded me to the right rule,

 

SyntaxEditor Code Snippet

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As sheet
oSheet = oDrawDoc.ActiveSheet
Dim oPartslist As Partslist
oPartsList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
Dim oPlacementPoint, oPlacementPoint2 As point2d
Dim oBorder As Border
oBorder = oSheet.Border

PartHight=oSheet.PartsLists.Item(1).RangeBox.MaxPoint.Y-oSheet.PartsLists.Item(1).RangeBox.MinPoint.Y
TitleY=oSheet.TitleBlock.RangeBox.MaxPoint.Y
PointX=oBorder.Rangebox.Maxpoint.x
PointY=TitleY+PartHight

oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(PointX,PointY)
oPartslist.position = oPlacementPoint
0 Likes

Tigerpirro
Advocate
Advocate

Could I use this to place title blocks?

0 Likes

GosponZ
Collaborator
Collaborator

no

0 Likes