Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ObjectARX: AcDbRasterVariables

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
371 Views, 8 Replies

ObjectARX: AcDbRasterVariables

What is the proper way to access the RasterVariables object for the active
document?

This?:
AcDbRasterVariables* pImageVars =
AcDbRasterVariables::openRasterVariables(AcDb::kForRead);

or this?:

AcDbRasterVariables* pImageVars = NULL;
pImageVars = (AcDbRasterVariables*)(AcDbRasterVariables::desc()->create());

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

I believe you're missing the pointer to the database
in the openRasterVariables function.

Saludos, Jorge Jimenez

Frank Oquendo wrote:

> What is the proper way to access the RasterVariables object for the active
> document?
>
> This?:
> AcDbRasterVariables* pImageVars =
> AcDbRasterVariables::openRasterVariables(AcDb::kForRead);
>
> or this?:
>
> AcDbRasterVariables* pImageVars = NULL;
> pImageVars = (AcDbRasterVariables*)(AcDbRasterVariables::desc()->create());
>
> --
> http://www.acadx.com
> Win a free autographed copy of
> "AutoCAD 2000 VBA Programmer's Reference"
Message 3 of 9
Anonymous
in reply to: Anonymous

Forgot to mention that the openRasterVariables function
creates the RasterVariables object for you, but you
probably already know this.

Saludos, Jorge Jimenez

Jorge Jimenez wrote:

> I believe you're missing the pointer to the database
> in the openRasterVariables function.
>
> Saludos, Jorge Jimenez
>
> Frank Oquendo wrote:
>
>> What is the proper way to access the RasterVariables object for the
>> active
>> document?
>>
>> This?:
>> AcDbRasterVariables* pImageVars =
>> AcDbRasterVariables::openRasterVariables(AcDb::kForRead);
>>
>> or this?:
>>
>> AcDbRasterVariables* pImageVars = NULL;
>> pImageVars =
>> (AcDbRasterVariables*)(AcDbRasterVariables::desc()->create());
>>
>> --
>> http://www.acadx.com
>> Win a free autographed copy of
>> "AutoCAD 2000 VBA Programmer's Reference"
Message 4 of 9
Anonymous
in reply to: Anonymous

According to the documentation and the method signature, ommitting the database
pointer causes the raster variable object to read the database returned by
acdbCurDwg(). Is that not correct?

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

"Jorge Jimenez" wrote in message
news:3ABB9629.3050301@sicad-sa.com...
> Forgot to mention that the openRasterVariables function
> creates the RasterVariables object for you, but you
> probably already know this.
>
> Saludos, Jorge Jimenez
>
> Jorge Jimenez wrote:
>
> > I believe you're missing the pointer to the database
> > in the openRasterVariables function.
> >
> > Saludos, Jorge Jimenez
Message 5 of 9
Anonymous
in reply to: Anonymous

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"
Message 6 of 9
Anonymous
in reply to: Anonymous

I figured it out. You have to call the close method when you're done with the
RasterVariables object.

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"
Message 7 of 9
Anonymous
in reply to: Anonymous

Yes. That's it.
Thank God you got it right, or else you'd be
talking to your self all night long in this NG.
Sorry I couldn't answer you before I just had one heck
of a day.

Saludos, Jorge

Frank Oquendo wrote:

> I figured it out. You have to call the close method when you're done with the
> RasterVariables object.
>
> --
> http://www.acadx.com
> Win a free autographed copy of
> "AutoCAD 2000 VBA Programmer's Reference"
Message 8 of 9
Anonymous
in reply to: Anonymous

In addition, the database argument is not optional contrary to both
the documentation and the header file.

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

"Jorge Jimenez" wrote in message
news:3ABC31AF.7010601@sicad-sa.com...
> Yes. That's it.
> Thank God you got it right, or else you'd be
> talking to your self all night long in this NG.
> Sorry I couldn't answer you before I just had one heck
> of a day.
>
> Saludos, Jorge
Message 9 of 9
Anonymous
in reply to: Anonymous

Yes I know, that's what I told you.

Saludos, Jorge Jimenez

Frank Oquendo wrote:

> In addition, the database argument is not optional contrary to both
> the documentation and the header file.
>
> --
> http://www.acadx.com
> Win a free autographed copy of
> "AutoCAD 2000 VBA Programmer's Reference"
> by Joe Sutphin
>
> "Jorge Jimenez" wrote in message
> news:3ABC31AF.7010601@sicad-sa.com...
>
>> Yes. That's it.
>> Thank God you got it right, or else you'd be
>> talking to your self all night long in this NG.
>> Sorry I couldn't answer you before I just had one heck
>> of a day.
>>
>> Saludos, Jorge

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

Post to forums  

Autodesk Design & Make Report

”Boost