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

Implementing arrowheads in a line

Community Beginner ,
Aug 29, 2024 Aug 29, 2024

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

TOPICS
How-to , SDK

Views

165

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
Guide ,
Aug 29, 2024 Aug 29, 2024

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.

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
Guide ,
Aug 29, 2024 Aug 29, 2024

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.

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 Beginner ,
Aug 29, 2024 Aug 29, 2024

Copy link to clipboard

Copied

LATEST

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

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