Skip to main content
10-Marble
May 3, 2011
Question

Creating a draiwng of a generic from a template in J Link

  • May 3, 2011
  • 1 reply
  • 657 views

Using the code below I am able to create drawings using a template of all model types other then family table generics. When the model is a generic the code will not execute properly.


WhenI try to manually follow the steps in Pro/ENGINEER fr creating a drawing from atemplateif I select a family table generic as the model for the drawing it prompts me again to select a model from the family table, generic or instance.


How do I programatically tell Pro/ENGINEER to use the generic model for the drawing from template? Am I going about this the wrong way?



Scott



public static Drawing drawingFromTemplate (Model model, String drawingName, String template){

Drawing drawing = null;

try{
Session session = pfcGlobal.GetProESession();

Utilities.log("Creating drawing instructions");
DrawingCreateOptions options = DrawingCreateOptions.create();
options.insert(0, DrawingCreateOption.DRAWINGCREATE_DISPLAY_DRAWING);

Utilities.log("Creating drawing from template "+template);
drawing = session.CreateDrawingFromTemplate(drawingName, template, model.GetDescr(), options);
Utilities.log("Drawing created");
}
catch (jxthrowable e){
Utilities.log("JLink Exception creating drawing from template");
Utilities.log(e);
}
return drawing;

1 reply

10-Marble
May 4, 2011
Hi Scott
There has been some changes on handling of Family Table Instances in
J-link from Wildfire 4.0. You can read about it in the API Wizard's
Summary of Technical Changes.

You could try this in your method after having detected you have a
generic:
drawing = session.CreateDrawingFromTemplate(drawingName, template, ((
FamilyMember )((Solid)model)).GetImmediateGenericInfo, options);
Bjarne




Scott Bots <->
03-05-2011 23:32
Please respond to
Scott Bots <->


To
<->
cc

Subject
[proecus] - Creating a draiwng of a generic from a template in J Link






Using the code below I am able to create drawings using a template of all
model types other then family table generics. When the model is a generic
the code will not execute properly.
When I try to manually follow the steps in Pro/ENGINEER fr creating a
drawing from a template if I select a family table generic as the model
for the drawing it prompts me again to select a model from the family
table, generic or instance.
How do I programatically tell Pro/ENGINEER to use the generic model for
the drawing from template? Am I going about this the wrong way?

Scott

public static Drawing drawingFromTemplate (Model model, String
drawingName, String template){

Drawing drawing = null;

try{
Session session = pfcGlobal.GetProESession();

Utilities.log("Creating drawing instructions");
DrawingCreateOptions options = DrawingCreateOptions.create();
options.insert(0, DrawingCreateOption.DRAWINGCREATE_DISPLAY_DRAWING);

Utilities.log("Creating drawing from template "+template);
drawing = session.CreateDrawingFromTemplate(drawingName, template,
model.GetDescr(), options);
Utilities.log("Drawing created");
}
catch (jxthrowable e){
Utilities.log("JLink Exception creating drawing from template");
Utilities.log(e);
}
return drawing;

Site Links: View post online View mailing list online Send new post
via email Unsubscribe from this mailing list Manage your subscription
Use of this email content is governed by the terms of service at: