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

AcDbRasterImage and lazzing loading...

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
211 Views, 2 Replies

AcDbRasterImage and lazzing loading...

Hi,
I am having problems using AcDbRasterImage.
The user select images to load.
So I have a loop where an image is loaded at each step.
But AutoCAD don´t make any memory verification, so Autocad CRASH when
memory available finish.
I tried to check my memory available inside my loop and skip the loop when
memory finish, but AcDbRasterImageDef::load is a lazzing and images is
loaded when my command finish.

Anyone have any solution???

Thanks,
Aragao
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

It's difficult to tell you what's happen without source code. Please, publish it.
Message 3 of 3
Anonymous
in reply to: Anonymous

Hi,

My code is something like that:

 

Acad
size=2>::ErrorStatus

CSgAcImageFactory
size=2>::attachImage(const std::vector<CSgString>&
vecImgFileName
)

{

   
Acad
::
color=#808080>ErrorStatus

color=#808080>es

size=2>;

   
//load Imagem

   
CSgString

color=#808080>strImageFileName

face=Arial size=2>;

   
CSgString

color=#808080>strImageFileNamePath
=
color=#ff0000>"c:\\image"

face=Arial size=2>;

   
AcGePoint3d

color=#808080>ptImgMin
,
color=#808080>ptImgMax

size=2>;

   
AcDbObjectId

color=#808080>idImageDef
,
color=#808080>idImageEntity

face=Arial size=2>;

   
std
::vector
color=#000000><
CSgString
color=#000000>>::
iterator
color=#000000>
iteratorVec
=
vecImgFileName
color=#000000>.
begin

color=#000000>();
   
while
(
color=#808080>iteratorVec
!=
color=#808080>vecImgFileName
.
color=#880000>end

size=2>())

    {   

   
    if
(
color=#880000>acedUsrBrk
())
color=#0000ff>break

size=2>;

   
    //Check de Memoria para carga de
imagens

   
    MEMORYSTATUS

color=#808080>ms

size=2>;

   
    ms
.
color=#808080>dwLength
=
color=#0000ff>sizeof
(
color=#808080>ms

size=2>);

   
    LONG

color=#808080>totalMem
,
color=#808080>availableMem

face=Arial size=2>;


color=#880000>      
GlobalMemoryStatus
(&
color=#808080>ms

size=2>);

   
    totalMem
=
color=#808080>ms
.
color=#808080>dwTotalPageFile

face=Arial size=2>;

   
    availableMem
=
color=#808080>ms
.
color=#808080>dwAvailPageFile

face=Arial size=2>;

   
    acutPrintf
(
color=#ff0000>"\nTotal Memory = %ld"
,
color=#808080>totalMem

size=2>);

   
    acutPrintf
(
color=#ff0000>"\nAvailable Memory = %ld"
,
availableMem

color=#000000>);
   
    // if available memory < 10% Total Memory,
exit

   
    if
(
color=#808080>availableMem
< (
color=#808080>totalMem

size=2>100.0)*10)

       
{

   
        acutPrintf

color=#000000>(
"\nOut of
Memory!!!"

size=2>);

   
        break

face=Arial size=2>;

       
}

   
    //Get Image File Name

   
    strImageFileName
= (*
color=#808080>iteratorVec

face=Arial size=2>);

   
    //create Image Definition

color=#000000>
   
    //This function call AcDbRasterImageDef::load, but this
image

   
    //is not load until my command finish. So my memory check
will not

   
    //work because my memory size doesn´t change inside this
loop.

   
    if
((
color=#808080>es
=
color=#880000>createAcDbRasterImageDef
(
color=#808080>idImageDef
,
color=#808080>strImageFileName

face=Arial size=2>,

   
    strImageFileNamePath
,
color=#808080>pImageDict
)) !=
color=#0000ff>Acad
::
color=#a000a0>eOk

size=2>)

       
{

   
    continue

size=2>;

       
}

   
    //Create Image Entity

   
    AcGeVector3d

color=#808080>vec
=
color=#808080>ptImgMax
-
color=#808080>ptImgMin

size=2>;

   
    es
=
color=#880000>createAcDbRasterImage
(
color=#808080>idImageDef
,
color=#808080>ptImgMin
,
color=#0000ff>AcGeVector3d
(
color=#808080>vec
.
color=#808080>x

size=2>, 0, 0),

   
    AcGeVector3d
(0,
color=#808080>vec
.
color=#808080>y
, 0),
color=#808080>idImageEntity

face=Arial size=2>);

   
    //create Image Reactor

color=#000000>
   
    AcDbObjectId

color=#808080>idImageReactor

face=Arial size=2>;

   
    if
(
color=#808080>es
==
color=#0000ff>Sag
::
color=#a000a0>eOk
)
color=#880000>createAcDbRasterImageDefReactor

color=#000000>(
idImageDef,
idImageEntity,
idImageReactor

color=#000000>);
    }

   
pImageDict
->
color=#880000>close

size=2>();

   
return
Acad
color=#000000>::
eOk

color=#000000>;
}

 

Thanks,

Aragao


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
It's
difficult to tell you what's happen without source code. Please, publish
it.

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

Post to forums  

Autodesk Design & Make Report

”Boost