Author Topic: ManagedMapAPI.dll load assembly problem  (Read 6506 times)

0 Members and 1 Guest are viewing this topic.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ManagedMapAPI.dll load assembly problem
« Reply #15 on: July 21, 2011, 08:27:04 AM »
If you look the dll's from the SDK they are nothing but empty methods.
Basiclly just the definition
They stripped out guts and left all you needed for your code to reference it and compile.

From SDK
Code: [Select]
[TypeDescriptionProvider("Autodesk.AutoCAD.ComponentModel.TypeDescriptionProvider`1[[Autodesk.AutoCAD.DatabaseServices.Line, acdbmgd]], acdbmgd")]
[Wrapper("AcDbLine")]
public class Line : Curve
{
[UnitType(UnitType.Angle)]
public double Angle
{
get
{
}
}

public Vector3d Delta
{
get
{
}
}

public Point3d EndPoint
{
get
{
}
set
{
}
}

[UnitType(UnitType.Distance)]
public double Length
{
get
{
}
}

public Vector3d Normal
{
get
{
}
set
{
}
}

public Point3d StartPoint
{
get
{
}
set
{
}
}

[UnitType(UnitType.Distance)]
public double Thickness
{
get
{
}
set
{
}
}

public Line(Point3d pointer1, Point3d pointer2)
{
}

public Line()
{
}

protected internal Line(IntPtr unmanagedObjPtr, bool autoDelete)
{
}

internal AcDbLine* GetImpObj()
{
}
}


From AutoDesk Folder it messed up but you get the idea
Code: [Select]
// Type: Autodesk.AutoCAD.DatabaseServices.Line
// Assembly: Acdbmgd, Version=18.2.0.0, Culture=neutral, PublicKeyToken=null
// Assembly location: C:\Program Files\Autodesk\AutoCAD MEP 2012\acdbmgd.dll

using \u003CCppImplementationDetails\u003E;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Autodesk.AutoCAD.DatabaseServices
{
  [Wrapper("AcDbLine")]
  [TypeDescriptionProvider("Autodesk.AutoCAD.ComponentModel.TypeDescriptionProvider`1[[Autodesk.AutoCAD.DatabaseServices.Line, acdbmgd]], acdbmgd")]
  public class Line : Curve
  {
    [UnitType(UnitType.Distance)]
    public double Length
    {
      [Category("Geometry")] get
      {
        AcGePoint3d acGePoint3d1;
        AcGePoint3d acGePoint3d2;
        return \u003CModule\u003E.AcGePoint3d\u002EdistanceTo(\u003CModule\u003E.AcDbLine\u002EstartPoint(this.GetImpObj(), &acGePoint3d1), \u003CModule\u003E.AcDbLine\u002EendPoint(this.GetImpObj(), &acGePoint3d2));
      }
    }

    [UnitType(UnitType.Angle)]
    public double Angle
    {
      [Category("Geometry")] get
      {
        AcGePoint3d acGePoint3d1;
        \u003CModule\u003E.AcDbLine\u002EstartPoint(this.GetImpObj(), &acGePoint3d1);
        AcGePoint3d acGePoint3d2;
        \u003CModule\u003E.AcDbLine\u002EendPoint(this.GetImpObj(), &acGePoint3d2);
        \u0024ArrayType\u0024\u0024\u0024BY02N arrayTypeBy02N1;
        ^(double&) @arrayTypeBy02N1 = ^(double&) @acGePoint3d1;
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 8) = ^(double&) ((IntPtr) &acGePoint3d1 + 8);
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 16) = ^(double&) ((IntPtr) &acGePoint3d1 + 16);
        \u0024ArrayType\u0024\u0024\u0024BY02N arrayTypeBy02N2;
        ^(double&) @arrayTypeBy02N2 = ^(double&) @acGePoint3d2;
        ^(double&) ((IntPtr) &arrayTypeBy02N2 + 8) = ^(double&) ((IntPtr) &acGePoint3d2 + 8);
        ^(double&) ((IntPtr) &arrayTypeBy02N2 + 16) = ^(double&) ((IntPtr) &acGePoint3d2 + 16);
        return \u003CModule\u003E.acutAngle((double*) &arrayTypeBy02N1, (double*) &arrayTypeBy02N2);
      }
    }

    public Vector3d Delta
    {
      [Category("Geometry")] get
      {
        AcGePoint3d acGePoint3d1;
        \u003CModule\u003E.AcDbLine\u002EendPoint(this.GetImpObj(), &acGePoint3d1);
        \u0024ArrayType\u0024\u0024\u0024BY02N arrayTypeBy02N1;
        ^(double&) @arrayTypeBy02N1 = ^(double&) @acGePoint3d1;
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 8) = ^(double&) ((IntPtr) &acGePoint3d1 + 8);
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 16) = ^(double&) ((IntPtr) &acGePoint3d1 + 16);
        \u0024ArrayType\u0024\u0024\u0024BY02N arrayTypeBy02N2;
        \u003CModule\u003E.acdbWcs2Ucs((double*) &arrayTypeBy02N1, (double*) &arrayTypeBy02N2, false);
        AcGePoint3d acGePoint3d2;
        AcGePoint3d* acGePoint3dPtr = \u003CModule\u003E.AcDbLine\u002EstartPoint(this.GetImpObj(), &acGePoint3d2);
        __memcpy(@acGePoint3d1, (IntPtr) acGePoint3dPtr, 24);
        ^(double&) @arrayTypeBy02N1 = ^(double&) @acGePoint3d1;
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 8) = ^(double&) ((IntPtr) &acGePoint3d1 + 8);
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 16) = ^(double&) ((IntPtr) &acGePoint3d1 + 16);
        \u0024ArrayType\u0024\u0024\u0024BY02N arrayTypeBy02N3;
        \u003CModule\u003E.acdbWcs2Ucs((double*) &arrayTypeBy02N1, (double*) &arrayTypeBy02N3, false);
        ^(double&) @arrayTypeBy02N1 = ^(double&) @arrayTypeBy02N2 - ^(double&) @arrayTypeBy02N3;
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 8) = ^(double&) ((IntPtr) &arrayTypeBy02N2 + 8) - ^(double&) ((IntPtr) &arrayTypeBy02N3 + 8);
        ^(double&) ((IntPtr) &arrayTypeBy02N1 + 16) = ^(double&) ((IntPtr) &arrayTypeBy02N2 + 16) - ^(double&) ((IntPtr) &arrayTypeBy02N3 + 16);
        return new Vector3d(^(double&) @arrayTypeBy02N1, ^(double&) ((IntPtr) &arrayTypeBy02N1 + 8), ^(double&) ((IntPtr) &arrayTypeBy02N1 + 16));
      }
    }

    public Vector3d Normal
    {
      [Category("Geometry")] get
      {
        AcGeVector3d acGeVector3d;
        return new Vector3d(\u003CModule\u003E.AcDbLine\u002Enormal(this.GetImpObj(), &acGeVector3d));
      }
      set
      {
        int num = (int) \u003CModule\u003E.AcDbLine\u002EsetNormal(this.GetImpObj(), (AcGeVector3d*) (int) &param0);
        if (num != 0)
          throw new Autodesk.AutoCAD.Runtime.Exception((ErrorStatus) num);
      }
    }

    [UnitType(UnitType.Distance)]
    public double Thickness
    {
      [Category("General")] get
      {
        return \u003CModule\u003E.AcDbLine\u002Ethickness(this.GetImpObj());
      }
      set
      {
        int num = (int) \u003CModule\u003E.AcDbLine\u002EsetThickness(this.GetImpObj(), param0);
        if (num != 0)
          throw new Autodesk.AutoCAD.Runtime.Exception((ErrorStatus) num);
      }
    }

    public override Point3d EndPoint
    {
      [Category("Geometry")] get
      {
        return base.EndPoint;
      }
      set
      {
        int num = (int) \u003CModule\u003E.AcDbLine\u002EsetEndPoint(this.GetImpObj(), (AcGePoint3d*) (int) &param0);
        if (num != 0)
          throw new Autodesk.AutoCAD.Runtime.Exception((ErrorStatus) num);
      }
    }

    public override Point3d StartPoint
    {
      [Category("Geometry")] get
      {
        return base.StartPoint;
      }
      set
      {
        int num = (int) \u003CModule\u003E.AcDbLine\u002EsetStartPoint(this.GetImpObj(), (AcGePoint3d*) (int) &param0);
        if (num != 0)
          throw new Autodesk.AutoCAD.Runtime.Exception((ErrorStatus) num);
      }
    }

    public Line(Point3d pointer1, Point3d pointer2)
    {
      void* voidPtr = \u003CModule\u003E.AcHeapOperators\u002EallocRawMem(8U);
      AcDbLine* acDbLinePtr1 = (AcDbLine*) voidPtr;
      AcDbLine* acDbLinePtr2;
      // ISSUE: fault handler
      try
      {
        acDbLinePtr2 = \u003CModule\u003E.AcDbLine\u002E\u007Bctor\u007D((AcDbLine*) voidPtr, (AcGePoint3d*) (int) &pointer1, (AcGePoint3d*) (int) &pointer2);
      }
      __fault
      {
        // ISSUE: method pointer
        // ISSUE: cast to a function pointer type
        \u003CModule\u003E.___CxxCallUnwindDelDtor((__FnPtr<void (void*)>) __methodptr(AcHeapOperators\u002Edelete), (void*) acDbLinePtr1);
      }
      // ISSUE: explicit constructor call
      base.\u002Ector((IntPtr) ((void*) acDbLinePtr2), true);
    }

    public Line()
    {
      void* voidPtr = \u003CModule\u003E.AcHeapOperators\u002EallocRawMem(8U);
      AcDbLine* acDbLinePtr1 = (AcDbLine*) voidPtr;
      AcDbLine* acDbLinePtr2;
      // ISSUE: fault handler
      try
      {
        acDbLinePtr2 = \u003CModule\u003E.AcDbLine\u002E\u007Bctor\u007D((AcDbLine*) voidPtr);
      }
      __fault
      {
        // ISSUE: method pointer
        // ISSUE: cast to a function pointer type
        \u003CModule\u003E.___CxxCallUnwindDelDtor((__FnPtr<void (void*)>) __methodptr(AcHeapOperators\u002Edelete), (void*) acDbLinePtr1);
      }
      // ISSUE: explicit constructor call
      base.\u002Ector((IntPtr) ((void*) acDbLinePtr2), true);
    }

    protected internal Line(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete)
      : base(unmanagedObjPtr, autoDelete)
    {
    }

    internal unsafe AcDbLine* GetImpObj()
    {
      return (AcDbLine*) base.GetImpObj();
    }
  }
}


BillZndl

  • Guest
Re: ManagedMapAPI.dll load assembly problem
« Reply #16 on: July 21, 2011, 10:00:33 AM »
Hmm, interesting...

The OP was talking about an already compiled assembly and I was thinking his problems were similar to what I experienced when netloading a project that I had updated from VS2005.
I was actually having multiple problems with compiler warnings, netloading problems and system security settings.
http://www.theswamp.org/index.php?topic=38392.msg436738#msg436738
http://forums.autodesk.com/t5/NET/Netload-giving-trouble/m-p/3049974#M23872

Again, as a beginner/part time programmer, I searched the web and by substituting the SDK files mentioned when building the project,
switching back to 3.5 net and adding the loadfromremotelocations switch to the acad.exe.config file took care of things i was having trouble with.

In the future I'll just keep my mouth shut and read the replies but then I do learn something everytime whether good or bad.  :laugh:


« Last Edit: July 21, 2011, 01:54:46 PM by BillZndl »

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ManagedMapAPI.dll load assembly problem
« Reply #17 on: July 21, 2011, 10:20:00 AM »
He was saying a new API.

You can build a application with 2008 or 2005 and load it 2012 but you cannot use the dll's for 2012 since they are built with a newer version of .NET.