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

Script for Create Shapes from Vector Layer

Community Beginner ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

Good Day All!

I`m trying to write a small script that will create shapes from vector layers, but I cannot seem to find right command for it. Assuming layer is already selected I tried different variations I`ve looked throught internet and this forum

 

1. app.executeCommand(app.findMenuCommandId('Create Shapes from Vector Layer'));

2. app.executeCommand(3781) - plus  I dont really like this option as with each new version these numbers are getting changed sometimes (from what I undersood)

3. I`ve tried few variations of code related to ADBE Vector Shape - Group but none of them seemed to work for me. I believe solution is so close but I just can`t get to it.
4. Some old variations of code found on this forum that do not seem to work anymore


Hoping for your help! 
Many thanks!

TOPICS
Scripting

Views

421

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 ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

Your #1 works fine for me with the vector layer selected.

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 ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

This is some magic as when I posted the question it didn`t work for me, but now it does 🙂
Thanks Dan!

Also what do you think would be good way to identify inside converted layer what is an artboard from illustrator? In order to delete it, even a hint of how to figure out what group or merge path is an artboard.

 

Many thanks!

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 ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

Sorry, I don't know enough about Illustrator docs to be of any help with that.

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 ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

Thanks anyway!

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 12, 2023 Aug 12, 2023

Copy link to clipboard

Copied

Hi @thatboyfromukraine Hope you're doing great, just wondering if you could share your script for this? I've been trying this myself to automate my workflow, but I can't seem to make it work. 

Here's my script so far:

(function() {
    app.beginUndoGroup("Create Shapes from Vector Layers");
    var comp = app.project.activeItem;

    if (comp !== null && comp instanceof CompItem) {
        var selectedLayers = comp.selectedLayers;

        // Step 1: Create shapes from selected vector layers
        for (var i = 0; i < selectedLayers.length; i++) {
            var vectorLayer = selectedLayers[i];
            if (vectorLayer.source instanceof AVLayer && vectorLayer.source instanceof FootageSource && vectorLayer.source.mainSource instanceof PlaceholderSource && vectorLayer.source.mainSource.hasVector) {
                var shapeLayer = comp.layers.addShape();
                shapeLayer.name = "Shape Layer from " + vectorLayer.name;
                var shapeGroup = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
                shapeGroup.name = "Shapes";
                shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Group");
                var shapePath = shapeGroup.property("ADBE Vectors Group").property("ADBE Vector Shape");
                shapePath.setValue(vectorLayer.source.mainSource);
            }
        }
    }

    app.endUndoGroup();
})();

 
I hope you can help me with this, TYIA 🙂

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 14, 2023 Aug 14, 2023

Copy link to clipboard

Copied

LATEST

Oh nevermind, I got it to work now, thanks.

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