Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Custom SaveAs in Windchill

MN_10518175
5-Regular Member

Custom SaveAs in Windchill

I would like to replicate the OOTB Save As feature. The purpose is to get the custom attributes value from Users for populating new name/number/filename through custom wizard.

Using EnterpriseHelper.service.saveCopy(oldepm,newepm) helps me achieve half of the requirement. The problem here is while opening the newly created 2D Drawing in Authoring Application, it throws pop-up message like this new 2D still referring the old 3D Model. In OOTB save as, it does that from Windchill itself.

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

Hi @MN_10518175 

The issue can be that you make a copy separately one by one I guess.  I may be wrong.

Try to collect all objects and use to create copy following method

 

RevisionControlled[] input = new RevisionControlled[]{model, drawing};
EnterpriseHelper.service.newMultiObjectCopy(input);

 

PetrH

View solution in original post

9 REPLIES 9

Hi @MN_10518175 

The issue can be that you make a copy separately one by one I guess.  I may be wrong.

Try to collect all objects and use to create copy following method

 

RevisionControlled[] input = new RevisionControlled[]{model, drawing};
EnterpriseHelper.service.newMultiObjectCopy(input);

 

PetrH

MN_10518175
5-Regular Member
(To:HelesicPetr)

Thanks for your valuable suggestions.

 

After changing the logic using above API, authoring application doesn't show the above error popup. The only thing is the new drawing's representation still holds old value in drawing table. If perform OOTB save as, post republish, the value changes in representation. Could you please provide some way to achieve the same.

Hi @MN_10518175 

 

The point of the old visualization is that you may not send the new object to visualization queue

or your visualization worker is not set to regenerate drawing during the visual process.  

 

PetrH 

 

MN_10518175
5-Regular Member
(To:HelesicPetr)

Thanks for the response.

Actually, I've implemented below logic to publish the newly created CAD 3D & 2D. Please correct me if anything to be changed.

 

public static boolean publishRule(EPMDocument epm) {
System.out.println("========Inside Publish=========");
//boolean flag = false;
ObjectReference obj = null;
try {
obj = ObjectReference.newObjectReference(epm);
}catch(WTException e) {
System.out.println("===Exception Occured=="+e);
}
String objRef = obj.toString();
System.out.println("========Before doPublish========="+objRef);
Publisher pub = new Publisher();
boolean result = pub.doPublish(false, true, objRef,(ConfigSpec)null,(ConfigSpec)null, true, null, null, Publisher.EPM, null, 1);
return result;
}

Hi @MN_10518175 

I do not see needs to change/correct the code. I would just add a queue priority 

 

com.ptc.wvs.common.ui.PublisherAction pupAction = new com.ptc.wvs.common.ui.PublisherAction(com.ptc.wvs.common.ui.PublisherAction.QUEUEPRIORITY, "M"); // L,M,H 

pub.doPublish(false, true, objRef, (wt.vc.config.ConfigSpec) null, null,true, null, null, com.ptc.wvs.common.ui.Publisher.EPM, pupAction.toString(), 1);

 

PetrH

MN_10518175
5-Regular Member
(To:HelesicPetr)

Have implemented the above logic, still Representation is not updating per new drawing. Even after manual republish the issue remains same.

 

FYI, If publishing logic not implemented in my custom code, i couldn't republish the generated representation as like OOTB Save As feature.

In OOTB Save As, we can republish the generated representations then it updates representation with latest value. This cannot be done from custom logic.

Error Message:

ATTENTION: Re-publishing cannot be performed.

 

Representation - default is not derived from data eligible for republishing.

 

Hence included Publishing rule logic.

Hi @MN_10518175 

 

There can be many consequences connected to visualization configuration and set of wvs.properties and so on.

PetrH

MN_10518175
5-Regular Member
(To:HelesicPetr)

Hi,

 

Can we add assembly object as well in below API? - asm

 

RevisionControlled[] input = new RevisionControlled[]{asm, model, drawing};

CopyObjectInfo [] copyInfoArray = EnterpriseHelper.service.newMultiObjectCopy(input);

Hi @MN_10518175 

 

try it on a testing system, I guess that you can.

 

PetrH

Announcements


Top Tags