Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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
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
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.
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?
Thanks for Your answer.
But I am not sure how and where to create that external class.
Is there a tutorial or documentation for this?
I'm sorry - I'm not aware of tutorial or documentation about creating external classes. I just kind of learned it on the fly. I'm sure there is something out there ... and perhaps someone in this community will reply and help us out right away.
Here are some very rough guidelines:
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.
Mike,
I don't understand where you're going with your response.
We're investigating the use case supplied by Sanjay:
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.
You are talking as well about watermarking which has the drawback that it is not persistent. It is just an overlay in Windchill while online. If you export and share data the only option is a stamping solution which imprints the meta data on the neutral format. In my opinion it should be state of the art of every PLM system. It is save, reliable and fast, saving valuable resources for republishing. With the Adobe LC integration this is possible but not well documented. In my opinion this should be a complete optional feature which should be easy to buy and easy to configure for people who want it.
Replacing Adobe with some open source might not be an option due to long archive regulations. If possible this would be even better
Great discussion going on here - parallels what we are now doing at Edwards.
For 15+ years at Alcon, we required that all drawings (and also documents) that were for official use were PDF's created from Creo View (ProductView in the old days), and had a Windchill watermark. Now implementing same at Edwards.
This guarantees:
- Data is in Windchill
- Data can be published with no human interaction
- CAD is As Stored
- Data is at the required state (allows for supplying preliminary prints though, duly marked as such)
- Any PDF can be traced to exactly one Windchill object / version
This avoids changing the data in any way after it has been checked in (the state change is a different matter and happens after checkin).
Watermarking is not "persistent" in that it is applied dynamically to each Creo View session, but it is "persistent" in each PDF created from Creo View.