Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Working on customization task, need to call Part Master object type so for that i need WTPartMaster API.
see attached screenshot for the reference.
Solved! Go to Solution.
It is very simple
if (object instanceof WTPartMaster)// for your case ignore this object.
{
WTPartMaster wtpm = (WTPartMaster) object;
}
You don't need any WTPartMaster API
PetrH
What do you need?
Just use if instance of WTPartMaster and retype the object to the WTPartMaster object.
Thenn you can work with Master as you need. getNumber and so on
Usually if you see master in the structure, it means that the object does not meet filter criteria or the user does not have a access to that object.
Structure filter has a option (check box) to do not show master objects where the filter is not met.
PetrH
Need WTPartMaster API which will help to identify WTPartMaster component/items in BOM, so i can exclude those items from our customized BOM report.
It is very simple
if (object instanceof WTPartMaster)// for your case ignore this object.
{
WTPartMaster wtpm = (WTPartMaster) object;
}
You don't need any WTPartMaster API
PetrH
🤝🤝Thank you
Hi PetrH,
You mean this way only right by considering object as "WTpart"
boolean isPartMaster = isPartMaster(part);
public static boolean isPartMaster(WTObject object) throws WTException {
if (object instanceof WTPart) {
WTPart part = (WTPart) object;
WTPartMaster master = part.getMaster();
return master != null && master.equals(part);
}
return false;
}
You can not use equal test between two different java types that are not connected.
master.equals(part); can not be used or yes you can but you never ever get true return.
WTPartMaster object is not same as WTPart object.
function part.getMaster(); returns always WTPartMaster... from WTPart
It is like you compare a personal car to a track
If you need check if the object is WTPartMaster then use code I've provided.
public static boolean isPartMaster(WTObject object) throws WTException
{
if (object instanceof WTPartMaster)
{
return true;
}
return false;
}
PetrH