其他分享
首页 > 其他分享> > windchill创建部件

windchill创建部件

作者:互联网

public static WTPart createPart(String number, String name, String unit, boolean endItem, Folder folder,
			WTUser user, String softType) throws WTException, WTPropertyVetoException {
		// SessionHelper.manager.setAdministrator();
		WTPart part = WTPart.newWTPart();
		if (StringUtils.isNotBlank(number)) {
			part.setNumber(number);
		}
		View view = ViewHelper.service.getView("Design");
		part.setView(ViewReference.newViewReference(view));//设置默认视图
		part.setName(name);
		part.setDefaultUnit(QuantityUnit.toQuantityUnit(unit));//设置单位
		part.setEndItem(endItem);
		FolderHelper.assignLocation((FolderEntry) part, folder);//更改存放文件夹
		VersionControlHelper.assignIterationCreator(part, WTPrincipalReference.newWTPrincipalReference(user));// 修改对象的创建者
		VersionControlHelper.setIterationModifier(part, WTPrincipalReference.newWTPrincipalReference(user));// 更新者
		if (StringUtils.isNotBlank(softType)) {
			TypeIdentifier id = TypeIdentifierHelper.getTypeIdentifier(softType);// 设置部件类型
			System.out.println(TypeIdentifierHelper.getTypeIdentifier(softType));
			part = (WTPart) CoreMetaUtility.setType(part, id);
		}
		part = (WTPart) PersistenceHelper.manager.save(part);
		// logger.debug("====>create wtpart " + number + " success");
		return part;
	}

标签:windchill,WTPart,softType,创建,部件,number,part,user,String
来源: https://blog.csdn.net/qq_32169593/article/details/119454085