How to encapsulate this function: mdlKISolid_makeSweptBody into C# formal properly ?

Hi, everyone, I want to use this function: mdlKISolid_makeSweptBody in my C#/Addin project. It is an undisclosed function, its declaration in my pure mdl project is below:

extern int mdlKISolid_makeSweptBody
(
KIBODY **ppBody, /* <= swept body */
KIBODY *pProfile, /* => either wire or sheet */
KIBODY *pPath, /* => must be wire */
KIVERTEX *pPathStart, /* => path starting vertex */
KIVERTEX *pStart, /* => for twist and scale control */
KIVERTEX *pEnd, /* => for twist and scale control */
double startTwist, /* => twist angle at start in radian */
double endTwist, /* => twist angle at end in radian */
double startScale, /* => scale at start */
double endScale, /* => scale at end */
int topologyForm, /* => 0: minimal, 1: column, 2: grid */
BoolInt normalAlignment, /* => TRUE: normal, FALSE: parallel */
BoolInt simplify /* => TRUE: yes, FALSE: no */
);

When I call this function in my pure mdl project , it works very well. In my C# project , althrough it works, it is not controllable, for the second parameter of the countdown.

The declaration of this function in my C#/Addins project is like this:

[DllImport("kisolid.dll")]
public static extern int mdlKISolid_makeSweptBody(ref int bodyPP, int profileP, int pathP,
object pPathStart, object pStart, object pEnd, double startTwist, double endTwist, double startScale, double endScale,
short topologyForm, bool normalAlignment, bool simplify);

In my dgn file, there are two elements, the Curve element represents the path, the Ellipse element represents the profile,

The result processed by my pure mdl project is like this:

But the result in my C# project is like this:

I know that I should give a wrong declaration for this function in my C# project, result in  the second parameter of the countdown doesn't work. 

My pure mdl project is below, whick contains the dgn file.

TestSweepCurveProblem.rar

Anyone who can help me?

Parents
  • Hi, everyone, I solved the problem, this function should be declared like this:

    [DllImport("kisolid.dll")]
    public static extern int mdlKISolid_makeSweptBody(ref int bodyPP, int profileP, int pathP,
    int pPathStart, int pStart, int pEnd, double startTwist, double endTwist, double startScale, double endScale,
    int topologyForm, int normalAlignment, int simplify);

    Thanks to Jan slegr again!

    study forever

Reply
  • Hi, everyone, I solved the problem, this function should be declared like this:

    [DllImport("kisolid.dll")]
    public static extern int mdlKISolid_makeSweptBody(ref int bodyPP, int profileP, int pathP,
    int pPathStart, int pStart, int pEnd, double startTwist, double endTwist, double startScale, double endScale,
    int topologyForm, int normalAlignment, int simplify);

    Thanks to Jan slegr again!

    study forever

Children