Copy link to clipboard
Copied
Does anyone know where could i find the expand method correponding to function called when "Expand" button is click!
I have played with several method found in AIPathfinder.h or AIExpand.h, but without success.
If someone could gve a tip, it will be great.
Thanks,
Thomas.
Copy link to clipboard
Copied
*is clicked !
Copy link to clipboard
Copied
I'm about 99.9% sure AIExpandSuite::Expand() is the method you want. We use it a fair bit in our stuff and it seems to work. What kind of results are you seeing?
Copy link to clipboard
Copied
I've already tried this method, without success.
After creating compound shapes with pathfinder plugin (user action), i want
to expand this shapes to have only a single path. (with stroke and fill).
result = sAIExpand->Expand(art, kExpandPluginArt,NULL);
aisdk::check_ai_error(result);
as a result, i've got a group with fill and stroke, which has a child (path), with no stroke and fill.
Use i this method in a wrong way?
or should i write a methode to convert this artwork tree to a single path.
I'm pretty sure, this could be completed using this method,
and i do not want to reinvent the wheel.......
thx.
Thomas.
Copy link to clipboard
Copied
in addition, when "Expand" button from pathfinder is clicked, there is a single path as a result.
Copy link to clipboard
Copied
I actually haven't used it for kPluginArt but it works great for graphics styles What do you get when you run the code you posted? I would have thought that expanding kPluginArt should just copy the contents of the Draw Group into its parent kPluginArt's layer and then delete the kPluginArt. Is that not what's happening?
Copy link to clipboard
Copied
I've made some screen shots. This will be easier to understand.
The first image is how is structured a compound shape, using the pathfinder plugin:
The second one is this compound shapes after expanding it, using the Expand button of pathfinder plugin:
And the last one is when i use the Expand suite. (sdk):
What I want, is to have the artwork tree of the seconde image, using the sdk. (ExpandSuite::Expand()).
Thx.
Thomas.
Copy link to clipboard
Copied
It seems I've finally found a solution. May the one I've excepted, but I've got one.
I tried to solve my probleme using the action scripts.
/version 2
/name [ 4
74657374
]
/isOpen 1
/actionCount 2
/action-1 {
/name [ 17
6465636f6d706f5061746846696e646572
]
/keyIndex 0
/colorIndex 0
/isOpen 0
/eventCount 1
/event-1 {
/internalName (ai_expand_compound_shape)
/localizedName [ 30
44c3a9636f6d706f736572206c6120666f726d6520636f6d706f73c3a965
]
/isOpen 0
/isOn 1
/hasDialog 0
/parameterCount 1
/parameter-1 {
/key 2020634212
/showInPalette -1
/type (integer)
/value 0
}
}
}
/action-2 {
/name [ 19
637265617465636f6d706f756e647368617065
]
/keyIndex 0
/colorIndex 0
/isOpen 1
/eventCount 1
/event-1 {
/internalName (ai_make_compound_shape)
/localizedName [ 26
4372c3a9657220756e6520666f726d6520636f6d706f73c3a965
]
/isOpen 0
/isOn 1
/hasDialog 0
/parameterCount 1
/parameter-1 {
/key 1835101029
/showInPalette -1
/type (integer)
/value 0
}
}
}
Then I used the ActionManager suite to play back an already recorded action. (Expand compound shape).
Here is it the test code I've written:
AIErr
AIArtHandleModifier::ExpandathFinder()
{
AIErr result = kNoErr;
AIActionParamValueRef valueParameterBlock = NULL;
ActionDialogStatus dialogStatus = kDialogOn;try
{
result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);
aisdk::check_ai_error(result);if (valueParameterBlock)
{
result = sAIActionManager->AIActionSetInteger(valueParameterBlock, 'xpnd', 0);
aisdk::check_ai_error(result);
result = sAIActionManager->PlayActionEvent("ai_expand_compound_shape", dialogStatus, valueParameterBlock);
aisdk::check_ai_error(result);result = sAIActionManager->AIDeleteActionParamValue(valueParameterBlock);
aisdk::check_ai_error(result);
}
}
catch(ai::Error& ex)
{
result = ex;
}
return result;}
Notice: art to be expanded needs to be selected before the command to be run and ActionDialogStatus must be turned on (Otherwise this will not work fine)
Anyway, if you have a solution in where ActionManager is not used, I'll take it too!
Many thanks,
Thomas.
Copy link to clipboard
Copied
Well, I always say that Actions are a decent fallback They're just annoying to use because of the selected-first stipulation.
Those screenshots are very illuminating. I know that the expansion via SDK always creates a group, but I didn't realize they were putting the stroke & fill on the group. That's good to know. A little annoying; I should see if there's a method somewhere to propogate stroke & fill from a parent to children. Probably not, but not terribly hard to do myself.
I still find it hard to believe that AIExpand.h isn't what the Expand in the menu does. I'm sure we're just not using it quite right. Of course, this is the perfect opportunity for someone from Adobe to swoop in here and help us out, but I'm not sure many (if any) read these forums
Copy link to clipboard
Copied
I still find it hard to believe that AIExpand.h isn't what the Expand in the menu does. I'm sure we're just not using it quite right. Of course, this is the perfect opportunity for someone from Adobe to swoop in here and help us out, but I'm not sure many (if any) read these forums
But i think PathFinder expand command behaves differently from the Expand method of Expand suite.
You're totally right, this will be fine if someonefrom Adobe could give us some tips about that, but i've got some doubts!
For a while, i thought of creating a method to propagate Fill and Stroke from the parent group to children, but this would have been to
complicated to code, for something which may have been already written! so i gave up!
I would had rather find a simplest solution.
Copy link to clipboard
Copied
But i think PathFinder expand command behaves differently from the Expand method of Expand suite.
Probably, but I still think it uses the AIExpandSuite somehow. I've talked with some of the developers on AI and they told me something like 96% of AI is written in the SDK. If you're bored someday, remove the Plug-ins folder and watch how much functionality disappears. You could even try taking out the stuff in Support Files/Required/Plug-ins (though that may cause errors since they're, well, required!).
So I'd bet good money that the PathFinder expand is using AIExandSuite somehow, but naturally that doesn't mean they just use the Expand() call. They could have pages of additional code to do other things. Since their output doesn't come in a group, I'm guessing they are doing at least that much.
Hmmm. I didn't realize this, but at some point they stopped creating kPluginArt with the Pathfinder. When did that happen? CS4? This makes the Pathfinder suite possibly useful.
Copy link to clipboard
Copied
i totally agree with you! But right now I don't find the way they use the Expand suite to do this stuff!
PathFinder plugin acts differently in CS4. After applying an effets, the result object is already expanded. So no need
to do it by yourself.
Copy link to clipboard
Copied
In fact, using the Pathfinder expand command may be the best solution.
We've got the same behavior and the same result.
I've fixed my problem!
Anyway thanks for the help.
Bet regards,
Thomas.
Copy link to clipboard
Copied
You could try AIPathfinderSuite::FlattenArt() function.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now