Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Why are the geometric bounds not right?

New Here ,
Jan 02, 2025 Jan 02, 2025
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?

TOPICS
Scripting
279
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2025 Jan 02, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2025 Jan 02, 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?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2025 Jan 02, 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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2025 Jan 02, 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2025 Jan 02, 2025

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2025 Jan 02, 2025
LATEST

OK?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines