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

Can we take placed assets geometric Bounds

Community Beginner ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

I placed assets from library in document. After that i want to move that item, i am getting object textframe from placed assets, so i am trying to take geometricbounds but I can't. why?

 

 

var labItemTFObj=labItem.placeAsset(activeDoc);
var TFBounds=labItemTFObj.geometricBounds;
var halfHieghtOfTF=(TFBounds[2]-TFBounds[0])/2;
labItemTFObj.geometricBounds=[(MarginBottom-halfHieghtOfTF),(TFBounds[1]+2),TFBounds[2],(MarginLeft+2)];

 

 

[moved to indesign based on user's message history]

Views

1.2K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Apr 03, 2020 Apr 03, 2020

Hi Manikandand34755096,

 

look into DOM documentation for method placeAsset().

What it will return is always an array. Why an array? Because an asset could contain many objects that are not grouped! Because of that the array's lengths could be 1, containing one item, or greater than one, containing many items.

 

If you want to pick the first one:

var TFBounds=labItemTFObj[0].geometricBounds;

But wait. Who says, that this object has geometricBounds ?

Also check this with e.g.:

var TFBounds;
if( l
...

Votes

Translate

Translate
Adobe Employee ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

Manikandand34755096, what Adobe application is your question in relation too?

Votes

Translate

Translate

Report

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 ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

I think it needs to be

var TFBounds=labItemTFObj[0].geometricBounds;

Votes

Translate

Translate

Report

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 ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

Hi Manikandand34755096,

 

look into DOM documentation for method placeAsset().

What it will return is always an array. Why an array? Because an asset could contain many objects that are not grouped! Because of that the array's lengths could be 1, containing one item, or greater than one, containing many items.

 

If you want to pick the first one:

var TFBounds=labItemTFObj[0].geometricBounds;

But wait. Who says, that this object has geometricBounds ?

Also check this with e.g.:

var TFBounds;
if( labItemTFObj[0].hasOwnProperty("geometricBounds"))
{
	TFBounds = abItemTFObj[0].geometricBounds;
}else{ /* alert the user and stop the script*/ };

 If you wonder what object could be an asset and has no geometricBounds, then think of Guides.

 

Hm…

All this said: DOM documentation is not clear about what actually is returned by method placeAsset():

The older docu says Array of any is returned, the newer one is saying Varies. Strange.

 

http://jongware.mit.edu/idcs6js/pc_Asset.html#placeAsset

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

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

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 Beginner ,
Apr 10, 2020 Apr 10, 2020

Copy link to clipboard

Copied

LATEST

thanks ... its working and also thanks for your superb explaination ...

Votes

Translate

Translate

Report

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