how to make Array variable type as vbscript Array in order to transfer to a Adobe Illustrator Application?
1 次查看(过去 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 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!