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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

RetrieveSymbolDefItem Interface need using demo

元杨_10712694
5-Regular Member

RetrieveSymbolDefItem Interface need using demo

Version:Creo Parametric 5.0.6.0 OTK C++

Description: I tried a lot of combination of using RetrieveSymbolDefItem method but they seems don't get the right object.For example I'm using it like this :

pfcDetailSymbolDefItem_ptr pDefSymDefItem = pOwner->RetrieveSymbolDefItem("circlerevice.sym", pfcDTLSYMDEF_SRC_PATH);

Of course my pro_symbol_dir  is set and the symbol I want to retrieve("circlerevice.sym") is in the directory.I've tried add fullfilepath and change pfcDTLSYMDEF_SRC_PATH to pfcDTLSYMDEF_SRC_SYSTEM along with move symbol file from user defined dir to system symbol dir but the method still doesn't work.Can somebody help me?Thanks a lot. I think it would be better if those API document come with same demo code.

2 REPLIES 2

Yeah, sample code on these classes and stuff would be VERY nice.  I'm not as familiar with the C++ side, but I'll share my code from weblink/js.  I tried to just include the relevant bits, so apologies if I'm missing anything.

  var session = pfcGetProESession ();
  var drawing = session.CurrentModel;

    var dwgView = seledge.SelView2D;

    var stop = false;
    var point;
    while (!stop)
    {
      var mouse = session.UIGetNextMousePick (pfcCreate ("pfcMouseButton").MouseButton_nil);
      
      if (mouse.SelectedButton == pfcCreate ("pfcMouseButton").MOUSE_BTN_LEFT)
      {
        point = mouse.Position;
        stop = true;
      }
      else
        stop = true;
    }

    var position = pfcCreate ("pfcFreeAttachment").Create (point);
    position.View = dwgView;

var symDef = drawing.RetrieveSymbolDefinition ("flagnote_hex", null, null, true);

var Hexinstrs = pfcCreate ("pfcDetailSymbolInstInstructions").Create (symDef); 
Hexinstrs.ScaledHeight = 8.25;
Hexinstrs.SetGroups(pfcCreate("pfcDetailSymbolGroupOption").DETAIL_SYMBOL_GROUP_ALL , null);
var notenum = flagnote
var varText = pfcCreate ("pfcDetailVariantText").Create("NUM" , notenum);
var varTexts = pfcCreate("pfcDetailVariantTexts");
varTexts.Append(varText);
Hexinstrs.TextValues = varTexts;

var Hexposition = pfcCreate ("pfcFreeAttachment").Create (point);
var HexallAttachments = pfcCreate ("pfcDetailLeaders").Create ();	
HexallAttachments.ItemAttachment = Hexposition;

Hexinstrs.InstAttachment = HexallAttachments;

var symInst = drawing.CreateDetailItem (Hexinstrs);
symInst.Show();

 

Hello @元杨_10712694

 

It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Top Tags