ObjectARX

ObjectARX

Reply
Active Member
masterhe3000
Posts: 10
Registered: ‎06-01-2009
Message 1 of 5 (287 Views)
Accepted Solution

How to display sub-entity's properties in Property Palette?

287 Views, 4 Replies
09-11-2012 06:07 AM

How to display sub-entity's properties in Property Palette? I had tryed to run SubEntity sample in autocad2007/8/9,but Property Palette can't display the properties of the sub-entity selected.

Thanks a lot!

Hi,

 

Sorry for the delay.

I was searching for a fixed version of that sample and finally found it. Thanks to my colleague Gopinath Taget who got this sample working with help from the engineering team.

 

Here are the changes and the sample project :

 

<<<<

The key is to inherit from IAcadSubEntity in the IDL file for your interface:

 

interface ICrank : IAcadSubEntity

 

And in the implementation header, Inherit from the IAcadBaseSubEntityImpl and IOPMPropertyExtensionImpl templates like this:

 

//----- CCrank

class ATL_NO_VTABLE CCrank :

public CComObjectRootEx<CComSingleThreadModel>,

public CComCoClass<CCrank, &CLSID_Crank>,

public ISupportErrorInfo,

public IAcadBaseSubEntityImpl<CCrank, &CLSID_Crank, ICrank, &IID_ICrank, &LIBID_AsdkSliderCrankDbLib>,

public IOPMPropertyExtensionImpl<CCrank>

 

Also make sure that the inherted templates are properly mapped like this:

 

BEGIN_COM_MAP(CCrank)

COM_INTERFACE_ENTRY(ICrank)

COM_INTERFACE_ENTRY(IDispatch)

COM_INTERFACE_ENTRY(ISupportErrorInfo)

COM_INTERFACE_ENTRY(IConnectionPointContainer)

COM_INTERFACE_ENTRY(IRetrieveApplication)

COM_INTERFACE_ENTRY(IAcadSubEntity)

COM_INTERFACE_ENTRY(IAcadBaseSubEntity)

COM_INTERFACE_ENTRY(IOPMPropertyExtension)

END_COM_MAP()

 

Finally, implement the GetResourceInstance and GetDisplayName methods of the IOpmPropertyExtension/IOpmPropertyExtensionImpl interfaces like this:

 

virtual HINSTANCE GetResourceInstance()

{

HINSTANCE hi = _AtlBaseModule.GetResourceInstance();

HINSTANCE dllHi = _hdllInstance;

return hi;

}

 

STDMETHODIMP GetDisplayName(

DISPID dispID,

BSTR *pBstr)

{

if (dispID == 0x401) { // magic dispID meaning object itself

if (pBstr==NULL)

return E_POINTER;

*pBstr = ::smileyfrustrated:ysAllocString(L"TheCrank");

return S_OK;

}

return IOPMPropertyExtensionImpl<CCrank>::GetDisplayName(

dispID, pBstr);

}

 

The proper implementation of GetDisplayName method is vital for the subentity OPM to work.

 

I am attaching the sample with these modifications to the Crank subentity. Similar modifications need to be made to the other sub entities as well.

>>>>

 

 

 

 

 

ADN Support Specialist
Balaji_Ram
Posts: 715
Registered: ‎03-21-2011
Message 2 of 5 (274 Views)

Re: How to display sub-entity's properties in Property Palette?

09-14-2012 07:51 AM in reply to: masterhe3000

Sorry, This is a known issue.

To my understanding, the sample was not fixed.



Balaji
Developer Technical Services
Autodesk Developer Network

Active Member
masterhe3000
Posts: 10
Registered: ‎06-01-2009
Message 3 of 5 (267 Views)

Re: How to display sub-entity's properties in Property Palette?

09-14-2012 07:58 PM in reply to: Balaji_Ram

Thanks for you reply.

Can you tell me the other method to display sub-entity's properties in Property Palette?

ADN Support Specialist
Balaji_Ram
Posts: 715
Registered: ‎03-21-2011
Message 4 of 5 (251 Views)

Re: How to display sub-entity's properties in Property Palette?

09-17-2012 11:58 PM in reply to: masterhe3000

Hi,

 

Sorry for the delay.

I was searching for a fixed version of that sample and finally found it. Thanks to my colleague Gopinath Taget who got this sample working with help from the engineering team.

 

Here are the changes and the sample project :

 

<<<<

The key is to inherit from IAcadSubEntity in the IDL file for your interface:

 

interface ICrank : IAcadSubEntity

 

And in the implementation header, Inherit from the IAcadBaseSubEntityImpl and IOPMPropertyExtensionImpl templates like this:

 

//----- CCrank

class ATL_NO_VTABLE CCrank :

public CComObjectRootEx<CComSingleThreadModel>,

public CComCoClass<CCrank, &CLSID_Crank>,

public ISupportErrorInfo,

public IAcadBaseSubEntityImpl<CCrank, &CLSID_Crank, ICrank, &IID_ICrank, &LIBID_AsdkSliderCrankDbLib>,

public IOPMPropertyExtensionImpl<CCrank>

 

Also make sure that the inherted templates are properly mapped like this:

 

BEGIN_COM_MAP(CCrank)

COM_INTERFACE_ENTRY(ICrank)

COM_INTERFACE_ENTRY(IDispatch)

COM_INTERFACE_ENTRY(ISupportErrorInfo)

COM_INTERFACE_ENTRY(IConnectionPointContainer)

COM_INTERFACE_ENTRY(IRetrieveApplication)

COM_INTERFACE_ENTRY(IAcadSubEntity)

COM_INTERFACE_ENTRY(IAcadBaseSubEntity)

COM_INTERFACE_ENTRY(IOPMPropertyExtension)

END_COM_MAP()

 

Finally, implement the GetResourceInstance and GetDisplayName methods of the IOpmPropertyExtension/IOpmPropertyExtensionImpl interfaces like this:

 

virtual HINSTANCE GetResourceInstance()

{

HINSTANCE hi = _AtlBaseModule.GetResourceInstance();

HINSTANCE dllHi = _hdllInstance;

return hi;

}

 

STDMETHODIMP GetDisplayName(

DISPID dispID,

BSTR *pBstr)

{

if (dispID == 0x401) { // magic dispID meaning object itself

if (pBstr==NULL)

return E_POINTER;

*pBstr = ::smileyfrustrated:ysAllocString(L"TheCrank");

return S_OK;

}

return IOPMPropertyExtensionImpl<CCrank>::GetDisplayName(

dispID, pBstr);

}

 

The proper implementation of GetDisplayName method is vital for the subentity OPM to work.

 

I am attaching the sample with these modifications to the Crank subentity. Similar modifications need to be made to the other sub entities as well.

>>>>

 

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Active Member
masterhe3000
Posts: 10
Registered: ‎06-01-2009
Message 5 of 5 (245 Views)

Re: How to display sub-entity's properties in Property Palette?

09-18-2012 01:59 AM in reply to: Balaji_Ram

Your code has resolved my question.

Thanks a lot.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.