jlink and Drawing Symbols
Hi,
I'm not an expert in JAVA, but I try to understand the examples of the jlink-doc in Pro/E Wildfire 4. So I made some menu-modifications and got a script to modify some config-options working.
Now I try to put a drawing-symbol on the drawing. There ist an example in folder proE/jlink/jlink_appls/jlinkexamples: pfcDrawingExamples.java with the function: placeInst()
/*====================================================================*\
FUNCTION : placeSymInst()
PURPOSE : Place a CG symbol with no leaders at a specified location
\*====================================================================*/
public static void placeInst() throws com.ptc.cipjava.jxthrowable
{
/*--------------------------------------------------------------------*\
Get the current drawing
\*--------------------------------------------------------------------*/
Session session = pfcGlobal.GetProESession ();
Model model = session.GetCurrentModel();
if (model.GetType() != ModelType.MDL_DRAWING)
throw new RuntimeException ("Current model is not a drawing");
Drawing drawing = (Drawing) model;
/*--------------------------------------------------------------------*\
Retrieve the symbol definition from the system
\*--------------------------------------------------------------------*/
DetailSymbolDefItem symDef =
drawing.RetrieveSymbolDefinition ("CG", null, null, null); //<-- ErrorObject on second run!
/*--------------------------------------------------------------------*\
Select the locations for the symbol
\*--------------------------------------------------------------------*/
boolean stop = false;
Point3Ds points = Point3Ds.create ();
while (!stop)
{
MouseStatus mouse = session.UIGetNextMousePick (null);
if (mouse.GetSelectedButton() ==
MouseButton.MOUSE_BTN_LEFT)
{
points.insert (0, mouse.GetPosition());
}
else
stop = true;
}
/*--------------------------------------------------------------------*\
Allocate the symbol instance decription
\*--------------------------------------------------------------------*/
DetailSymbolInstInstructions instrs =
pfcDetail.DetailSymbolInstInstructions_Create (symDef);
for (int i = 0; i < points.getarraysize(); i++)
{
/*--------------------------------------------------------------------*\
Set the location of the note text
\*--------------------------------------------------------------------*/
FreeAttachment position =
pfcDetail.FreeAttachment_Create (points.get (i));
/*--------------------------------------------------------------------*\
Set the attachment structure
\*--------------------------------------------------------------------*/
DetailLeaders allAttachments =
pfcDetail.DetailLeaders_Create ();
allAttachments.SetItemAttachment (position);
instrs.SetInstAttachment (allAttachments);
/*--------------------------------------------------------------------*\
Create and display the symbol
\*--------------------------------------------------------------------*/
DetailSymbolInstItem symInst =
(DetailSymbolInstItem) drawing.CreateDetailItem (instrs);
symInst.Show();
}
}
I modified the script to get a symbol out of the symboldirectory and it works - but only once! I think, because the symbol is in the drawing yet. On the second run of the script with the same drawing there ist the following exception with RetrieveSymbolDefinition: com.ptc.pfc.Implementation.pfcExceptions$XToolkitFound
I have tried to modify the errorline to
DetailSymbolDefItem symDef =
drawing.RetrieveSymbolDefinition ("CG", null, null, true);
but when eclipse says
The method RetrieveSymbolDefinition(String, String, Integer, Boolean) in the type DetailItemOwner is not applicable for the arguments (String, String, null, boolean)
Has anybody an idea to get the script working again and again?
Thanks.
Andreas Vogt
This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

