Fit to selected art - each object in own artboard

Explorer ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

Hey
I have 3 selected objects
Each with its own artboard

I'm looking for a script that will change any artboard
According to the selected object

Right now - if I use the standard command - "fit to selected art" it creates one artboard
For all objects together.

TOPICS
Scripting

Views

237

Likes

translate

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 3 Correct Answers

Enthusiast , Mar 06, 2021 Mar 06, 2021
What about —? for (var i = 0; i < app.activeDocument.artboards.length; i++) { var AB = app.activeDocument.artboards[i]; var ABR = AB.artboardRect; for (var j = 0; j < app.activeDocument.selection.length; j++) { var SGB = app.activeDocument.selection[j].geometricBounds; if ((SGB[2] > ABR[0] && SGB[0] < ABR[2]) && (SGB[3] < ABR[1] && SGB[1] > ABR[3])) { AB.artboardRect = SGB; } } } 

Likes

translate

Translate

Translate
Enthusiast , Mar 07, 2021 Mar 07, 2021
I am unsure what you are asking.  This will change pathItem strokes to none. for (var i = 0; i < app.activeDocument.pathItems.length; i++) { app.activeDocument.pathItems[i].stroked = false; } 

Likes

translate

Translate

Translate
Adobe Community Professional , Mar 09, 2021 Mar 09, 2021
var curItem,length = app.activeDocument.pathItems.length; for (var i = 0; i < length; i++) { curItem = app.activeDocument.pathItems[i]; if(curItem.stroked && curItem.strokeColor.spot && curItem.strokeColor.spot.name === "CutContour") { curItem.stroked = false; } }

Likes

translate

Translate

Translate
Enthusiast ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    var AB = app.activeDocument.artboards[i];
    var ABR = AB.artboardRect;
    for (var j = 0; j < app.activeDocument.selection.length; j++) {
        var SGB = app.activeDocument.selection[j].geometricBounds;
        if ((SGB[0] > ABR[0] && SGB[2] < ABR[2]) && (SGB[1] < ABR[1] && SGB[3] > ABR[3])) {
            AB.artboardRect = SGB;
        }
    }
}

Likes

translate

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
Explorer ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

Hi, thanks, but please take a look at this file at this link:

 

https://www.dropbox.com/s/beww7kxbdnb99wq/chealk.pdf?dl=0

 


Choose the 3 squares with the pink contour,
And try running the script.
It does not work the way I should.

 

Thanks!

Likes

translate

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
Enthusiast ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

What about —?

 

for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    var AB = app.activeDocument.artboards[i];
    var ABR = AB.artboardRect;
    for (var j = 0; j < app.activeDocument.selection.length; j++) {
        var SGB = app.activeDocument.selection[j].geometricBounds;
        if ((SGB[2] > ABR[0] && SGB[0] < ABR[2]) && (SGB[3] < ABR[1] && SGB[1] > ABR[3])) {
            AB.artboardRect = SGB;
        }
    }
}

 

Likes

translate

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
Explorer ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

Hey
If you've already helped me,
I'm enclosing an end of what I wanted.
Attach a file, I need a script that will select all the contour lines and make them none.

 

https://www.dropbox.com/s/uqmqi0sh1fk58i2/ch.pdf?dl=0

 

 

Likes

translate

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
Explorer ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

Thanks a lot!

Likes

translate

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
Enthusiast ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

I am unsure what you are asking.  This will change pathItem strokes to none.

 

for (var i = 0; i < app.activeDocument.pathItems.length; i++) {
    app.activeDocument.pathItems[i].stroked = false;
}

 

Likes

translate

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
Explorer ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

It removes my contour from the whole document
I only need removal of the
CutCOntour

Likes

translate

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
Explorer ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

I.e. only the contour of a spot color called "cutcontour"

Likes

translate

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 Professional ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

var curItem,length = app.activeDocument.pathItems.length;
for (var i = 0; i < length; i++) {
    curItem = app.activeDocument.pathItems[i];
    if(curItem.stroked
        && curItem.strokeColor.spot 
        && curItem.strokeColor.spot.name === "CutContour")
    {
        curItem.stroked = false;
    }
        
}

Likes

translate

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