cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Translate the entire conversation x

Update Family table verification status using API

NK_11091925
4-Participant

Update Family table verification status using API

Hello Everyone,

 

I need to update the verification status of each instance in the family table using the Windchill API.

I am currently able to update the attributes of both the generic and instance entities using the following API:

EPMWorkspaceHelper.manager.setAttributes(ws, epmAttributeMap);

Has anyone worked on this before or have any insights on how to proceed?

 

NK_11091925_0-1742834305385.png

 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire II
(To:NK_11091925)

Hi @NK_11091925 

You can not use the persistence adapter to do so this way 😄

Check also my different answer >D

How to update IBA String values on a Part without iterating?

PetrH

View solution in original post

8 REPLIES 8
HelesicPetr
22-Sapphire II
(To:NK_11091925)

Hi @NK_11091925 

From my perspective it is not good idea to change the verification status by api from an external source then Creo Parametric , because the verification does the Creo with own mechanism that is not repeatable by external api without a deep knowledge of the FT logic. For example the Creo verification contains the instance regeneration based on the family table dimension attribute, and this can not be done outside the CAD Application. 

 I would be very careful to do so.

 

PetrH

@HelesicPetr 

 

Currently, in order to change the attribute for a family table, I need to check out the family CAD document, update the attribute, and then check in the family table objects.

 

This process results in the verification status being set to 'Unverified.'

 

Could you please clarify the implications of keeping the verification status as 'Unverified' for the time being? Additionally, would it be acceptable if user verify the status later by checking out the family document?"

HelesicPetr
22-Sapphire II
(To:NK_11091925)

@NK_11091925 

You can verify the FT later but you(user) have to again check-out/in the object . 

 

btw do you have any reason to check-out/in the object if you want to update the IBA attribute value?

What is the reason? You can update the attribute without the check-out/in

 

PS> if you update the FT dimension attribute that is used for model in the FT then you have to always verify the FT because verification is necessary to regenerate the geometry in the model by the Creo.

PetrH

@HelesicPetr 

 

I am currently updating the IBA for the EPM document without checking it out. However, when I attempt to update it on the family table objects, I encounter the following error:

 

(wt.iba.constraint.constraintResource/immsg1) wt.iba.constraint.IBAConstraintException: Attribute values cannot be added, removed, or changed.
at wt.iba.constraint.Immutable.isValueValid(Immutable.java:279)
at wt.epm.attributes.EPMIBAContainerConstraint.isContainerValid(EPMIBAContainerConstraint.java:235)
at wt.iba.constraint.ConstraintGroup.isContainerValid(ConstraintGroup.java:411)
at wt.iba.value.DefaultAttributeContainer.isContainerValid(DefaultAttributeContainer.java:715)
at wt.iba.value.service.MultiObjIBAValueDBService.updateAttributeContainer(MultiObjIBAValueDBService.java:675)
:
:
at ext.customer.NewVersionListener.notifyVetoableEvent(NewVersionListener.java:56)

 

As mentioned in the article https://www.ptc.com/en/support/article/CS161436?source=search,IBAs on Family Table objects should not be updated using the LWCNormalizedObject/PersistableAdapter APIs.

 

Therefore, I am now updating the IBAs following the approach outlined in https://www.ptc.com/cn/support/article/CS110292?art_lang=en, which suggests checking out the family table objects and setting the attributes."

 

Additionally, The attribute which I am updating is not referred to any dimension in FT.

 

HelesicPetr
22-Sapphire II
(To:NK_11091925)

Hi @HelesicPetr  

 

I used the shared approach but getting exception.

 

Can you please let me know what is missing here?

 

Boolean docIsInstance = epm.isInstance();

boolean docIsGeneric = epm.isGeneric();

if (docIsInstance) {

try {

epm.setInstance(false);

setStringAttributeValue(epm,"ATTR_INTERNALNAME", "VALUE");

} catch (WTPropertyVetoException e1) {

System.out.println(String.format("Family instance could not be disabled %s", epm.getNumber()));

e1.printStackTrace();

}

}

if (docIsGeneric) {

try {

epm.setGeneric(false);

setStringAttributeValue(epm,"ATTR_INTERNALNAME", "VALUE");

} catch (WTPropertyVetoException e1) {

System.out.println(String.format("Family Generic could not be disabled %s", epm.getNumber()));

e1.printStackTrace();

}

}

 

}

 

private static void setStringAttributeValue(EPMDocument epm, String attrName, String attrValue) {

try {

PersistableAdapter obj = new PersistableAdapter(epm, null, Locale.US, new UpdateOperationIdentifier());

obj.load(attrName);

obj.set(attrName, attrValue);

epm = (EPMDocument) obj.apply();

IBAValueDBService ibaserv = new IBAValueDBService();

ibaserv.updateAttributeContainer(epm,

((DefaultAttributeContainer) epm.getAttributeContainer()).getConstraintParameter(), null, null);

PersistenceServerHelper.manager.update((Persistable) epm);

 

} catch (WTException e) {

 

e.printStackTrace();

}

}

 

Exception after execution

validate.report.ReportingHelper wcadmin - Error [0] :
2025-04-03 16:49:02,301 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - wt.epm.EPMDocument:4871713 = 20010
2025-04-03 16:49:02,302 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - Name : familytable009.prt
2025-04-03 16:49:02,302 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - Number : FAMILYTABLE009.PRT
2025-04-03 16:49:02,303 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - CADName : familytable009.prt
2025-04-03 16:49:02,303 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - Iteration : 0.2
2025-04-03 16:49:02,303 ERROR [RMI TCP Connection(49)-127.0.0.1] wt.epm.familytable.validate.report.ReportingHelper wcadmin - CheckoutInfo : c/i
2025-04-03 16:49:02,325 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - (wt.pom.pomResource/0) wt.pom.PersistenceException: A persistence error occurred. System message follows:
2025-04-03 16:49:02,325 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - Nested exception is: (wt.epm.util.EPMResource/364) wt.util.WTException: Family table validations failed. Please contact PTC unless this occurred during a package import. Failures on package import may be due to a compatible generic not being available at time of import.
2025-04-03 16:49:02,325 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.epm.FTValidatorTransactionListener.validateObjects(FTValidatorTransactionListener.java:827)
2025-04-03 16:49:02,325 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.epm.FTValidatorTransactionListener.beforeCompletion(FTValidatorTransactionListener.java:714)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.TransactionManager$BeforeCompletionTransactionListener.fire(TransactionManager.java:1633)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.TransactionManager.fireTransactionListener(TransactionManager.java:1582)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.TransactionManager.beforeCompletion(TransactionManager.java:559)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.TransactionManager.commitTransaction(TransactionManager.java:443)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.BasicTransactionMonitor.commitTransaction(BasicTransactionMonitor.java:64)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.PersistentObjectManager.commitTransaction(PersistentObjectManager.java:405)
2025-04-03 16:49:02,326 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.pom.Transaction.commit(Transaction.java:754)
2025-04-03 16:49:02,327 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.fc.StandardPersistenceManager.update(StandardPersistenceManager.java:1214)
2025-04-03 16:49:02,329 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at wt.fc.StandardPersistenceManager.update(StandardPersistenceManager.java:1193)
2025-04-03 16:49:02,329 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at ext.test.UpdateEPMFamilyAttributes.setStringAttributeValue(UpdateEPMFamilyAttributes.java:82)
2025-04-03 16:49:02,329 INFO [RMI TCP Connection(49)-127.0.0.1] wt.system.err wcadmin - at ext.test.UpdateEPMFamilyAttributes.updateFamily(UpdateEPMFamilyAttributes.java:64)

 

HelesicPetr
22-Sapphire II
(To:NK_11091925)

Hi @NK_11091925 

You can not use the persistence adapter to do so this way 😄

Check also my different answer >D

How to update IBA String values on a Part without iterating?

PetrH

@HelesicPetr

Thank you very much for providing the details.

I have successfully updated the family table attribute using the shared approach.

Announcements
Top Tags