Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[iLogic] Control Position of Parts List

12 REPLIES 12
Reply
Message 1 of 13
Calico5
3342 Views, 12 Replies

[iLogic] Control Position of Parts List

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

12 REPLIES 12
Message 2 of 13
skyngu
in reply to: Calico5

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
Message 3 of 13
Xiffix
in reply to: skyngu

I need exactly this.

This code is not working for me,

Anyone can help me?

Thanks

Message 4 of 13
Turac
in reply to: skyngu

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

Message 5 of 13
skyngu
in reply to: Turac

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
Message 6 of 13
Turac
in reply to: skyngu

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

 

 

 

 

Message 7 of 13
MechMachineMan
in reply to: Turac

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
Message 8 of 13
MechMachineMan
in reply to: Turac

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
Message 9 of 13
Turac
in reply to: MechMachineMan

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
Message 10 of 13
GosponZ
in reply to: Turac

'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

Message 11 of 13
Turac
in reply to: GosponZ

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
Message 12 of 13
Tigerpirro
in reply to: Turac

Could I use this to place title blocks?

Message 13 of 13
GosponZ
in reply to: Tigerpirro

no

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report