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

Resize path!

Engaged ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

Hello! How to resize the active path to document boundaries?

Thank you

Capturar.JPG

TOPICS
Actions and scripting

Views

448

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
Adobe
Community Expert ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

LATEST

Use action manager code to transform the path. It easy to get the documents width and height.  However the Path bounds is a different story.  You will most  likely need that to calculate the vales need to be used with transform.  You can create a selection for the path and get the bounds of that selection. You can get the control points in the path however a path cam be any shape and have many  points.  I would think its the path bounds you need to work from.

The X and y delta of the path center point move to the center of the canvas and the  width and height resize in percentage.

// =======================================================

transform(631, 202.5, 929.166667, 450.520833);

function transform(horizontal, vertical, width, height) {

var descriptor = new ActionDescriptor();

var descriptor2 = new ActionDescriptor();

var reference = new ActionReference();

reference.putEnumerated( stringIDToTypeID( "path" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ));

descriptor.putReference( charIDToTypeID( "null" ), reference );

descriptor.putEnumerated( stringIDToTypeID( "freeTransformCenterState" ), stringIDToTypeID( "quadCenterState" ), stringIDToTypeID( "QCSAverage" ));

descriptor2.putUnitDouble( stringIDToTypeID( "horizontal" ), stringIDToTypeID( "pixelsUnit" ), horizontal );

descriptor2.putUnitDouble( stringIDToTypeID( "vertical" ), stringIDToTypeID( "pixelsUnit" ), vertical );

descriptor.putObject( stringIDToTypeID( "offset" ), stringIDToTypeID( "offset" ), descriptor2 );

descriptor.putUnitDouble( stringIDToTypeID( "width" ), stringIDToTypeID( "percentUnit" ), width );

descriptor.putUnitDouble( stringIDToTypeID( "height" ), stringIDToTypeID( "percentUnit" ), height );

executeAction( stringIDToTypeID( "transform" ), descriptor, DialogModes.NO );

}

That action manager corde was for this transform

JJMack

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