Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I don't know what to do. Here is my code, the function ProDtlsyminstdataVartextsSet() returns the PRO_TK_BAD_INPUTS. It confused me.
ProDtlsyminst sym_inst;
ProDtlsyminstdata data;
ProDtlvartext text;
/*initialize...*/
stutas = ProDtlvartextAlloc((wchar_t*)L"test", (wchar_t*)L"2.5", &text);
status = ProDtlsyminstDataGet(&sym_inst, PRODISPMODE_SYMBOLIC, &data);
status = ProDtlsyminstdataVartextsSet(data, &text);
status = ProDtlsyminstModify(&sym_inst, data);
Solved! Go to Solution.
Oh, I solved it! Here is my code.
void modifySymInstence(ProDtlsyminst &sym_inst, ProDtlvartext &var_text)
{
ProError status;
ProDtlsyminstdata data;
ProDtlvartext *text;
ProLine prompt, prompt_target, value;
int size;
status = ProDtlsyminstDataGet(&sym_inst, PRODISPMODE_SYMBOLIC, &data);
status = ProDtlsyminstdataVartextsCollect(data, &text);
ProArraySizeGet(text, &size);
for (int i = 0; i < size; i++)
{
status = ProDtlvartextDataGet(text[i], prompt, value);
status = ProDtlvartextDataGet(var_text, prompt_target, value);
if (wcharToString(prompt) != wcharToString(prompt_target))
continue;
text[i] = var_text;//It solved my problem
}
status = ProDtlsyminstdataVartextsSet(data, text);
status = ProDtlsyminstErase(&sym_inst);
status = ProDtlsyminstModify(&sym_inst, data);
status = ProDtlsyminstShow(&sym_inst);
ProDtlvartextFree(*text);
}
Oh, I solved it! Here is my code.
void modifySymInstence(ProDtlsyminst &sym_inst, ProDtlvartext &var_text)
{
ProError status;
ProDtlsyminstdata data;
ProDtlvartext *text;
ProLine prompt, prompt_target, value;
int size;
status = ProDtlsyminstDataGet(&sym_inst, PRODISPMODE_SYMBOLIC, &data);
status = ProDtlsyminstdataVartextsCollect(data, &text);
ProArraySizeGet(text, &size);
for (int i = 0; i < size; i++)
{
status = ProDtlvartextDataGet(text[i], prompt, value);
status = ProDtlvartextDataGet(var_text, prompt_target, value);
if (wcharToString(prompt) != wcharToString(prompt_target))
continue;
text[i] = var_text;//It solved my problem
}
status = ProDtlsyminstdataVartextsSet(data, text);
status = ProDtlsyminstErase(&sym_inst);
status = ProDtlsyminstModify(&sym_inst, data);
status = ProDtlsyminstShow(&sym_inst);
ProDtlvartextFree(*text);
}
But I have a new problem. When my program modifies the variable text of the symbol inside the red rectangle, it prompts me to select the direction of the normal. How to select it automatically?