Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I am looking for any help on the below code. The pin-out table is not loading in my drawing, and I'm not sure why.
The error is XToolkitGeneralError.
I currenrly have copies of the pin-out.tbl file in my "pro tables directory", my weblinkexamples folder, and my jscript and html folders under that. I also tried my work space as well.
The table has two repeat regions, and works fine when I load table from file in parametric.
function createEdgeNote(max /* integer */)
{
if (pfcIsMozilla())
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
/*--------------------------------------------------------------------*\
Get the current drawing & its background view
\*--------------------------------------------------------------------*/
var session = pfcGetProESession ();
var drawing = session.CurrentModel;
if (drawing.Type != pfcCreate ("pfcModelType").MDL_DRAWING)
throw new Error (0, "Current model is not a drawing");
/*--------------------------------------------------------------------*\
Interactively select a Edge in a drawing view
\*--------------------------------------------------------------------*/
var noteedge = pfcCreate ("pfcSelectionOptions").Create ("edge");
if (max != "UNLIMITED")
{
noteedge.MaxNumSels = parseInt (max);
}
session.CurrentWindow.SetBrowserSize (0.0);
var selections = void null;
try {
selections = session.Select (noteedge, void null);
}
catch (err) {
if (pfcGetExceptionType (err) == "pfcXToolkitUserAbort" ||
pfcGetExceptionType (err) == "pfcXToolkitPickAbove")
return (void null);
else
throw err;
}
if (selections.Count == 0)
return (void null);
for (var i = 0; i < selections.Count; i ++)
{
var seledge = selections.Item (i);
var String_line1 = "LABEL: &REF_DES:ATT_CONN";
var String_line2 = "TO ";
var LABEL = String_line1 + "\n" + String_line2;
var name = String(LABEL)
/*--------------------------------------------------------------------*\
Allocate a text item, and set its properties
\*--------------------------------------------------------------------*/
var text = pfcCreate ("pfcDetailText").Create (name);
/*--------------------------------------------------------------------*\
Allocate a new text line, and add the text item to it
/*--------------------------------------------------------------------*/
var texts = pfcCreate ("pfcDetailTexts");
texts.Append (text);
var textLine = pfcCreate ("pfcDetailTextLine").Create (texts);
var textLines = pfcCreate ("pfcDetailTextLines");
textLines.Append (textLine);
/*--------------------------------------------------------------------*\
Set the location of the note text
\*--------------------------------------------------------------------*/
var dwgView = seledge.SelView2D;
var outline = dwgView.Outline;
var textPos = outline.Item (1);
// Force the note to be slightly beyond the view outline boundary
textPos.Set (0, textPos.Item (0) + 0.01 + i * (textPos.Item (0) -
outline.Item (0).Item(0)));
textPos.Set (1, textPos.Item (1) + 0.01 + i * (textPos.Item (1) -
outline.Item (0).Item(1)));
var position = pfcCreate ("pfcFreeAttachment").Create (textPos);
position.View = dwgView;
/*--------------------------------------------------------------------*\
Set the attachment for the note leader
\*--------------------------------------------------------------------*/
var leaderToEdge = pfcCreate ("pfcParametricAttachment").Create (seledge);
/*--------------------------------------------------------------------*\
Set the attachment structure
\*--------------------------------------------------------------------*/
var allAttachments = pfcCreate ("pfcDetailLeaders").Create ();
allAttachments.ItemAttachment = position;
allAttachments.Leaders = pfcCreate ("pfcAttachments");
allAttachments.Leaders.Append (leaderToEdge);
/*--------------------------------------------------------------------*\
Allocate a note description, and set its properties
\*--------------------------------------------------------------------*/
var instrs = pfcCreate ("pfcDetailNoteInstructions").Create (textLines);
instrs.Leader = allAttachments;
/*--------------------------------------------------------------------*\
Create / Show Pin Out Tables
\*--------------------------------------------------------------------*/
try
{
var tableinstr = pfcCreate("pfcTableRetrieveInstructions").Create("pin-out" , position);
var dwgTable = drawing.RetrieveTable (tableinstr);
if (dwgTable != null) {
dwgTable.Show();
} else {
}
} catch (err) {
alert("Error creating pin-out table: " + pfcGetExceptionDescription (err));
}
/*--------------------------------------------------------------------*\
Create / Display the note
\*--------------------------------------------------------------------*/
var note = drawing.CreateDetailItem (instrs);
note.Show ();
}
return (selections);
}
Hi AH,
Now the standard embedded browser is Chromium, it depends on what Creo Parametric you are using, I think, this could be the problem...
Look at this thread
Hi @AH_10565398,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,