cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Translate the entire conversation x

VARIABLE TEXT IN CUSTOM SYMBOL c++ code

RD_12909834
4-Participant

VARIABLE TEXT IN CUSTOM SYMBOL c++ code

Hi I want to add variable text to a custom symbol programmatically.

5 REPLIES 5

Hello @RD_12909834

 

Thank you for your question


I'd like to recommend to bring more details and context to your initial inquiry. 

  1. Have you already tried any methods or approaches to add variable text to the custom symbol using C++? If so, what were the results? 
  2. Are you encountering any specific error messages or issues when trying to implement this feature?

It also helps to have screenshot(s) to better understand what you are trying to do in your process. Adding more context will increase your chances to receive meaningful help from other Community members. 

Regards,
Vivek N
Community Moderation Team.

Hi,

This is my code and it is not giving any error but not updating the

// load symbol file
pfcDetailSymbolDefItem_ptr symDef = pfcDwg->RetrieveSymbolDefItem("dim_balloon", pfcDetailSymbolDefItemSource::pfcDTLSYMDEF_SRC_PATH, strr, NULL, true);
pfcDetailSymbolInstInstructions_ptr instrs = pfcDetailSymbolInstInstructions::Create(symDef);
 
pfcDetailVariantText_ptr mtext = pfcDetailVariantText::Create("inValue", xstring::Printf("%d", k + 1));
dims = dimname.c_str();
 
pfcDetailVariantTexts_ptr stext = pfcDetailVariantTexts::create();
stext->append(mtext);
 
pfcFreeAttachment_ptr freeAttachmentpos = pfcFreeAttachment::Create(src_loc);
pfcView2D_ptr view2d;
view2d = pfcView2D::cast(model2D->GetViewByName("Primary View"));
 
freeAttachmentpos->SetView(view2d); // #
freeAttachmentpos->SetAttachmentPoint(src_loc);
pfcAttachment_ptr attach = pfcAttachment::cast(freeAttachmentpos);
instrs->SetInstAttachment(pfcSymbolDefAttachmentType::pfcSYMDEFATTACH_FREE);
instrs->SetTextValues(stext);
 
Regards

This is not updating the symbol note

RPN
17-Peridot
17-Peridot
(To:RD_12909834)

Even if the attachment is free, is it not required to specify the x,y location ?

And the symbol definition has variable text?

Hi,

contact PTC Support.


Martin Hanák
Announcements

Top Tags