Skip to main content
Olivier Beltrami
Legend
December 21, 2024
Question

Getting/Setting the XY Values of a Frame

  • December 21, 2024
  • 1 reply
  • 462 views

Hello,

Is there a direct way to get/set the XY values of a frame ?

Currently I use the following (pared-down down code for simplicity) which is really complex and relies on the page height/width and whether pages are facing or not. It seems unnecessariuly complex.

Is there a more direct way ?

Very best regards,

Olivier

InterfacePtr<IGeometry> itemGeometry(curBoxIDRef, UseDefaultIID());
gBoxRect = itemGeometry->GetPathBoundingBox(InnerToParentMatrix(itemGeometry));
if (IniSettings.FacingPages)
{
	// left page object bounding boxes need to be shifted by a full page width
	if (pcr->pageNum % 2 == 0)
	{
	gBoxRect.Left(gBoxRect.left + ToPMReal(IniSettings.PageWidth));
	gBoxRect.Right(gBoxRect.right + ToPMReal(IniSettings.PageWidth));
	}
}
else
{
	// page object bounding boxes need to be shifted to the right by a half page width
	gBoxRect.Left(gBoxRect.left + ToPMReal(IniSettings.PageWidth / 2.0));
	gBoxRect.Right(gBoxRect.right + ToPMReal(IniSettings.PageWidth / 2.0));
}
// 2024-12-18: all box vert positions are shifted by 1/2 page length
gBoxRect.Top(gBoxRect.top + ToPMReal(IniSettings.PageLength / 2.0));
gBoxRect.Bottom(gBoxRect.bottom + ToPMReal(IniSettings.PageLength / 2.0));

 

This topic has been closed for replies.

1 reply

Robert at ID-Tasker
Legend
December 21, 2024

What is your Ruler Origin setting? 

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#RulerOrigin.html 

 

And what with (0,0) point? 

 

Olivier Beltrami
Legend
December 21, 2024

@Robert at ID-Tasker Thank you for your response.

I am not able to find the corresponding concepts in the C++ SDK.

I had to guess the offsets to use by trial and error.

Robert at ID-Tasker
Legend
December 21, 2024

It should be there. 

 

If you have to "move" objects on the left page - this means that your Ruler Origin is set to Spine.

 

But can't understand how width of the page affects vertical position? Are your Pages rotated?