2 Replies Latest reply on Oct 2, 2017 11:21 AM by JKasper

    Paths with custom attributes and output

    JKasper Level 1

      Hi,

       

      I'm currently working on a plug-in using the Illustrator CC 2017 SDK.

       

      I want a click-and-point behavior like the pen tool, as well as some additional behavior and attributes.

      As of now I have played with the "Tutorial Line Tool" located in the SDK. The additional behavior I want is:

      1. Close a path when you click on the first placed anchor(like how pen tool does)

      2. Expand a path. That is, if you have a existing path, and would like to draw further on it. One important note is that I require the path to be closed. (Is this even possible with the pen tool?)

      3. Custom color to each anchor

      4. Produce a custom output/artwork (a mesh-like structure)

       

      I have considered several approaches, but is unsure what is the best (or even if I have the best approach).

      For point 1 and 2 I'm considering to take the artwork that the pen tool produce, and tweak it as necessary (with the PathfinderSuite and PathConstructionSuite)

      For point 3 and 4 I'm currently quite blank. I have considered the ForeignObjectSuite, or to convert the result to a mesh using the MeshSuite as the output from my plugin will be a cubic mesh.

       

      Any suggestions of the best approach would be much appreciated. Thank you. 

        • 1. Re: Paths with custom attributes and output
          A. Patterson Level 4

          There's no way to assign colours to vertices in Illustrator (technically, there aren't even vertices, there are just segments), at least not in a permanent way. If you're content for the colour to persist through the UI only, that can be achieved via annotations (see AIAnnotation.h). In a nutshell, you'd have to draw whatever you want over top of the vertices in question. Alternately, you could make your paths into kPluginArt, which divides the rendering from the interaction, so you could theoretically draw whatever you want using AI artwork for the rendering (thus colouring the art). That comes with a price however; there's a lot of work involved in kPluginArt. We have several uses of it,and it can be quite powerful, but there are a lot of things to work through.

           

          Given #4, maybe the latter is the best option? It sounds like you want this to finish as some sort of artwork structure?

          1 person found this helpful
          • 2. Re: Paths with custom attributes and output
            JKasper Level 1

            Thanks for your reply.

            I'll definitively check that out.

             

            I'll save the "vertices" in a custom data structure for later use (face creation and eventually rendering) so an annotation might be a possible solution.

             

            Given #4, maybe the latter is the best option? It sounds like you want this to finish as some sort of artwork structure?

            If I go for the kPluginArt it may be easier to add a new file format (AIFileFormatSuite) since I can customize the rendering, and thus I'm not limited to the methods the MeshSuite provides.