Valued Contributor
Posts: 53
Registered: ‎07-07-2004
Message 1 of 2 (205 Views)

Drawable wrapper?

205 Views, 1 Replies
01-18-2013 06:58 AM

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 
	public ref class ReferenceIndicatorWrapper : aag::Drawable
#pragma region " Constructor "
			ReferenceIndicatorWrapper(System::IntPtr ent, bool autoDel);
#pragma endregion

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

#pragma region " Public Methods "
			void Initialize(gs::View^ v, gs::Model^ m)
				inform::dbx::ReferenceIndicator* p = GetInternalObject();
					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;

	: aag::Drawable((System::IntPtr)new inform::dbx::ReferenceIndicator(), true)

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


Valued Mentor
Posts: 370
Registered: ‎05-06-2012
Message 2 of 2 (178 Views)

Re: Drawable wrapper?

01-20-2013 01:56 AM 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() 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!