.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawable wrapper?

1 REPLY 1
Reply
Message 1 of 2
mbujak
463 Views, 1 Reply

Drawable wrapper?

I have a custom AcGiDrawable entity that I want to wrap in .Net. All this is done and compiles fine but when I try to instance the object I get the message "Cannot create an instance of the abstract class or interface '....'.

 

Any ideas why this would be an issue. I have several custom entities (derived from AcDbEntity and AcDbObject) that aren't a problem, but for this one, problems arise.

 

#pragma once

#include "mgdinterop.h"
#include "..\InForm.Dbx\ReferenceIndicator.h"

using namespace System;
using namespace Autodesk::AutoCAD::DatabaseServices;
using namespace Autodesk::AutoCAD::Runtime;
using namespace Autodesk::AutoCAD::Geometry;
using namespace Autodesk::AutoCAD::GraphicsInterface;
using namespace Autodesk::AutoCAD::GraphicsSystem;
using namespace inform::dbx;

namespace aag = Autodesk::AutoCAD::GraphicsInterface;
namespace gs = Autodesk::AutoCAD::GraphicsSystem;

namespace InForm { namespace Dbx { namespace Net 
{
	[Autodesk::AutoCAD::Runtime::Wrapper("ReferenceIndicator")]
	public ref class ReferenceIndicatorWrapper : aag::Drawable
	{
#pragma region " Constructor "
		public:
			ReferenceIndicatorWrapper(void);
			ReferenceIndicatorWrapper(System::IntPtr ent, bool autoDel);
#pragma endregion

#pragma region " Internal Object "
	private:
		inline inform::dbx::ReferenceIndicator* GetInternalObject()
		{
			return static_cast<inform::dbx::ReferenceIndicator*>(UnmanagedObject.ToPointer());
		}
#pragma endregion

#pragma region " Public Methods "
		public:
			void Initialize(gs::View^ v, gs::Model^ m)
			{
				inform::dbx::ReferenceIndicator* p = GetInternalObject();
				if(p)
				{
					AcGsView* view = static_cast<AcGsView*>(v->UnmanagedObject.ToPointer());
					AcGsModel* model = static_cast<AcGsModel*>(m->UnmanagedObject.ToPointer());

					p->Initialize(view, model);
				}
			}
#pragma endregion
	};
}}}

 

 

#include "stdafx.h"
#include "ReferenceIndicatorWrapper.h"

using namespace InForm::Dbx::Net;

ReferenceIndicatorWrapper::ReferenceIndicatorWrapper(void)
	: aag::Drawable((System::IntPtr)new inform::dbx::ReferenceIndicator(), true)
{
}

ReferenceIndicatorWrapper::ReferenceIndicatorWrapper(System::IntPtr ent, bool autoDel)
	: aag::Drawable(ent, autoDel)
{
}

 

1 REPLY 1
Message 2 of 2
DiningPhilosopher
in reply to: mbujak

Just guessing, but it looks like the managed runtime is trying to create an instance of the base type (Drawable), which is abstract.  I assume you've derived from an AcRxClass* and have implemented AcMgObjectFactory and that you're calling rxinit() 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost