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

Custom object property is not show in ACAD Property Inspector

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
tuankm01
1081 Views, 8 Replies

Custom object property is not show in ACAD Property Inspector

Hello,
I have create some custom object for ACad. It is work fine, I can manipulate it's data via ARX module.
Now I want to adding ability of manipupate object data via ACAD object property inspector. I have create a COM wrapper object, it is working, I can access the object data via VBA. I have try a lot but can not expose it's property via ACAD's Object Property Inspector.
I here by include these header of the COM Wrapper object, please help me to solve that.
Thank a lot.

 

 

#pragma once
#include "resource.h"
#include "dynprops.h"
#include "axtempl.h"
#include "tchar.h"
#include "iSSWrapper.h"

#define DISPID_TEXTSTRING 0x00000001

//----- CKMTRBMarkWP
class ATL_NO_VTABLE CKMTRBMarkWP :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CKMTRBMarkWP, &CLSID_KMTRBMarkWP>,
public ISupportErrorInfo,
public IOPMPropertyExtensionImpl<CKMTRBMarkWP>,
public IOPMPropertyExpander,
public IAcadEntityDispatchImpl<CKMTRBMarkWP, &CLSID_KMTRBMarkWP, IKMTRBMarkWP, &IID_IKMTRBMarkWP, &LIBID_KMTiSSWrapperLib>
//- Please do not remove the following line. It is here to make the Visual Studio ATL Wizards
//- running properly. The class will not compile but is required by Visual Studio to recognize
//- this class as being an ATL class
//- Uncomment the following line when you want to use the ATL Wizards to add a member or method
//- to its interface.
//,public IDispatchImpl<Ighfghgfh, &IID_IIghfghgfh, &LIBID_adskArxProject1Lib>
{
public:
CKMTRBMarkWP () {
}

DECLARE_REGISTRY_RESOURCEID(IDR_KMTRBMARKWP)
DECLARE_NOT_AGGREGATABLE(CKMTRBMarkWP)

BEGIN_COM_MAP(CKMTRBMarkWP)
COM_INTERFACE_ENTRY(IKMTRBMarkWP)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IOPMPropertyExtension)
COM_INTERFACE_ENTRY(ICategorizeProperties)
COM_INTERFACE_ENTRY(IPerPropertyBrowsing)
COM_INTERFACE_ENTRY(IOPMPropertyExpander)
COM_INTERFACE_ENTRY(IAcadBaseObject)
COM_INTERFACE_ENTRY(IAcadBaseObject2)
COM_INTERFACE_ENTRY(IAcadObject)
COM_INTERFACE_ENTRY(IAcadEntity)
COM_INTERFACE_ENTRY(IRetrieveApplication)
END_COM_MAP()

//----- ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct () {
return (S_OK) ;
}

void FinalRelease () {
}

//IAcadBaseObjectImpl
virtual HRESULT CreateNewObject (AcDbObjectId &objId, AcDbObjectId &ownerId, TCHAR *keyName);
//IAcadBaseObject2Impl
STDMETHOD(ForceDbResident)(VARIANT_BOOL *forceDbResident) ;
STDMETHOD(CreateObject)(AcDbObjectId ownerId =AcDbObjectId::kNull, TCHAR *keyName =NULL);
STDMETHOD(AddToDb)(AcDbObjectId &objId, AcDbObjectId ownerId =AcDbObjectId::kNull, TCHAR *keyName =NULL);

//IOPMPropertyExtension
BEGIN_OPMPROP_MAP()
//----- Use the OPMPROP_ENTRY/OPMPROP_CAT_ENTRY macros for each of your properties
OPMPROP_ENTRY(0, 0x00000001, PROPCAT_Text, 0, 0, 0, _T(""), 0, 1, IID_NULL, IID_NULL, "")
END_OPMPROP_MAP()
//IOPMPropertyExtensionImpl
virtual HINSTANCE GetResourceInstance () {
HINSTANCE hi = _AtlBaseModule.GetResourceInstance();
HINSTANCE dllHi = _hdllInstance;
return hi;
}


//IOPMPropertyExpander
STDMETHOD(GetElementValue)(/*[in]*/DISPID dispID, /*[in]*/DWORD dwCookie, /*[out]*/VARIANT *pVarOut);
STDMETHOD(SetElementValue)(/*[in]*/DISPID dispID, /*[in]*/DWORD dwCookie, /*[in]*/VARIANT VarIn);
STDMETHOD(GetElementStrings)(/*[in]*/DISPID dispID, /*[out]*/OPMLPOLESTR __RPC_FAR *pCaStringsOut, /*[out]*/OPMDWORD __RPC_FAR *pCaCookiesOut);
STDMETHOD(GetElementGrouping)(/*[in]*/DISPID dispID, /*[out]*/short *groupingNumber);
STDMETHOD(GetGroupCount)(/*[in]*/DISPID dispID, /*[out]*/long *nGroupCnt);

public:
//IKMTRBMarkWP
STDMETHOD(get_BarNumber)(/*[out, retval]*/ BSTR* pVal);
STDMETHOD(put_BarNumber)(/*[in]*/ BSTR newVal);
} ;

OBJECT_ENTRY_AUTO(__uuidof(KMTRBMarkWP), CKMTRBMarkWP)

Kieu Minh Tuan
------------------------------------
DCL & LSP Generator Tools
https://sites.google.com/site/dclgen/
dclgenerator@gmail.com
8 REPLIES 8
Message 2 of 9
owenwengerd
in reply to: tuankm01

What do you do to test your code, what do you expect to happen, and what actually happens?

--
Owen Wengerd
ManuSoft
Message 3 of 9
tuankm01
in reply to: tuankm01

I have succesfully compile the project into dbx and arx and succesfully load into acad. The custom is also create and draw as i expect. The only problem is it's property is not show in the object inspector of acad although I have create Com Wrapper with the header file as attached above.
Thanks.
Kieu Minh Tuan
------------------------------------
DCL & LSP Generator Tools
https://sites.google.com/site/dclgen/
dclgenerator@gmail.com
Message 4 of 9
owenwengerd
in reply to: tuankm01

You're more likely to get help if you provide detailed answers to the three questions I asked.

--
Owen Wengerd
ManuSoft
Message 5 of 9
tuankm01
in reply to: owenwengerd

Dear Owen,

Thank you very much for your concerning.

1. I have load the files into Autocad (dbx and arx), I have create the custom object by my command.

2. I wish that the custom object property is show in Autocad property inspector, in this case is bar number property.

3. Currently the property only modify by arx code or via COM in VBA IDE.

Please refer to my attcahed image for more information

Thank you very much,

 

cad.png

Kieu Minh Tuan
------------------------------------
DCL & LSP Generator Tools
https://sites.google.com/site/dclgen/
dclgenerator@gmail.com
Message 6 of 9
owenwengerd
in reply to: tuankm01

From your screen shot, it looks like you clicked the cursor on the entity. That step is important for someone to understand the problem. One possible reason for your issue is that your COM class is not properly registered. Have you performed that step?

--
Owen Wengerd
ManuSoft
Message 7 of 9
tuankm01
in reply to: owenwengerd

Dear Owen,

Thanks for your keen to help. I think the COM module is already self register. I can reference the COM object in the VBA IDE and change the BarNumber property (which I want to show in the Autocad Property Inspector but it not) from this.

Please refer to the attached.

 

VBA.png

 

Regards,

Kieu Minh Tuan
------------------------------------
DCL & LSP Generator Tools
https://sites.google.com/site/dclgen/
dclgenerator@gmail.com
Message 8 of 9
owenwengerd
in reply to: tuankm01

It sounds like you are not sure whether your module is registered. Try registering your COM module manually (use regsvr32) to see if that resolves your problem.

--
Owen Wengerd
ManuSoft
Message 9 of 9
tuankm01
in reply to: owenwengerd

Dear Owen,

After checking my code again, I found that I have not point the object classid in the subGetClassID function to the COM object class id. After correct it work perfectly.

Thank for your help.

Regards,

Kieu Minh Tuan
------------------------------------
DCL & LSP Generator Tools
https://sites.google.com/site/dclgen/
dclgenerator@gmail.com

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

Post to forums  

Autodesk Design & Make Report

”Boost