Skip to main content
1-Visitor
September 7, 2012
Question

Drawing approver name from Windchill into the proe drawing

  • September 7, 2012
  • 9 replies
  • 6056 views

Hi,


I am using PDMLink 10.0M010 with Creo 1.0.


When any drawing is Released from Windchill (using either promotion request or Change Management), I want to add Drawing approver name from Windchill into the proe drawing.


The way in which we add drawing creator name using parameter "PTC_WM_CREATED_BY' in drawing format.


How to add approver syntax? If such syntax is not available out of box, how to do it?


Thanks,


Sanjay

9 replies

1-Visitor
September 11, 2012

Sanjay,


This is doable but will not involve any of the PTC_WM_* parameters.


Create and designate a parameter APPROVED_BY in ProE


Create a String attribute APPROVED_BYin Windchill.


Add the APPROVED_BY attribute to EPMDocument in Type manager


That's step one.


Step 2 is updating the APPROVED_BY attribute in Windchill in a workflow


In your workflow decide when/how to update it. Perhaps during the completion of an Approve workflow assignment.


In the Complete Transition of the approve assignment add the following:


//This will get the approver's fullname (or Windchill name)


String approvedBy = ((wt.org.WTUser)wt.session.SessionHelper.getPrincipal()).getFullName(); // or .getName() your choice


//Add a webject to update the ProE Drawing


Put this code in a class and reference the class. DON'T put this directly in the complete transition.


Transaction transaction = new Transaction();
transaction.start();


//Checkout


ActionWebject co = new ActionWebject("Checkout-Objects");
co.setService(ie);
co.addParam("INSTANCE", taskProcessor);
co.addParam("OBJECT_REF", PersistenceHelper.getObjectIdentifier(epmDrawing).toString()); //epmDrawing is your drawing
co.addParam("Attribute", "obid");
co.addParam("GROUP_OUT", "checkout_group");
co.invoke();


obid = (String) co.getService().getGroup("checkout_group").getAttributeValue(0, "obid");


//Update


ActionWebject ud = new ActionWebject("Update-Objects");
ud.setService(ie);
ud.addParam("INSTANCE", taskProcessor);
ud.addParam("OBJECT_REF", obid);
ud.addParam("MODIFICATION", "REPLACE");
String field =APPROVEDBY + "=" +approvedBy + ";
ud.addParam("FIELD",field );
}
ud.addParam("GROUP_OUT", "updated_group");
ud.invoke();


//Checkin


ActionWebject ci = new ActionWebject("Checkin-Objects");
ci.setService(ie);
ci.addParam("INSTANCE", taskProcessor);
ci.addParam("OBJECT_REF", obid);
ci.addParam("GROUP_OUT", "checkin_group");
ci.invoke();


transaction.commit();


I would strongly recommed create a class and referencing this code. I make the code very generic as well.


something like ext.tools.IBAHelper.updateValue(Persistable obj, HashMap map) The HashMap can store the IBA names and corresponding values. This will allow you to update several IBAs at the same time.


FYI, there are APIs in 10.0 that can update an IBA. I still use webjects however. They work well and once you know how to use webjects you can do a lot with them.


Hope this helps


David



In Reply to Sanjay Sawant:



Hi,


I am using PDMLink 10.0M010 with Creo 1.0.


When any drawing is Released from Windchill (using either promotion request or Change Management), I want to add Drawing approver name from Windchill into the proe drawing.


The way in which we add drawing creator name using parameter "PTC_WM_CREATED_BY' in drawing format.


How to add approver syntax? If such syntax is not available out of box, how to do it?


Thanks,


Sanjay


16-Pearl
November 1, 2016

Thanks for that promising workaround.

But unfortunately, I am new to "Winchill PDM System hacking". So I would appreciate any hint where to start. Especially step 2 seems quite sophisticated to me.

Intuitively, I would insert Your workaround right before the "set state approved" step.

Promotion_workflow.JPG

BenPerry
15-Moonstone
December 23, 2016

Matthias Rehs‌,

You're going to need to put the

approvedBy = ((wt.org.WTUser)wt.session.SessionHelper.getPrincipal()).getFullName()

code in the COMPLETE transition of your "Approve Promotion Request" task.

You can also put the call to the external class there too ... or you can put that in an Execute Expression robot.  It is your choice.

I see you posted this a while ago.  Were you able to make progress on it?

22-Sapphire I
December 23, 2016

I'm old enough to remember when people actually signed vellum drawings - and then made copies of others to use (blueprints). So in this case, the actual editable original changed.

With PLM systems, the STATE of the original editable changes, but not the content.

Changing something that is checked in is a lot like taping up a box, then approving what is in the box, then opening up the box and inserting the record of approving what is in the box after it was taped shut.  Major circular flow that you don't want to use.  When you go down this path, what displays on the drawing is completely dependent on correct retrieval and refresh - and subject to model changes made since the drawing was checked in.

Using Windchill watermarking thru Creo View completely eliminates the need for any of this - and allows for generating PDF's that you do business on from just a browser, no CAD involved.

BenPerry
15-Moonstone
December 23, 2016

Mike,

I don't understand where you're going with your response.

We're investigating the use case supplied by Sanjay:

  1. Drawings are completed.
  2. In the change (CN in our case) workflow, there is an approval task to UserX.  UserX reviews & approves the drawings.  They sign off on their workflow task.
  3. Workflow code captures the user's Full Name who completed that "Drawing Approval" workflow task.
  4. Workflow code pushes user's Full Name (via IBA) to a parameter in the drawing which is displayed in the title block of the drawing, thus automatically populating that field on the drawing instead of manually updating it.
  5. The state of the drawings also flip to Production state after this task, so they are no longer editable.

I'm not sure what you're describing with the "circular flow" reference.  ...And regarding your comment about watermarks ... do you think we can achieve this requirement with watermarks?  That might be interesting to investigate.  I'm not sure yet.