绘自定义实体
[id(191), helpstring("method DrawCustomEntity")] IDispatch* DrawCustomEntity(BSTR pszGuid, BSTR pszBlkRecName);
参数 |
说明 |
BSTR pszGuid |
用来标识自定义实体的id |
BSTR pszBlkRecName |
把自定义实体的加到块表记录的名称,如果为空,就加入到当前空间。 |
返回IMxDrawCustomEntity对象
例如: JS代码
var ent = mxOcx.DrawCustomEntity("TestMxCustomEntity", ""); ent.SetPoint("spt", frstPt); ent.SetPoint("ept", secondPt);
例如: VC COM
void CTestVc2005Dlg::DoCustomEntity() { // TODO: 在此添加控件通知处理程序代码 MxDrawXLib::IMxDrawUiPrPointPtr getPt; getPt.CreateInstance(__uuidof( MxDrawXLib::MxDrawUiPrPoint )); IMxDrawUiPrPoint* pGetPt = getPt; pGetPt->put_message(_T("点取第一点")); if(pGetPt->go() != mcOk) return; IMxDrawPointPtr frstPt = pGetPt->value(); if(frstPt == NULL) return; MxDrawXLib::IMxDrawUiPrPointPtr getSecondPt; getSecondPt.CreateInstance(__uuidof( MxDrawXLib::MxDrawUiPrPoint )); pGetPt = getSecondPt; pGetPt->put_message(_T("点取第二点")); pGetPt->put_basePoint(frstPt); pGetPt->setUseBasePt(VARIANT_TRUE); if(pGetPt->go() != mcOk) return; IMxDrawPointPtr secondPt = pGetPt->value(); if(secondPt == NULL) return; IDispatchPtr spObj(m_ocx.DrawCustomEntity(MX_CUSTOM_ENTITY_ID,NULL),false); CComPtr<IMxDrawCustomEntity> spEntity; spObj->QueryInterface(&spEntity); if(spEntity == NULL) return; spEntity->SetPoint(_T("spt"),frstPt); spEntity->SetPoint(_T("ept"),secondPt); }