Copy link to clipboard
Copied
In javascript, I think that there is an interface called pageItem,
In C#, pageItem is missing.
For pageItems, both javascript and C# exist, but ...
When pageitems is looped with foreach, it is treated as object instead of pageitem.
I want to access the property of pageitem.
What should I do?
Illustrator version is CC2017.
Copy link to clipboard
Copied
This is interesting, is there a reference for the C# Illustrator type library?
Are you using VisualStudio to write code and debug the C# in Illustrator?
Copy link to clipboard
Copied
I have no reference.
Add the illustrator COM library from the reference setting in visualstudio,
It is running from C#.
What kind of objects are available, I am doing it while checking with intellisense.
So, the pageItem object can not be found,
I do not know whether it is because it does not exist or just not found.
However, when I ask a question on another forum (in Japan)
If you define it as "dynamic", like pageItem
Since I understood that I can get an object,
Once as a content of this question was resolved.
I'm sorry I did a multipost.
I will post the sample resolution code.
var _illuApp = new Illustrator.Application();
var illuDoc = _illuApp.Open(inFilePath, AiDocumentColorSpace.aiDocumentCMYKColor);
var lay = doc.Layers["layer1"];
var subLays = lay.Layers["sublayer1"];foreach (dynamic pageItem in subLays.PageItems)
{
var piPos = pageItem.Position;
var newPos = new object[2];newPos[0] = piPos[0] + 2.5;
newPos[1] = piPos[1] + 3.0;
pageItem.Position = newPos;
}
Copy link to clipboard
Copied
I would be interested in the output of the "Locals" debug window, it shows the contents of variables, if you look at it while at a breakpoint.
Thank you for posting the solution, as it will surely help anyone else who wants to do C# and use Illustrator as part of a .net application.
Copy link to clipboard
Copied
Silly-V
Is this the debug window you want to see?
By the way, the object at this time is a compound path.
Copy link to clipboard
Copied
Nice, looks cool! I can't read the Japanese, but this data browser appears to be showing all the objects just like the one in ESTK for javascript.