I am using an XML reader, combined with the SimpleIDML module in python in an attempt to read and write to an IDML file. While doing this, I will need to read the geometric bounds (top, left, bottom, and right sides of an object) from said file. While looking through the XML file for the spread, I found this code:
<Properties>
<PathGeometry>
<GeometryPathType PathOpen="false">
<PathPointArray>
<PathPointType Anchor="159.92000000000002 -235.728" LeftDirection="157.85224590848 -235.728" RightDirection="161.98775409152 -235.728"/>
<PathPointType Anchor="163.66400000000004 -239.47200000000004" LeftDirection="163.66400000000004 -237.40424590848" RightDirection="163.66400000000004 -241.53975409152002"/>
<PathPointType Anchor="159.92000000000002 -243.21600000000007" LeftDirection="161.98775409152 -243.21600000000007" RightDirection="157.85224590848 -243.21600000000007"/>
<PathPointType Anchor="156.176 -239.47200000000004" LeftDirection="156.176 -241.53975409152002" RightDirection="156.176 -237.40424590848"/>
</PathPointArray>
</GeometryPathType>
</PathGeometry>
</Properties>
This appears to be the code for an Oval
object within the IDML schema. From what I can see from the specs, these points define a Bezier curve. However, I am unfamiliar with Bezier curves and I don't know how I could convert this into geometric boundaries for the Oval
itself.
Does anybody have a function in Python for deriving geometric bounds from these coordinates in inches? In addition, is there a way to convert a set of geometric bounds into this notation, if I want to move around/resize these ovals?
Update: Apparently each object has an "ItemTransform" property as well. This might be necessary for calculation?