Skip to main content
Participant
January 2, 2025
Question

Why are the geometric bounds not right?

  • January 2, 2025
  • 3 replies
  • 291 views
var r  = app.activeDocument.rectangles.add({geometricBounds[".5in",".25in","2.5in","1.25in"]});

 

When I run this it's placing the item at X: 0.2431in, Y: 1.4931in. Can anyone confirm they get the same behaviour? And if you're in the know, could someone explain to me how something so unambiguous as 4 geometric points is being interpreted so strangely?

3 replies

Participant
January 2, 2025

I got the issue. Sorry folks my script wasn't actually accurate - I was missing a color. But even with the colon it persisted. The issue was that it's aligning to the stroke - so the .0069 inches out was because the stroke is 1pt, therefore it's offsetting by half, to center the stroke on the origin point. 

Thanks for trying!

Robert at ID-Tasker
Legend
January 2, 2025

That was my point - screenshot would show the stroke and the mismatch.

 

Participant
January 2, 2025

OK?

Robert at ID-Tasker
Legend
January 2, 2025

How do you check those values? 

 

What are the params for the stroke? 

 

Can you post a screenshot of this item and what is InDesign showing in the Control Panel?

 

Participant
January 2, 2025

Not necessary - thanks for jumping in. To answe though, for example it was showing the X: value as '1.2431' if I set it in 1.25. It's an alignment setting I wasn't aware of (the story of my InDesign scripting life).

m1b
Community Expert
Community Expert
January 2, 2025

Hi @kurtis_7676 in the parameter for Rectangles.add you've omitted the colon after "geometricBounds" so it is probably using whatever default bounds are.

- Mark