how to make Array variable type as vbscript Array in order to transfer to a Adobe Illustrator Application?
조회 수: 5 (최근 30일)
이전 댓글 표시
I want to draw a triangle in adobe illustrator via COM server:
aAI = actxserver('Illustrator.application');
aAI.Documents.Add;
aGrp = aAI.ActiveDocument.GroupItems.Add;
aPath = aGrp.PathItems.Add;
% error appeared here when transfer the coordinate of vertices of a triangle by many ways:
aPath.SetEntirePath([100,100,100,304,23,334])
aPath.SetEntirePath({100,100;100,304;23,334;})
aPath.SetEntirePath({100,100,100,304,23,334;})
aPath.SetEntirePath({100;100;100;304;23;334;})
aPath.SetEntirePath({[100,100;100,304;23,334;]})
aPath.SetEntirePath([100,100;100,304;23,334;])
aPath.SetEntirePath([100,100;100,304;23,334;]')
Error using Interface.Adobe_Illustrator_CC_Type_Library.PathItem/SetEntirePath
Invoke Error, Dispatch Exception:
Source: Adobe Illustrator
Description: Illegal argument - argument 1
- Only arrays with dimension 1 are supported
The working vbs code is :
aPath.SetEntirePath Array( Array(100,100), Array(123,1224), Array(456,66) )
A similar issue has been solved in python, but not matlab.
But I cannot find a way to solve it.
Unsupported Types ---MATLAB does not support the following COM types.
---Structure
---Sparse array
---_ Multidimensional SAFEARRAYs (greater than two dimensions)_ ( But this array is a 2-dimension array, not more than two. )
---Write-only properties
See Also
https://uk.mathworks.com/matlabcentral/answers/92424-how-can-i-pass-arguments-to-an-activex-server-from-matlab-7-0-r14-as-one-dimensional-arrays
https://uk.mathworks.com/matlabcentral/answers/94888-how-can-i-pass-arguments-by-reference-to-an-activex-server-from-matlab-7-0-r14
https://uk.mathworks.com/help/matlab/matlab_external/handling-com-data-in-matlab-software.html#bq553lb
댓글 수: 0
답변 (1개)
Guillaume
2018년 10월 31일
편집: Guillaume
2018년 10월 31일
It looks like SetEntirePath expects a 1D array of 1D arrays. In theory that would be a cell array of vectors in matlab, so:
aPath.SetEntirePath({[100, 100], [100, 304], [23, 334]})
Is that function documented somewhere (accesible publicly) to know for sure what it expects?
edit: As per your first answer link, you may need to first issue:
feature('COM_SafeArraySingleDim', 1);
to force matlab to pass the arrays as 1D.
댓글 수: 2
Guillaume
2018년 10월 31일
Even after you've issued
feature('COM_SafeArraySingleDim', 1)
?
I'm asking for the documentation because array of [x,y] coordinate pairs is not a COM type. It's. Hopefully, the documentation would state exactly what COM type it expects (SAFEARRAY of SAFEARRAY of VARIANT ?)
참고 항목
카테고리
Help Center 및 File Exchange에서 COM Component Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!