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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

RetrieveSymbolDefItem Interface need using demo

元杨_10712694
8-Gravel

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.

ACCEPTED SOLUTION

Accepted Solutions

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();

 

View solution in original post

3 REPLIES 3

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();

 

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

This line would be instruction of my question.Any way,Thank you very much!

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.

Announcements


Top Tags