ObjectARX, AutoCAD. Среда программирования библиотеки C++



         

Категоризировать свойства - часть 2


//Used for property expansion (currently variant types)

//

STDMETHOD(GetElementGrouping)(

/* [in] */ DISPID dispID,

/* [out] */ short *groupingNumber) ;

// Used for property expansion (currently variant types)

//

STDMETHOD(GetGroupCount)(

/* [in] */ DISPID dispID,

/* [out] */ long *nGroupCnt) ;

STDMETHOD(GetPredefinedStrings)(

/* [in] */ DISPID dispID,

/* [out] */ CALPOLESTR *pCaStringsOut,

/* [out] */ CADWORD *pCaCookiesOut);

STDMETHOD(GetPredefinedValue)(

/* [in] */ DISPID dispID,

/* [out] */ DWORD dwCookie,

/* [out] */ VARIANT *pVarOut);

7 Добавляют выполнение для функции в CPP исходном файле. Эти примеры - для объекта AsdkSquare:

STDMETHODIMP CAsdkSquareWrapper::GetElementValue(

/* [in] */ DISPID dispID,

/* [in] */ DWORD dwCookie,

/* [out] */ VARIANT * pVarOut)

{

if (pVarOut == NULL)

return E_POINTER;

AcDbObjectPointer<AsdkSquare> pSq(m_objId, AcDb::kForRead);

if (pSq.openStatus() != Acad::eOk)

return E_ACCESSDENIED;

if (dispID == 0x03) {

AcGePoint3d acgePt;

pSq->squareCenter(acgePt);

AcAxPoint3d acaxPt(acgePt);

::VariantCopy(pVarOut,&CComVariant(acaxPt[dwCookie]));

}

return S_OK;

}

STDMETHODIMP CAsdkSquareWrapper::SetElementValue(

/* [in] */ DISPID dispID,

/* [in] */ DWORD dwCookie,

/* [in] */ VARIANT VarIn)

{

AcDbObjectPointer<AsdkSquare> pSq(m_objId, AcDb::kForRead);

if (pSq.openStatus() != Acad::eOk)

return E_ACCESSDENIED;

if (dispID == 0x03) {

AcGePoint3d acgePt;

pSq->squareCenter(acgePt);

AcAxPoint3d acaxPt(acgePt);

acaxPt[dwCookie] = V_R8(&VarIn);

pSq->upgradeOpen();

pSq->setSquareCenter(acaxPt);

}

return S_OK;

}

STDMETHODIMP CAsdkSquareWrapper::GetElementStrings(

/* [in] */ DISPID dispID,

/* [out] */ OPMLPOLESTR __RPC_FAR *pCaStringsOut,

/* [out] */ OPMDWORD __RPC_FAR *pCaCookiesOut)

{

if (dispID == 0x03)

{

long size;

size = 3;

pCaStringsOut->pElems =

(LPOLESTR *)::CoTaskMemAlloc(sizeof(LPOLESTR) * size);

pCaCookiesOut->pElems =




Содержание  Назад  Вперед