How to modify the Title row height of a Parts List using iLogic/API?

How to modify the Title row height of a Parts List using iLogic/API?

JBerns
Advisor Advisor
419 Views
3 Replies
Message 1 of 4

How to modify the Title row height of a Parts List using iLogic/API?

JBerns
Advisor
Advisor

Community,

 

Does anyone know how to modify the Title row height of a Parts List using iLogic/API? I cannot find a property for it.

JBerns_3-1712691457737.png

 

The current dialog for editing the Parts List Title does not allow the user to create multiple lines (without typing a lot of spaces).

 

I created a form to edit the parts list Title property. Using a textbox, user can input multiple lines.

Note the original Title row height before clicking Apply button.

JBerns_0-1712690307180.png

 

Inventor automatically increases the Title row height when multiple lines exist. New height indicated by blue arrow.

JBerns_1-1712690343528.png

 

However, the Title row height does not reduce automatically when the number of lines decreases.

JBerns_2-1712690398443.png

 

The user can manually drag to adjust the row height, but I would prefer to adjust the height with automation.

 

Any assistance to auto-adjust row height would be appreciated.

 


Regards,
Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
420 Views
3 Replies
Replies (3)
Message 2 of 4

james.collinsPWQR2
Advocate
Advocate

Hi Jerry,

 

To get the height of the title row you will need to take the following steps:
1. Get the overall height of the Partlist. PartsList.RangeBox.MaxPoint.Y - MinPointY
2. Get the total height of the item rows. PartsListRow.Height

3. Then subtract the total row height from the Partslist height

4. Divide that by two to get the Title row height
I have made a few assumptions, firstly that you will get the rangeebox when the user first runs the rule, before its a multiline. Secondly that the Title and Column Header are formatted the same, if they have different text sizes then you will need to modify step four accordingly.

jamescollinsPWQR2_0-1738270969796.png

 

Cheers,

 

James

 

0 Likes
Message 3 of 4

davescholtes
Explorer
Explorer

Well, I checked the model browser and the locals window (both VBA), but I also couldn't find any API properties/methods handling title rows. To me, replacing the BOM seems like the only option, unfortunately.

0 Likes
Message 4 of 4

james.collinsPWQR2
Advocate
Advocate

Hi Jerry, 

 

Forget my previous post, if you just flicker the style from one to another it will force the correct formatting/Title Row Height onto the table. Therefore when you go from multiline to single line text the row height will update to suit.

 

 

Dim openDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim activeSheet As Sheet = openDrawDoc.ActiveSheet
Dim dwgStylesManager As DrawingStylesManager = openDrawDoc.StylesManager
If activeSheet.PartsLists.Count > 0 Then
	Dim currentPartList As PartsList = activeSheet.PartsLists.Item(1)
	Dim originalPartsListStyle As PartsListStyle = currentPartList.Style
	For Each partListSty As PartsListStyle In dwgStylesManager.PartsListStyles
		If originalPartsListStyle IsNot partListSty Then
			' Force the parts list style to change to something other than the current
			currentPartList.Style = partListSty
			Exit For
		End If
	Next
	' Swap it back to the original style to remove any manual formatting
	currentPartList.Style = originalPartsListStyle
End If

 

 

 

Hopefully that works,

 

James

0 Likes