PartsList Title and Header Height

PartsList Title and Header Height

ilyas_adnm
Advocate Advocate
409 Views
3 Replies
Message 1 of 4

PartsList Title and Header Height

ilyas_adnm
Advocate
Advocate

Hi Everyone,

 

I'm writing a function to position my PartsList based on the lower right corner. The Position property controls the position from the top right corner. Hence, to do this, I'll need the height of the PartsList. I can get the total height of the rows. However, I can't seem to find the height for the title and header. Does anyone any idea?

 

Sub Main()
	Dim oSheet As Sheet = ActiveSheet.Sheet
	For Each oPartsList As PartsList In oSheet.PartsLists		
		MovePartsList(oPartsList,0,0)
	Next
End Sub

Sub MovePartsList(oPartsList As PartsList, x As Double, y As Double)
	oPartsList.Position=ThisApplication.TransientGeometry.CreatePoint2d(x,y+getPartsListHeight(oPartsList))
End Sub

Function getPartsListHeight(oPartsList As PartsList) As Double
	getPartsListHeight = 0
	getPartsListHeight += 1.178 'supposed to get the header and title heights, however, can't seem to find it in api. Hence, just putting a fixed value here
	For Each oRow As PartsListRow In oPartsList.PartsListRows
		getPartsListHeight += oRow.Height
	Next
End Function

 

 

Regards

Ilyas

 

0 Likes
Accepted solutions (2)
410 Views
3 Replies
Replies (3)
Message 2 of 4

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi @ilyas_adnm,

You could use the rangebox property instead. The folowing code gives you the height of the table h :

 

Dim p As Inventor.PartsList = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingPartsListFilter, "Pick a parts list")
Dim h As Double = p.RangeBox.MaxPoint.Y - p.RangeBox.MinPoint.Y
MsgBox(h)

 

 

Kind regards,

FINET L. 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 3 of 4

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @ilyas_adnm . Simple code for positioning the PartsList on the TitleBlock:

Dim oDoc As Document = ThisDoc.Document
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
If Not TypeOf oDoc Is DrawingDocument Then Exit Sub
Dim oDrawDoc As DrawingDocument = oDoc
Dim oLists As PartsLists = oDrawDoc.ActiveSheet.PartsLists
If oLists.Count = 0 Then Exit Sub
Dim oBlick As TitleBlock = oDrawDoc.ActiveSheet.TitleBlock
Dim oList As PartsList = oLists(1)
Dim dW As Double = oList.RangeBox.MaxPoint.X - oList.RangeBox.MinPoint.X
Dim dH As Double = oList.RangeBox.MaxPoint.Y - oList.RangeBox.MinPoint.Y
oList.Position = oTG.CreatePoint2d(oBlick.RangeBox.MinPoint.X + (dW), oBlick.RangeBox.MaxPoint.Y + (dH))

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 4 of 4

ilyas_adnm
Advocate
Advocate

Hi @Andrii_Humeniuk,

 

Thanks for the sample. I've modified my function to use the RangeBox instead.

 

Sub MovePartsList(oPartsList As PartsList, x As Double, y As Double)
	oPartsList.Position = ThisApplication.TransientGeometry.CreatePoint2d(x, y + oPartsList.RangeBox.MaxPoint.Y-oPartsList.RangeBox.MinPoint.Y)	
End Sub

 

Regards

Ilyas