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

LiveEffect XML effect is added under the object.

Valorous Hero ,
Apr 25, 2022 Apr 25, 2022

Copy link to clipboard

Copied

I would like to use actions as little as possible but still use the Pathfinder abilities. It is possible with the live effect XML! Using no actions would make it possible to create a script that could be activated by an action from the File>Scripts menu and some people still like to do these kinds of things.
You know what I found to be so unfortunately prohibitive to my plans? When I tried add pathfinder Add effect, the live effect was put on the bottom of the group, erasing all the fills and strokes. When I expanded style, it all disappeared, leaving behind a rare empty group which can't be selected.

Is there any way to work around it and make the effect apply to the top of the object just as is the UI behavior?

I gave up and just ran an action. Trying to use pathfinder add and expanding style made it a non-starter.
The effect technique is still good for a lot of other effects such as offset path. That one it didn't matter where it goes, and the dropshadow is always good to be on the bottom in most places.
However the Pathfinder add seems to have the behavior of erasing the art fills and strokes when added to the bottom like apply live effect xml command does.

TOPICS
Scripting

Views

1.3K

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 1 Correct answer

Community Expert , May 15, 2022 May 15, 2022

Do you know the attribute isPre of the LiveEffect element?

If you set this value to 1, you can place the effect on above the contents.

 

// Pathfinder Add
var effectAdd = '<LiveEffect index="0" isPre="1" major="1" minor="0" name="Adobe Pathfinder"><Dict data="R TrapTint 0.4 B RemovePoints 0 I Command 0 R TrapThickness 0.25 R Precision 10 B ConvertCustom 1 R Mix 0.5 R TrapAspect 1 B TrapReverse 0 R TrapMaxTint 1 B TrapConvertCustom 0 R TrapTintTolerance 0.05 B ExtractUnpainted 1 "><Entry name="Displ
...

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 25, 2022 Apr 25, 2022

Copy link to clipboard

Copied

Hi @Silly-V, I also would love to know how to apply these effects to a specific "layer of appearance". When I did this project, I made notes of the issues I came across with each Live Effect.

I hoped someone would be able to better reverse engineer the raw file formatting to help with this. I couldn't do it unforunately. 😞

- Mark

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 ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

let me see one of your objects/groups you're having issues with

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
Valorous Hero ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

Here is working as we want, the Add effect is on top.

SillyV_0-1650996171686.png

And here is how the liveeffect method applies the 'Add':

SillyV_1-1650996196487.png

 

It erases the drawing, and when I expand my appearance (cause the color really doesn't matter, I am recoloring it anyways in my script), because all the drawing is gone, the entire shape disappears!



BUT!

I have discovered and again thanks to @m1b , it actually does preserve the geometry, which is fine as I can apply a new color since I'm recoloring it anyway after adding. I was originally under the impression that my expandStyle command had destroyed the invisible shape. However, I now think it must be because I have a flattening process happening sometime after in my script and maybe my art was getting flattened since the fills and strokes were removed.
Well, my art will never have strokes because it will also be pre-flattened, so I guess it's safe to say this isn't such a bad problem for me right now after all.

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

Copy link to clipboard

Copied

I see, I can replicate the issue.

 

I don't know why it behaves like that, but using executeMenuCommand works as it should

 

app.executeMenuCommand('Live Pathfinder Add');

 

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
Valorous Hero ,
May 06, 2022 May 06, 2022

Copy link to clipboard

Copied

I will say, the live commands to seem to work quite well. In fact, @CarlosCanto 's pointing out of this feature being available and has been for a long time, makes my question quite moot.
I am not sure what advantage a live effect would have in my situation now, because I'm just path-finding. However - could it be possible to actually mix up the live effects and live-effect commands which don't produce a dialog to be able to 'hack' the appearance panel further & manipulate the various fills & strokes by applying a live effect added fill or stroke and then doing a live effect command? I don't know, and have no time, but this is on my testing wish list.

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

Copy link to clipboard

Copied

Silly-V,

 

You may consider to use Pathfinder Effect sequences in order to get it to work with effect instances that are located at the bottom of the Appearance palette.

 

You can download an Illustrator file with some examples here:

 

Stacked Pathfinders

 

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
Valorous Hero ,
Apr 27, 2022 Apr 27, 2022

Copy link to clipboard

Copied

Wow thank you @Kurt Gold !
I see that you have figured out some how that Divide when used above the Add will leave the painted art!

I actually tried some other things, but never have thought to do this.

This is great now we can do action-like actions without using Actions, just effects and menuCommand expandStyle.

 

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 ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

About 20 or 25 years ago (Illustrator 9 or 10) Pathfinder Effect sequences allowed you to create some kind of Live Paint (light) with open paths and flexible fills inside their boundaries (it still works in recent Illustrator versions).

 

At that time I provided a lot of examples that showed how beneficial it might be to use them in a more sophisticated environment. I'm not sure, but I think it was at least some kind of idea starter to develop Live Paint as we know it today.

 

Nice to see that it is still useful in other contexts.

 

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 ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

Hi @Kurt Gold, this is great! With your idea to use stacked instances of PathFinder, I have updated my Live Effect Functions project so that Add, Intersect and Subtract (Minus Front) now work! I'm impressed you discovered this. 🙂

- Mark

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 ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

Thanks for reporting this, Mark.

 

Are there some other Pathfinders missing that still do not work with your approach? Perhaps I have another idea, but I cannot promise it.

 

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 ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

Hi Kurt, see in my updated notes—anything that mentions "Issue 1" which is the problem of the live effect being applied in the incorrect "appearance layer order".

- Mark

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 ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

OK, thank you, Mark.

 

That is, three Pathfinder dissenters have to be cured. Let's see if it can 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 ,
May 03, 2022 May 03, 2022

Copy link to clipboard

Copied

Mark, some notes about the Convert to Shape effects ("issue 1"):

 

You are saying that they disable the fill when a stroke is present. I would state it a bit more precisely because actually they disable either the fill or the stroke, depending on the order in the Appearance palette. That is, if the stroke is above the fill, the fill disappears. If the fill attribute is above the stroke, then the stroke disappears.

 

One workaround to solve it would be to first (temporarily) make separate grouped objects out of the single ungrouped objects, then apply the Convert to Shape effects to the separate groups. In that case it doesn't matter if the effect is applied at the top or the bottom of the Appearance palette. Both fills and strokes will remain intact.

 

The same would work with the Tweak effect and "issue 1" wouldn't matter there as well.

 

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

Copy link to clipboard

Copied

As for the Pathfinder effects Exclude and Crop, I'm afraid that I cannot provide a practical workaround at the moment. Of course, you may think that I just don't want to reveal the tricks because I want to conserve some action capabilities that currently are rather difficult to do with scripting, but probably that's not true.

 

When it comes to the Pathfinder effect Minus Back, I'd suggest to first send the topmost path to the bottom of the group (guess this step can be scripted) and then use the Pathfinder effect Subtract instead. The result should be the same in most cases.

 

Finally, I'm not quite sure about your note about the Twist effect. It has always tended to wreck (crumple) the paths, just depending on the actual effect settings. No matter where it is located in the Appearance palette. Apart from that, it is a very old effect that has never been enhanced, as far as I can see. I even doubt that there are many people who actually use it at all. Probably almost no one would even notice if it were removed completely.

 

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 ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

Do you know the attribute isPre of the LiveEffect element?

If you set this value to 1, you can place the effect on above the contents.

 

// Pathfinder Add
var effectAdd = '<LiveEffect index="0" isPre="1" major="1" minor="0" name="Adobe Pathfinder"><Dict data="R TrapTint 0.4 B RemovePoints 0 I Command 0 R TrapThickness 0.25 R Precision 10 B ConvertCustom 1 R Mix 0.5 R TrapAspect 1 B TrapReverse 0 R TrapMaxTint 1 B TrapConvertCustom 0 R TrapTintTolerance 0.05 B ExtractUnpainted 1 "><Entry name="DisplayString" value="Add" valueType="S"/></Dict></LiveEffect>' ;
  
app.documents[0].selection[0].applyEffect(effectAdd) ;

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
Valorous Hero ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

Whaaat! 🤯

That's great! Thanks. Now this will be ultimate control, yea.

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 ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

Excellent, sttk3.

 

A detail that obviously has been overlooked so far.

 

Now my workarounds can be stored in the dustbin. 🙃

 

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 ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

Hey @sttk3 this is awesome! It completely fixes this problem. I have updated my Live Effect functions repo with your contribution. Thank you!

By the way, did you find this gem in documentation somewhere? If so, I would love to read it.

- Mark

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 ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

Hi @m1b. Unfortunately, there is no special document.

 

In this case, it is easier to know the XML structure if we do it like this.

  1. Apply LiveEffect to a group item
  2. Save it as FXG in Illustrator CS6
  3. Open the FXG in a text editor and examine the area around <ai:LiveEffect>

 

I have featured your Live Effect functions and Live Effect Helper in my blog post “[Summary] Illustrator Script Development Documents”. Thank you very much.

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 ,
May 15, 2022 May 15, 2022

Copy link to clipboard

Copied

it may have been my fault, I excluded some of those attributes in the xml string when developing, I only kept the effect name, didn't know at that time they would be of such great value.

 

thanks for posting!

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 ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

LATEST

Yes I took the same approach Carlos. I discarded anything I assumed was extraneous. Oh well. Pretty good result in the end though, with everyone's help. 🙂

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