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

Apply corner radius using setEntirePath()

Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

How to apply corner radius to shape using setEntirePath()

TOPICS
Scripting

Views

386

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
Guide ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Not possible.  You can't make smooth points with setEntirePath().

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Okay.

Is there any other method to do that in script?

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

setEntirePath() takes care of the Anchor points, after that you'll have to set the Handles of each Anchor. It's quite a bit of Math, but it can technically be done

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Okay thanks.

But "PointType.SMOOTH" not working for me.

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

PointType is ReadOnly, it's used to find out what kind of point we're dealing with, not to change from corner to smooth or viceversa.

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Thank you. But Is it possible to change pointType into

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST
quote

Thank you. But Is it possible to change pointType into


By @Ashu24845488rcnx

 

I'm not sure what you're asking. Can you elaborate?

 

If you mean if it's possible to change a corner point to a smooth point by using the PointType property, no, it's not possible. 

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
Guide ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Here's a roundedRectangle() function with the same syntax as rectangle(), but with an added corner radius argument.

 

// e.g. of function call
roundedRectangle(
    -25 /*top*/, 25 /*left*/, 50 /*w*/, 50 /*h*/, 10 /*cornerRadius*/);

/*
 * roundedRectangle by Femke Blanco
 * Beta 04/08/2022
 */
function roundedRectangle(top, left, w, h, r) {
    var paths = app.activeDocument.pathItems;
    var path1 = paths.add();
    var p;
    var c = r * ((4 / 3) * Math.tan(Math.PI / 8));  // handle length
    // p2
    point(left + r, top, left + r, top, left + r - c, top);
    // p3
    point(left + w - r, top, left + w - r + c, top, left + w - r, top);
    // p4
    point(left + w , top - r, left + w , top - r, left + w , top - r + c);
    // p5
    point(left + w, top - h + r, left + w, top - h + r - c, 
        left + w, top - h + r);
    // p6
    point(left + w - r, top - h, left + w - r, top - h, 
        left + w - r + c, top - h);
    // p7
    point(left + r, top - h, left + r - c, top - h, left + r, top - h);
    // p8
    point(left, top - h + r, left, top - h + r, left, top - h + r - c);
    // p1
    point(left, top - r, left, top - r + c, left, top - r);
    path1.closed = true;
    function point(x, y, Rx, Ry, Lx, Ly) {
        p = path1.pathPoints.add();
        p.anchor = [x, y];
        p.rightDirection = [Rx, Ry];
        p.leftDirection = [Lx, Ly];
    }
}

 

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