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

Looking for a script that will convert a live shape to a normal shape.

Participant ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

Hi all,

I'm trying to find a script that will simply convert a "live shape" to a normal shape so I can scale the shape while keeping the corner radius static.

I've looked through this thread and none of the code there worked for me.

My scripting skills are relatively terrible, and I've given up after a few hours of trying to hack together some JSX myself.

Any help would be greatly appreciated.

TOPICS
Actions and scripting

Views

419

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 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

Does it have to be a script?

 

All it takes is adding or removing a single anchor point to a live shape to "degrade" it into a standard shape. 

 

Much easier for a human to decide where to add the additional anchor point so as not to distort the vector.

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
Participant ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

LATEST

Well, I've been using that hack - a variation of it - I just nudge a vertex out and back. I guess I was just hoping there was a script out there that would just eliminate the need for the hack.

R-Bin posted this code that duplicates a selected path:

function dup_to_wrk_path(id) {
    try {
        
        var d = new ActionDescriptor();
        var r = new ActionReference();
        if (id == undefined)             r.putEnumerated(stringIDToTypeID("path"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
        else if (typeof(id) == "string") r.putName( charIDToTypeID( "Path" ), id);
        else                             r.putIdentifier( charIDToTypeID( "Path" ), id);
        
        var path = executeActionGet(r).getObjectValue(stringIDToTypeID("pathContents"));          
        var list = path.getList(stringIDToTypeID("pathComponents"));           
        var r = new ActionReference();
        
        r.putProperty( charIDToTypeID( "Path" ), charIDToTypeID( "WrPt" ) );
        d.putReference( stringIDToTypeID( "null" ), r );
        d.putList(charIDToTypeID("T   "), list);
        executeAction(charIDToTypeID("setd"), d, DialogModes.NO);
        return true;
        
    } catch (e) { 
        alert(e); 
        return false; 
    }
}

 I can successfully get that to work, but I can't figure out the remaining steps of converting the path into a complete shape object.

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