custom objects: iterator through modelspace

custom objects: iterator through modelspace

Anonymous
Not applicable
618 Views
4 Replies
Message 1 of 5

custom objects: iterator through modelspace

Anonymous
Not applicable
It seems not to be possible to get an iterator to modelspace from within
a method of a custom object. I always get an undocumented
"Acad::eCreateFailed" when I request the iterator.
I want to do a comparision of my actual custom object to every other
instance of my custom objects in modelspace. Do someone know a
workaround for this task?

Mille thanks in advance,
Michael


p.s.
I m using objectARX 2000

the code:
...
ee=
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBT,
AcDb::kForRead);
ee= pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
pBT->close(); pBT= NULL;
ee= pBTR->newIterator(pBTRI); //always returns Acad::eCreateFailed,
WHY?
...
0 Likes
619 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
dbx files cannot get iterators to Model Space. This is part of the security
system.

The only way around this is to make your file a .arx rather than a .dbx. Of
course that means your file will only be loadable in AutoCAD not in other
host apps such as Volo View or AutoCAD LT.

"Michael Zwölfer" wrote in message
news:[email protected]...
> It seems not to be possible to get an iterator to modelspace from within
> a method of a custom object. I always get an undocumented
> "Acad::eCreateFailed" when I request the iterator.
> I want to do a comparision of my actual custom object to every other
> instance of my custom objects in modelspace. Do someone know a
> workaround for this task?
>
> Mille thanks in advance,
> Michael
>
>
> p.s.
> I m using objectARX 2000
>
> the code:
> ...
> ee=
> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBT,
> AcDb::kForRead);
> ee= pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
> pBT->close(); pBT= NULL;
> ee= pBTR->newIterator(pBTRI); //always returns Acad::eCreateFailed,
> WHY?
> ...
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
"Art Cooney" schrieb:

> dbx files cannot get iterators to Model Space. This is part of the
> security system.
>
> The only way around this is to make your file a .arx rather than a
> .dbx. Of course that means your file will only be loadable in
> AutoCAD not in other host apps such as Volo View or AutoCAD LT.
>
> "Michael Zwölfer" wrote in message
> news:[email protected]...
> > It seems not to be possible to get an iterator to modelspace from
> > within a method of a custom object. I always get an undocumented
> > "Acad::eCreateFailed" when I request the iterator.
> > I want to do a comparision of my actual custom object to every
> > other instance of my custom objects in modelspace. Do someone know
> > a workaround for this task?
> >
> > Mille thanks in advance,
> > Michael
> >
> >
> > p.s.
> > I m using objectARX 2000
> >
> > the code:
> > ...
> > ee=
> > acdbHostApplicationServices()->workingDatabase()->getSymbolTable(p
> > BT, AcDb::kForRead);
> > ee= pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
> > pBT->close(); pBT= NULL;
> > ee= pBTR->newIterator(pBTRI); //always returns
> > Acad::eCreateFailed, WHY?
> > ...
> >
> >
>
As a "workaround" you can do the following: Track your objects yourself.
Create singleton that holds an vector (or whatever storage fits best) of
Object ids of your objects. Implement the SubClose() function in your
objects and in there register the current object with the singleton. Now
you can query the singleton for all other objects of your type.

HTH,
Andy
--
To mail me directly, remove the NO*SPAM parts in
NO*[email protected]*SPAM
0 Likes
Message 4 of 5

Anonymous
Not applicable
Good idea! thank you very much,
Michael


"Andreas Müller" wrote:

> "Art Cooney" schrieb:
>
> > dbx files cannot get iterators to Model Space. This is part of the
> > security system.
> >
> > The only way around this is to make your file a .arx rather than a
> > .dbx. Of course that means your file will only be loadable in
> > AutoCAD not in other host apps such as Volo View or AutoCAD LT.
> >
> > "Michael Zwölfer" wrote in message
> > news:[email protected]...
> > > It seems not to be possible to get an iterator to modelspace from
> > > within a method of a custom object. I always get an undocumented
> > > "Acad::eCreateFailed" when I request the iterator.
> > > I want to do a comparision of my actual custom object to every
> > > other instance of my custom objects in modelspace. Do someone know
> > > a workaround for this task?
> > >
> > > Mille thanks in advance,
> > > Michael
> > >
> > >
> > > p.s.
> > > I m using objectARX 2000
> > >
> > > the code:
> > > ...
> > > ee=
> > > acdbHostApplicationServices()->workingDatabase()->getSymbolTable(p
> > > BT, AcDb::kForRead);
> > > ee= pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
> > > pBT->close(); pBT= NULL;
> > > ee= pBTR->newIterator(pBTRI); //always returns
> > > Acad::eCreateFailed, WHY?
> > > ...
> > >
> > >
> >
> As a "workaround" you can do the following: Track your objects yourself.
> Create singleton that holds an vector (or whatever storage fits best) of
> Object ids of your objects. Implement the SubClose() function in your
> objects and in there register the current object with the singleton. Now
> you can query the singleton for all other objects of your type.
>
> HTH,
> Andy
> --
> To mail me directly, remove the NO*SPAM parts in
> NO*[email protected]*SPAM

--
michael zwoelfer
architekt

ifib
Institut für Industrielle Bauproduktion
Universität Karlsruhe
76128 Karlsruhe

t: 0721 608 8049
f: 0721 608 7310
0 Likes
Message 5 of 5

Anonymous
Not applicable
Michael Zwölfer schrieb:

> Good idea! thank you very much,
> Michael
>
>
> "Andreas Müller" wrote:
>
> > "Art Cooney" schrieb:
> >
> > > dbx files cannot get iterators to Model Space. This is part of
> > > the security system.
> > >
> > > The only way around this is to make your file a .arx rather than
> > > a .dbx. Of course that means your file will only be loadable in
> > > AutoCAD not in other host apps such as Volo View or AutoCAD LT.
> > >
> > > "Michael Zwölfer" wrote in message
> > > news:[email protected]...
> > > > It seems not to be possible to get an iterator to modelspace
> > > > from within a method of a custom object. I always get an
> > > > undocumented "Acad::eCreateFailed" when I request the iterator.
> > > > I want to do a comparision of my actual custom object to every
> > > > other instance of my custom objects in modelspace. Do someone
> > > > know a workaround for this task?
> > > >
> > > > Mille thanks in advance,
> > > > Michael
> > > >
> > > >
> > > > p.s.
> > > > I m using objectARX 2000
> > > >
> > > > the code:
> > > > ...
> > > > ee=
> > > > acdbHostApplicationServices()->workingDatabase()->getSymbolTab
> > > > le(p BT, AcDb::kForRead);
> > > > ee= pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForRead);
> > > > pBT->close(); pBT= NULL;
> > > > ee= pBTR->newIterator(pBTRI); //always returns
> > > > Acad::eCreateFailed, WHY?
> > > > ...
> > > >
> > > >
> > >
> > As a "workaround" you can do the following: Track your objects
> > yourself. Create singleton that holds an vector (or whatever
> > storage fits best) of Object ids of your objects. Implement the
> > SubClose() function in your objects and in there register the
> > current object with the singleton. Now you can query the singleton
> > for all other objects of your type.
> >
> > HTH,
> > Andy
> > --
> > To mail me directly, remove the NO*SPAM parts in
> > NO*[email protected]*SPAM
>
> --
> michael zwoelfer
> architekt
>
> ifib
> Institut für Industrielle Bauproduktion
> Universität Karlsruhe
> 76128 Karlsruhe
>
> t: 0721 608 8049
> f: 0721 608 7310
>
Just a Followup: When you store the ObjectIds, I would recommend a set:
std::set, as you don't have worry about double insertions
and the lookup speed is log(n).
--
To mail me directly, remove the NO*SPAM parts in
NO*[email protected]*SPAM
0 Likes