HELiOS.Interface API (Application Programming Interface)
The HELiOS.Interface API is an API independent of HiCAD with which you can conveniently create, search for or change objects such as projects, documents and articles. The editing of the workflow can also be facilitated with the API.
Example
Below you will find an example for creating an article master:
var session = HiPDM.PdmClrInterface.Instance.CurrentSession; var creator = ApiFactory.CreateInstance<Helios.Interface.Actions.Creation.IApiEntityCreator>(); var element = ApiFactory.CreateInstance<Helios.Interface.Attributes.IApiElementDataFactory>(); var objecttyp = ApiFactory.CreateInstance<IApiObjectTypeFactory>();
var defaultValues = new List<Helios.Interface.Attributes.Data.IApiElementData>();
var meta = query.GetDBAttributeMeta(session, "HEL_SACHNUMMER", objecttyp.CreateArticle()); var data = element.CreateStringElementData("My article no", meta); defaultValues.Add(data);
var wfQuery = ApiFactory.CreateInstance<IApiWorkflowQuery>(); var workflow = wfQuery.TryGetWorkflowFromName(session, objecttyp.CreateArticle(), "Part (R)"); var param = creator.CreateCreateArticleContext(session, null, null, null, defaultValues.ToArray(), workflow);
var result = creator.CreateArticle(param); |