Skip to main content
Silly-V
Legend
April 26, 2022
Answered

LiveEffect XML effect is added under the object.

  • April 26, 2022
  • 4 replies
  • 2241 views

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.

This topic has been closed for replies.
Correct answer sttk3

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) ;

4 replies

sttk3Correct answer
Legend
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="DisplayString" value="Add" valueType="S"/></Dict></LiveEffect>' ;
  
app.documents[0].selection[0].applyEffect(effectAdd) ;
Silly-V
Silly-VAuthor
Legend
May 15, 2022

Whaaat! 🤯

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

Kurt Gold
Community Expert
Community Expert
April 27, 2022

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

 

Silly-V
Silly-VAuthor
Legend
April 28, 2022

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.

 

Kurt Gold
Community Expert
Community Expert
April 28, 2022

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.

 

CarlosCanto
Community Expert
Community Expert
April 26, 2022

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

Silly-V
Silly-VAuthor
Legend
April 26, 2022

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

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

 

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.

CarlosCanto
Community Expert
Community Expert
April 27, 2022

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');

 

m1b
Community Expert
Community Expert
April 26, 2022

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