Copy link to clipboard
Copied
Hello
We have been implementing Illustrator plugins since past 7 years. This is the first time we are phasing a problem with the documentation to implement arrowhead for a line!
The line is being drawn using
sAIShapeConstruction->NewLinePoint (oStart, oEnd, poHandle);
and stroke width and other things like colors can be done using AIPathStyles
sAIPathStyle->GetPathStyle(oArtHandle, &oPathStyle, &oAdvFill);
oPathStyle.stroke.width = 0.1 * kPointsPerMM;
sAIPathStyle->SetPathStyle (oArtHandle, &oPathStyle);
However, on both sides of the line, I need to implement arrowheads and I could not find any information in the SDK documentation as to how to implement that!
Can you please help?
Thank you
Musten Jiruwala
Copy link to clipboard
Copied
This is a bit annoying to do, but you basically have to get the path's AIArtStyle, parse it (AIArtStyleParser) get the stroke you want to update and then modify its paint field with the AIBeautifulStrokes::SetArrowheadOptions. The arrow heads themselves are a style you'll have to pull in somehow, and you apply something like this:
error = sAIBeautifulStrokes->SetArrowheadOptions(strokeEffectsDictionary, 0, &arrowHeadStyle, kAIRealUnknown, arrowHeadScale, alignment);
I'd post more code but (a) it's internal code I'm not allowed to share and (b) it's riddled with helper classes I've written to make this tedious code easier to manage. Hopefully that's enough to get you to where you need to be though.
Copy link to clipboard
Copied
The Illustrator AI arrowheads are located in the Required Resources folder, which you can find using the AIFoldersSuite::FindFolder -- the one you want is kAIRequiredLocalizedResourcesFolderType. Once you have that path, it's Arrowheads.ai. You can use AIPathStyleSuite::ImportSytles() to get a document handle to the file, and use that with
AISymbolSuite::GetNthSymbolPatternFromDocument() to load specific arrowheads.
Copy link to clipboard
Copied
Dear Patterson,
Thank you very much for your response. I will work on this and come back to you with the result (positive or negative).
Best regards
Musten