The reason why looking into orexxole is a problem with an AutoCAD method/function that expects a
single dimensioned array with three elements (double, R8).
No matter what I try, even forcing manual fixed R8 typed values for that array does not yield in
success. The error that AutoCAD raises (in this case for the addCircle(point,radius) is 80070057
("The Parameter is incorrect."). The types orexxole creates look correct:
...
arrived in addCircle, space: an OLEObject
addCircle(), center:
center: (1000.1,2000.1,3000.1)
addCircle(), radius:
radius: 50.0
orexxole.cpp # 2276 ArrayClass2SafeArray: <--- VarArray: type=[VT_EMPTY]
value=[VT_EMPTY]
orexxole.cpp # 2284 ArrayClass2SafeArray: <--- VarArray: type=[VT_ARRAY
VT_VARIANT] value=[VT_ARRAY VT_VARIANT]
orexxole.cpp # 2084 Rexx2Variant: R8 -> [VT_R8 -> 1000,1] | val=[1000.100000]
orexxole.cpp # 2084 Rexx2Variant: R8 -> [VT_R8 -> 2000,1] | val=[2000.100000]
orexxole.cpp # 2084 Rexx2Variant: R8 -> [VT_R8 -> 3000,1] | val=[3000.100000]
orexxole.cpp # 2344 ArrayClass2SafeArray: <--- VarArray: type=[VT_ARRAY
VT_VARIANT] value=[VT_ARRAY VT_VARIANT]
orexxole.cpp # 2121 Rexx2Variant: R8 -> [VT_R8 -> 50] | val=[50.000000]
addCircle(): syntax error raised ...
SYNTAX, line: 160 code: 92.906 OLE error. msg: OLE exception: Code: 80070057 Source:
unavailable Description: unavailable (80070057 "The parameter is incorrect.").
*-* Compiled method "UNKNOWN" with scope "OLEObject".
160 *-* res=space~addCircle(center,radius)
29 *-* res=addCircle(space,center,radius)
...
The array should be o.k., its three values for the center point are all of type R8. Still, AutoCAD
issues the "Parameter wrong" error.
Also forcefully setting to VT_ARRAY,VT_R8 (must be currently done by hardcoding this in
orexxole.cpp) does not change the error.
Not being really familiar with the COM/OLE datatypes, I am currently lost,
hence requesting help.
---rony
P.S.: orexxole.cpp array handling works, e.g. using a two-dimensional Rexx array with titles
(strings) and values (numbers) for assigning them in one step in Excel ("range~value=rexx2dimArray)
works. E.g. an example transcribed from Perl (at the end):
--
2022-05-29:<https://www.mail-archive.com/[email protected]&q=subject:%22Win32%5C%3A%5C%3AOLE%22&o=newest&f=1>
excel = .OleObject~new("Excel.Application")
excel~visible = .true
book = excel~workbooks~add
sheet = book~worksheets(1)
range = sheet~range("A2:C7")
-- array of arrays will get transformed to an ooRexx 2-dim array by the
routine to2dim()
range~value=to2dim( (("Delivered", "En route", "To be shipped"), -
( 104, 102, 86) , -
( 670, 150, 174) , -
( 891, 261, 201) , -
(1274, 471, 321) , -
(1563, 536, 241)) )
chart = excel~charts~add
chart~chartType = excel~getConstant("xlAreaStacked")
plotBy = excel~getConstant("xlColumns")
chart~setSourceData(range, plotBy)
chart~hasTitle = .true
::routine to2dim -- transform an ooRexx array of arrays into a 2-dimensional
ooRexx array
use arg arr
newArr=.array~new(0,0) -- create 2-dimensional array
do counter c1 with item o1 over arr
do counter c2 o2 over o1
newArr[c1,c2]=o2
end
end
return newArr
/*
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
my $Excel = Win32::OLE-new(Excel.Application);
$Excel-{Visible} = 1;
$Win32::OLE::Warn = 3;
my $Book = $Excel-Workbooks-Add;
my $Sheet = $Book-Worksheets(1);
my $Range = $Sheet-Range(A2:C7);
$Range-{Value} =
[['Delivered', 'En route', 'To be shipped'],
[504, 102, 86],
[670, 150, 174],
[891, 261, 201],
[1274, 471, 321],
[1563, 536, 241]];
my $Chart = $Excel-Charts-Add;
$Chart-{ChartType} = xlAreaStacked;
$Chart-SetSourceData({Source = $Range, PlotBy = xlColumns});
$Chart-{HasTitle} = 1;
___
*/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel