Menu

Arrays in Arrays as COM Parameters

2012-07-04
2013-05-20
  • Sebastian Heinrich

    Hello guys

    I'm in the situation that I have to adapt the following line of VB Code to Java
    oDefinitionManager.AddMaterial Array("NAME:stinkt", "CoordinateSystemType:=",  _
      "Cylindrical", Array("NAME:AttachedData"), Array("NAME:ModifierData"))

    oDefinitionManager is then in Java with JACOB an ActiveXComponent and must pass String arrays in arrays.
    I tried somethind like this
    String var = {
                    { "NAME:Material2" },
                    { "dielectric_loss_tangent:=" }, { "44" },
                    new String { "NAME:saturation_mag", "property_type:=", "AnisoProperty", "unit:=", "Gauss", "component1:=", "11", "component2:=",
                    "22", "component3:=", "33" },
                    { "delta_H:=" }, { "44Oe" } };
    and some variations of it with Object and Variants but none of it worked. I tried it with
    Dispatch.invokeSub(defMgr, "AddMaterial", Dispatch.Method, var, new int); and
    Dispatch.call(defMgr, "AddMaterial",  var);

    Does anybody tried to pass Arguments to a COM-Method that are arrays in arrays ?
    Is it possible to map the VB Code (which, by the way works fine) to Java using JACOB ?

    I hope this forum isn't already dead and someone finds the time to help me.

    Best regards

     
  • Sebastian Heinrich

    Hi again

    I have now a solution to the problem above. Found it with try and error :

             String str1 = new String { { "NAME:saturation_mag" }, { "property_type:=" }, { "AnisoProperty" }, { "unit:=" }, { "Gauss" },
                                { "component1:=" }, { "11" }, { "component2:=" }, { "22" }, { "component3:=" }, { "33" } };
                        String str2 = new String { "delta_H:=" };
                       String str3 = new String { "44Oe" };
                        Object var1 = {
                                { "NAME:Material2" },
                                { "dielectric_loss_tangent:=" },
                                { "44" }, str2, str3,
                                { str1 }
                                };

    No I have the problem that I want to do the same with an Array(Array(Array…))) structure. Until now the "try and error"-"System" did'nt leads to a working solution. Therefore I would really appreciate your help.

    Thanks so far

    Best regards

    Sebastian

     

Log in to post a comment.