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

Changing drawings during a command

12 REPLIES 12
Reply
Message 1 of 13
RLARXMAN
797 Views, 12 Replies

Changing drawings during a command

Hello,
I am using an ARX command that gets data from the active document, switches to another document with setCurDocument, locks that document for write, does some work there, unlocks it. So far so good. The problem is that setCurDocument makes the second document the active document. That is not supposed to happen per the ARX literature. I really don't need it to be the active document. If I try to set the original document back as active document the the program does not work as far as modifying the second document. So as it is now, the program stops with the second document as active. It has done its work. I can switch to a third document fine, but when I try to back to the original document (not under program control), AutoCAD bombs out. I can go to any other open document, but when I go back to the document that I originally invoked the command from it will bomb. I have gone through the ObjectARX help files several times but I feel like there is something subtle I am missing here. Is anyone familiar enough with MDI to tell me what I am not doing right?

Thanks,

Rollin
12 REPLIES 12
Message 2 of 13
RLARXMAN
in reply to: RLARXMAN

Problem solved! Actually, I found out what I needed to do to get it to work. First, I was actually activating the second drawing with a true argument in setCurDocument(). Then also I had to use setCurDocument again when I was done in the second drawing to set the original drawing back as current. When I did that, everything works fine.
Message 3 of 13
Anonymous
in reply to: RLARXMAN

Hi,
I give my command in the active document, and switch to another document using setCurDocument. My problem is, when i execute the acedcommand in the second document that is not active,the acedcommand is not executed.
Do anyone give me an idea to solve this

Message was edited by: Adline Message was edited by: Adline
Message 4 of 13
Anonymous
in reply to: RLARXMAN

Can you post the code you are using to do this? It's much easier to figure out what is wrong that way.
Message 5 of 13
Anonymous
in reply to: RLARXMAN

The following raises an exception and the AutoCAD crashes.

AcGePoint3d center(2,2,0);

pDocumentIterator = acDocManagerPtr()->newAcApDocumentIterator();
for( i=1;!pDocumentIterator->done();pDocumentIterator->step(),i++)
{
pDocument = pDocumentIterator->document();
res = acDocManager->setCurDocument(pDocument, AcAp::kWrite,false);
if(acedCommand(RTSTR, "_.CIRCLE", RT3DPOINT, center,RTREAL , 1.0, RTNONE)==RTNORM)
acutPrintf(_T("success!!"));
res = acDocManager->unlockDocument(pDocument);
}
delete pDocumentIterator;
Message 6 of 13
Anonymous
in reply to: RLARXMAN

> The following raises an exception and the AutoCAD crashes.

If this is for AutoCAD 2007 or later, then the second argument in your
call to acedCommand must be a Unicode string. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
Message 7 of 13
Anonymous
in reply to: RLARXMAN

still AutoCAD crashes...
Message 8 of 13
Anonymous
in reply to: RLARXMAN

> still AutoCAD crashes...

Your center point argument is also the wrong type: it should be of type
ads_point. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
Message 9 of 13
Anonymous
in reply to: RLARXMAN

Hi Owen,
Sometime you just have to spell it out like this!

if(acedCommand(RTSTR, _T("_.CIRCLE"), RT3DPOINT, asDblArray(center), RTREAL
, 1.0, RTNONE)==RTNORM)


Regards Gary.
Message 10 of 13
Anonymous
in reply to: RLARXMAN

Gary:

But then you have to do it over and over again. Better to teach a man to
fish... 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


"Gary D'Arcy" wrote in message
news:5744360@discussion.autodesk.com...
Hi Owen,
Sometime you just have to spell it out like this!

if(acedCommand(RTSTR, _T("_.CIRCLE"), RT3DPOINT, asDblArray(center), RTREAL
, 1.0, RTNONE)==RTNORM)


Regards Gary.
Message 11 of 13
Anonymous
in reply to: RLARXMAN

Good answer (and the right one!)



"Owen Wengerd" wrote in message
news:5744695@discussion.autodesk.com...
Gary:

But then you have to do it over and over again. Better to teach a man to
fish... 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


"Gary D'Arcy" wrote in message
news:5744360@discussion.autodesk.com...
Hi Owen,
Sometime you just have to spell it out like this!

if(acedCommand(RTSTR, _T("_.CIRCLE"), RT3DPOINT, asDblArray(center), RTREAL
, 1.0, RTNONE)==RTNORM)


Regards Gary.
Message 12 of 13
Anonymous
in reply to: RLARXMAN

EMD1954,

Thanks,

I'll make sure you get the rod next time you fish!

Regards Gary.


"EMD1954" wrote in message
news:5745047@discussion.autodesk.com...
Good answer (and the right one!)



"Owen Wengerd" wrote in message
news:5744695@discussion.autodesk.com...
Gary:

But then you have to do it over and over again. Better to teach a man to
fish... 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


"Gary D'Arcy" wrote in message
news:5744360@discussion.autodesk.com...
Hi Owen,
Sometime you just have to spell it out like this!

if(acedCommand(RTSTR, _T("_.CIRCLE"), RT3DPOINT, asDblArray(center), RTREAL
, 1.0, RTNONE)==RTNORM)


Regards Gary.
Message 13 of 13
Anonymous
in reply to: RLARXMAN

Sorry you feel that way. I meant it as a positive response.



"Gary D'Arcy" wrote in message
news:5745536@discussion.autodesk.com...
EMD1954,

Thanks,

I'll make sure you get the rod next time you fish!

Regards Gary.


"EMD1954" wrote in message
news:5745047@discussion.autodesk.com...
Good answer (and the right one!)



"Owen Wengerd" wrote in message
news:5744695@discussion.autodesk.com...
Gary:

But then you have to do it over and over again. Better to teach a man to
fish... 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


"Gary D'Arcy" wrote in message
news:5744360@discussion.autodesk.com...
Hi Owen,
Sometime you just have to spell it out like this!

if(acedCommand(RTSTR, _T("_.CIRCLE"), RT3DPOINT, asDblArray(center), RTREAL
, 1.0, RTNONE)==RTNORM)


Regards Gary.

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

Post to forums  

Autodesk Design & Make Report

”Boost