ObjectARX 关闭光栅图片的边框

作者: admin 分类: C++,CAD,ObjectARX 发布时间: 2021-01-15 00:01
// second parameter is 0 for current database.
AcDbRasterVariables * pRasterVariables = AcDbRasterVariables::openRasterVariables(AcDb::kForWrite, 0); 
pRasterVariables->setImageFrame(AcDbRasterVariables::FrameSettings::kImageFrameOff); 
pRasterVariables->close();

This is frustrating. I can read raster varaibles just fine but any attempt to
change them crashes AutoCAD. Would you mind taking a look at this? acdbCurDb()
is a function I wrote to return the database of the active document.
lockdocument() locks the active document using the kAutoWrite parameter.

The get_ImageFrame works perfectly. The put_ImageFrame crashes AutoCAD without
fail. What am I doing wrong?

STDMETHODIMP CAcadRasterVariables::get_ImageFrame(vbxFrameSettings *pVal)
{
HRESULT hReturn = S_OK;

AcDbRasterVariables* pImageVars =
AcDbRasterVariables::openRasterVariables(AcDb::kForRead, acdbCurDb());
*pVal = (vbxFrameSettings)pImageVars->imageFrame();
return hReturn;
}

STDMETHODIMP CAcadRasterVariables::put_ImageFrame(vbxFrameSettings newVal)
{
HRESULT hReturn = S_OK;

if (lockDocument() != Acad::eOk)
hReturn = ReportError("Could not lock document.", E_ACCESSDENIED);
{
AcDbRasterVariables* pImageVars =
AcDbRasterVariables::openRasterVariables(AcDb::kForWrite, acdbCurDb());
if(pImageVars->setImageFrame((AcDbRasterVariables::FrameSettings)newVal) !=
Acad::eOk)
hReturn = ReportError("Could not change frame property.", E_FAIL);
}

return hReturn;
}


http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/objectarx-acdbrastervariables/td-p/899216

输入imageframe命令,将参数值改为0;

20171123081917_19231.png

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

标签云