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

Invalid Argument exception

Community Beginner ,
Jun 28, 2013 Jun 28, 2013

Hi,

Am trying to send commands to the Illustrator from C#. I can create a new document, draw some simple paths/objects, copy/paste things. But when I try to do anything with the Group/Page Items like changing their position or size I get "Invalid Argument exception".

There is no C# scripting reference, so I use Visual Basic one. And it worked well for simpliest things.

Please tell me what is wrong with this code:

illustrDoc.GroupItems[0].Top = 1.0;

illustrDoc.GroupItems[0].PathItems[0].Top = 1.0;

illustrDoc.Layers[0].PathItems[0].Top = 1.0;

double scale = 10.0;

illustrDoc.GroupItems[0].Resize(scale, scale, true, true, true, true, scale, Illustrator.AiTransformation.aiTransformCenter);

All the lines listed above (except "double scale = 10.0;", of course) generate the same exception. That is wierd.

All the layers/groups/items are unlocked and visible.

Thank you.

TOPICS
Scripting
883
Translate
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

correct answers 1 Correct answer

Community Expert , Jun 28, 2013 Jun 28, 2013

I don't know about C#, but visual basic uses parenthesis instead of brackets, and the object arrays are 1 based...so, to access the first group, in visual basic you need to write it like this

illustrDoc.GroupItems(1).Top = 1.0;

Translate
Adobe
Community Expert ,
Jun 28, 2013 Jun 28, 2013

I don't know about C#, but visual basic uses parenthesis instead of brackets, and the object arrays are 1 based...so, to access the first group, in visual basic you need to write it like this

illustrDoc.GroupItems(1).Top = 1.0;

Translate
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 ,
Jun 29, 2013 Jun 29, 2013
LATEST

Thank you Carlos, that helped. The array starts from 1, not from 0. This is non-standard and strange, but works.

Translate
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