I'm building a bill of materials table from an excel sheet. Right now, I'm hard coding the insertion points (Line 28-32) for the attribute text in order to center them within their respective spaces.
from pyautocad import ACAD, Autocad, APoint, aDouble
acad = Autocad(create_if_not_exists=True)
ip = APoint(0, 0, 0)
yStack = 0.0
blockName = "BOM Header"
b1 = acad.doc.Blocks.Add(ip, blockName)
p1 = b1.AddPolyline(aDouble(0,0,0, 5.3382,0,0, 5.3382,.1250,0, 0,.1250,0, 0,0,0))
a1 = b1.AddAttribute(.0625, 0, "BOM", aDouble(2.3, .03125, 0), "BOM", "BILL OF MATERIAL")
blockRef = acad.model.InsertBlock(APoint(10, 10 + yStack, 0), blockName, 1, 1, 1, 0)
yStack = -.1250
row = 2
blockName = "BOM Header 2"
b1 = acad.doc.Blocks.Add(ip, blockName)
p1 = b1.AddPolyline(aDouble(0,0,0, 5.3382,0,0, 5.3382,.1250,0, 0,.1250,0, 0,0,0))
l1 = b1.AddLine(APoint(.3139, 0, 0), APoint(.3139, .1250, 0))
l2 = b1.AddLine(APoint(.5970, 0, 0), APoint(.5970, .1250, 0))
l3 = b1.AddLine(APoint(2.9096, 0, 0), APoint(2.9096, .1250, 0))
l4 = b1.AddLine(APoint(4.3024, 0, 0), APoint(4.3024, .1250, 0))
a1 = b1.AddAttribute(.0625, 0, "ITEM", aDouble(.05, .03125, 0), "ITEM", "ITEM")
a2 = b1.AddAttribute(.0625, 0, "QTY", aDouble(.3639, .03125, 0), "QTY", "QTY")
a3 = b1.AddAttribute(.0625, 0, "DESCRIPTION", aDouble(1.45, .03125, 0), "DESCRIPTION", "DESCRIPTION")
a4 = b1.AddAttribute(.0625, 0, "PART", aDouble(3.3, .03125, 0), "PART", "PART NUMBER")
a5 = b1.AddAttribute(.0625, 0, "MANUFACTURER", aDouble(4.45, .03125, 0), "MANUFACTURER", "MANUFACTURER")
blockRef = acad.model.InsertBlock(APoint(10, 10 + yStack, 0), blockName, 1, 1, 1, 0)

I was wondering if there was a way to set each columns text to a middle alignment so it could center any text dynamically and not reference the fixed insertion point. I've tried to use "a3.Alignment = 1" in reference the acAlignment enum values but it seems to align it to the block insertion point.
