Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Text Property

Status
Not open for further replies.

SKimi

Mechanical
Feb 27, 2020
28
0
0
IN
Hello,

I am trying to create a CAA function to access the flagged text from the drawing. I'm currently checking every character whether it is flagged. But using SetSelection method from CAA the tool seems to crash at that line of code even after i do a ResetReselection. Can anyone suggest me for any better solution/api/method.

THANKS in advance.
 
Replies continue below

Recommended for you

[indent[/indent]int startString = 0;
while (startString < usInputString.GetLengthInChar())
{
int lengthOfString = usInputString.GetLengthInChar();

startString = usStringFoundInDoc.SearchSubString(usInputString, startString,CATUnicodeString::CATSearchModeForward);
if (startString == -1) break;

CATIDrwTextProperties *piDrwTextProps = NULL;
drawingText->get_TextProperties(drawingTextProps);

drawingTextProps->QueryInterface(IID_CATIDrwTextProperties, (void**)&piDrwTextProps);
piDrwTextProps->GetFrameType(oTextFrameType);
if (oTextFrameType == catNone)
{
CATIDftText *piDftText = NULL;
drawingText->QueryInterface(IID_CATIDftText, (void**)&piDftText);

wchar_t *ptextName = NULL;
piDftText->GetString(&ptextName);

CATIDrwSubString *piSubString = NULL;
piDftText->QueryInterface(IID_CATIDrwSubString, (void**)&piSubString);
// ****the next line of code is where CNEXT.exe file crashes******
piSubString->SetSelection(startString, lengthOfString, 1);

CATIDftTextProperties *piTextProp = NULL;
piDftText->GetTextProperties(&piTextProp);

DftFrameType oFrame;
piTextProp->GetFrameType(&oFrame);
piSubString->ResetSelection();
if (iFrameType == oFrame)
{
CATISpecObject *piSpecObj = NULL;
CATBaseDispatch* pDispatch = NULL;
drawingText->QueryInterface(IID_CATISpecObject, (void**)&piSpecObj);

piSpecObj->QueryInterface(IID_CATBaseDispatch, (void**)&pDispatch);

TextObjArray[nArraySize] = pDispatch;
nArraySize++;
}
}
startString = startString + usInputString.GetLengthInChar();
}
 
Status
Not open for further replies.
Back
Top