Uploading files

We will try to be very carefull with this one and warn people upfront. As of today, I don’t expect the PLMAPI to store much files by itself. If we believe we want PLM to become spread into more services in order to share some of the ressources accorss multiple domains (PLM is not the only system to consume files why should we have a different setup than ERP?).

But in the mean time, it is nice to have it as an option and we will see later how to interact with files if they are hosted by other services.

With Sails (the framework we use for this project for now) it is pretty easy to add the file api. You just have to run in the command line

sails generate api file

It creates a model and a controller, and you need to create a view for the upload form to start (which can be used in many other context) and a controller method to handle the upload request.

The form

Who said PLMAPI was only about the webservice. Sometimes I like to get into designing some interfaces. Here is the file upload form I made based on a codrop article.

fileuploadform

And this is obviously open source, so the source is here : https://github.com/YMA-MDL/PLMAPI/blob/master/PLMAPI/views/fileupload.ejs

The upload handler – controller method

Once you selected one or more files and push  the upload button, if everything works well, you should get this kind of answer.

uploadresult

How is this done? well, look at the controller : https://github.com/YMA-MDL/PLMAPI/blob/master/PLMAPI/api/controllers/FileController.js

Where is it stored?

For now it just uploads on a local folder but the target is to have each account (an account = a company = multiple users) having to fill some storage informations like an Amazon S3 location and credentials in order to store each companies files on the cloud.

Not a tone of code, right ?

Advertisements

Let’s talk versioning (Keeping it simple and effective)

Now it’s time to get into PLM core stuff ! Versioning !!! BRRrrrrrrr

This is a topic where I can hear about every standard that everyone is setting for his own industry, but in the end, almost no one agree.

My experience with Aras Innovator

Once again, Aras Innovator is a great solution, and it doesn’t target the same people as this project does. But it is a good reference for versionning.

Aras Innovator versions are all lined up. It is somewhat an array of objects, 1 dimension, and every item is a new version of the previous one. they are all linked by a config id which references the first ever version of the item.

GIT

I have seen companies implementing PLM solutions based on source code repositories like CVS, SVN or GIT.

gitgraph

 

And most of the time that is what people want. More and more I see business cases, where some engineers need to work a new version while an existing one has to be versionned for maintenance and fixes purpose. We need to be able to do it.

First Step for PLMAPI

I wanted to make it simple by providing flexibility and somehow being able to branch and merge items.

In order to do that PLM API has a relationship between two parts that is in one way isVersionOf and in the other way is VersionnedBy. This is a many to many relationship.

Plus the version has 3 versionning property:

  • major rev
  • minor rev
  • iteration

Why starting from this?

  • Because every version node in a git graph can have multiple input in their merge and every version can be the source of multiple branches.
  • Because I don’t’ have to automate numbering, people are smart enough to set the right increment on versionning properties. If it impacts the customer increment the major rev, if it doesn’t impact the integration at customers but just behavior and performance maybe, then increment minor.
  • If none of the previous applies then increment the iteration

Too simplistic?

Yeah Maybe ! Or in fact, yes you are exctly write, but that is a start and let’s see in which conditions it breaks and lets improve it then.

The same mechanism will be then applied to documents and other items later if needed (requirement,…)

Any testing available?

Once again, RTFM ! Look at the documentation and test the versionning feature ! it’s available. And if it says that the service is offline, shoot me an email. i’ll make sure to set it back up ASAP.

https://plmapi.readme.io/docs/version-part

Json Diff

If you looked into the technology used by PLMAPI, you realise that most of the data is stored and exchanged in the Json Format.

What is Json?

Json stands for Javascript Object Notation. It is a syntax for storing and exchanging data and it is the best fit when it comes to web projects based on javascript.

W3schools provides a quick shot of what Json looks like :

jsonxml

Who is running the Diff ?

First I’ll answer the “where” question as it is a web project with always a client/server execution. As we propose the diff feature in the API it has to be done on the server.

Now how do we run this? Diff is not that easy, and it contains two process:

  • The diff execution which is the algorithm which will catch all the diffs
  • The diff result formatting, which is how you will show the result of the diff.

So, to start with, the project is using an open source javascript library called jsondiffpatched. You can try the demo here: http://benjamine.github.io/jsondiffpatch/demo/index.html

How can you try it today?

Back to the documentation:

“Ew ! what kind of response this is !!!”

When the differences are just text differences, the response is quite clear, it shows the properties that are different. But when it is about missing properties, then the format looks a bit weird but that how it is. It is then the role of the front-end developpers to make it look nice, like on the library demo page.

delta

That’s a start, for now it compares item properties and first level of BOM. We’ll implement deeper comparaison later.

Ms Excel Testbench

Ms Excel Testbench

Every PLM project starts with Excel ! This is sad for people who love data-quality in an industrial environement, but hey, if you need it to let people play with data and get involved in the project, then let’s do it !
I was already asked a few times if we could have some sort of testbench based on Microsoft Excel to see how we could interact with the API.

I found this great project on github which provides everything need to query REST point via VBA in Excel.

check it out : https://github.com/VBA-tools/VBA-Web

Then I started a first REST call to start this testbench. Here it is

Function GetParts() As String
 ' Create a WebClient for executing requests
 ' and set a base url that all requests will be appended to
 Dim PartClient As New WebClient
 PartClient.BaseUrl = "http://sailstest-yma-mdl.c9users.io:8080/"
 Dim Resource As String
 Dim Response As WebResponse
Resource = "part"
 Set Response = PartClient.GetJson(Resource)
ProcessResponse Response
End Function
Public Sub ProcessResponse(Response As WebResponse)
 If Response.StatusCode = WebStatusCode.Ok Then
 Dim start As Integer
 Dim headersLine As Integer
 headersLine = 3
 start = headersLine + 1
 Dim resultCount As Integer
 resultCount = Response.Data.Count
 Cells(headersLine, 1).Value = "Number"
 Cells(headersLine, 2).Value = "Name"
 Cells(headersLine, 3).Value = "Description"
 Cells(headersLine, 4).Value = "CreatedAt"
 Cells(headersLine, 5).Value = "updatedAt"
 For i = 1 To Response.Data.Count
 Cells(i + start, 1).Value = Response.Data(i)("number")
 Cells(i + start, 2).Value = Response.Data(i)("name")
 Cells(i + start, 3).Value = Response.Data(i)("description")
 Cells(i + start, 4).Value = Response.Data(i)("createdAt")
 Cells(i + start, 5).Value = Response.Data(i)("updatedAt")
 Cells(i + start, 5).Value = Response.Data(i)("test")
 Next
 Else
 Debug.Print "Error: " & Response.Content
 End If
End Sub


PLMAPIExcelTestBench

You can get the file here : https://www.dropbox.com/s/sbxo718t3bhzp11/PLMAPI-TESTBENCH.xlsm?dl=0
It has been made with Excel 2010

 

The PLM API Documentation website

Hi,

Here is a quick message to invite you to go through the API documentation as it is right now. It’s far from a v1 finished state but it gives you an idea about where it goes. Click the image to access the website.

plmapireadme

The testing feature available on each documented rest point is powered by Cloud9 for now. I might deploy heroku instances in a near future but for now it’s convenient and easier to set it up this way. The consequence is that sometimes the server goes off (I haven’t searched why and how often, yet). So if it is off and you want to test it. Just send me an email I’ll power it up ASAP !

The documentation site is powered by readme.io who kindly provides this access freely as the project is Open Source.

What is the difference between PLMAPI and OpenPLM

Today I was asked about the difference between this open source project PLMAPI and an other Open Source project called OpenPLM.

And I don’t need 200 sentences to describe the difference as it is pretty clear.

OpenPLM is an Open Source PLM solution developed in python using the Django framework. What is important here is that it is a Solution. It means that, once installed, you have everything you need from one supplier.

PLMAPI is NOT a Solution. it is a collection of webservices. its a collection of restful services which provides PLM root services like :

  • adding a document
  • adding a part
  • modifying a document
  • modifying a part
  • changing a lifecycle state of an item
  • run an impact analysis on X level
  • create a requirement
  • attach a part in a bill of material

The question might be : “Then what will I do with this?” Well, maybe nothing in the first place, just like you couldn’t do anything when mysql came up. But it provides a service layer on which other software editors can build their solution much quicker.

Let’s start the PLM API Blog !

Hi Everyone, This is a first post to start this blog about PLM api open source project.

I’m Yoann, I’m from France and I’m a big fan of manufacturing and all the IT system that supports it. You can find more about me on my linkedin account.

This Open Source project has been launched a few month ago on the paper, but is really taking off this days. I’m not sure how long it will last. It will mainly depend on how large the project becomes in terms of supporter and contributors.

I won’t explain the whole project right now. I’ll do it soon.

I’ll soon set up all the links like GitHub, readme.io (where the documentation will be) and I leave you with a overview of the main interface for the project portal.

plmapiscreenshot_preview