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

acedGetKword() problem

1 REPLY 1
Reply
Message 1 of 2
Chaos0205
629 Views, 1 Reply

acedGetKword() problem

I was trying to create a command that mimic the _line command in ACAD. However, I end up with an infinity loop.I expected the loop to happen only if user input "Y". But it turn out that whatever user input, the loop always continue. How can i fix this, please ?

 

       // enter start point and end point
        AcGePoint3d StartPt,EndPt;
        acedGetPoint(NULL,_T("\n Start Point :"),asDblArray(StartPt));
        acedGetPoint(NULL,_T("\n End Point :"),asDblArray(EndPt));
        
        // draw line
        AcDbLine* pLine = new AcDbLine(StartPt,EndPt);
        AcDbObjectId pObj;
        AcDbBlockTable* pBlock;
        AcDbBlockTableRecord* pRecord;
        acdbCurDwg()->getBlockTable(pBlock,AcDb::kForRead);
        pBlock->getAt(ACDB_MODEL_SPACE,pRecord,AcDb::kForWrite);
        pRecord->appendAcDbEntity(pObj,pLine);
        pRecord->close();
        pBlock->close();
        pLine->close();
            
        TCHAR result[8]={_T("")};
        do
        {
            // continue to draw line
            StartPt = EndPt;
            acedGetPoint(NULL,_T("\n Next Point :"),asDblArray(EndPt));
            
            // draw next line
            AcDbLine* pLine = new AcDbLine(StartPt,EndPt);
            AcDbObjectId pObj;
            AcDbBlockTable* pBlock;
            AcDbBlockTableRecord* pRecord;
            acdbCurDwg()->getBlockTable(pBlock,AcDb::kForRead);
            pBlock->getAt(ACDB_MODEL_SPACE,pRecord,AcDb::kForWrite);
            pRecord->appendAcDbEntity(pObj,pLine);
            pRecord->close();
            pBlock->close();
            pLine->close();
            acedInitGet(0,_T("Y/N"));
            acedGetKword(_T("\nContinue :Y/N "), result);
        }
        while (wcscmp(result,_T("Y")));

 

 

1 REPLY 1
Message 2 of 2
StephenPreston
in reply to: Chaos0205

Not sure if this is the only problem in your code, but it looks like your keyword string is incorrectly formatted inthe acedInitGet function. From the helpfiles:

 

>>>

The kwl argument is a single string, which is interpreted according to the following rules: 

  • Each keyword is separated from the next keyword by one or more spaces. For example, "Width Height Depth" defines three keywords.

...

<<<

 

Cheers,

Stephen Preston
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report

”Boost