Wrench value from your Creo Investments Home Measure the benefits Simple Automation can bring Why
Automate?
A personal way to do PDM Peer to Peer
PDM
3D Drawings Model Based
Design
Smooth out unwanted sharp edges Other
Articles
www.proetoolbox.co.uk - Simple Automation made Simple

Peer to Peer Beta Login Logout

The Peer to Peer PDM Application is provided as open source code. Feel free to use it in any way you wish. I have endeavored to highlight certain functionality deficiencies and no guarantees as to the quality of the code or the principle are implied.

The Application comprises a series of pieces:

  • Node.js; The open source platform under which the core UI app runs
  • GIT; The vaulting mechanism for repositories for Peer to Peer
  • Creo PeerToPeer App; The UI hooks
  • PeerToPeer App; The collection of files that ‘glues’ the UI to GIT via Node
  • Creo App: Copy the App files

    I’ve provided the application core as a zip file.



  • Download the Application from here.
  • Unzip to e.g. d:\PeerToPeer
  • Creo App: If required recompile App to Support Creo Parametric 2.0

    The download contains precompiled code for Creo 3 only.

  • Install JDK 1.6
  • Add Creo Parametric 2.0 pfc.jar to CLASSPATH environment variable
  • Edit d:\peerTopeer\App\code\make.bat
  • Run make.bat
  • Platform: Install node.js

    Node.js is an evented io platform that is open source, free, easy to use and powerful. Peer to Peer PDM relies on it to form the general application logic.

  • Visit and download installer from https://nodejs.org/en/
  • Install Node
  • Install async package (used to provide multi-threaded file operations) into node.js by opening a Command prompt and using this line:
  • a. npm install async

    Platform: Install GIT

    GIT is the world’s leading distributed version management system. Invented by the Linux team, improved over the last 15 years, it dominates Software development workflows especially in open source teams. Peer to Peer PDM relies on it to form the back end. In many ways Peer to Peer PDM is simply a skin over GIT.

  • Visit and download installer from https://git-scm.com/downloads (I tested with GIT 2.5.0)
  • Install GIT
  • System: Check Hosts file specifies localhost to be 127.0.0.1

    The code requires the IP address is 127.0.0.1 for security reasons.

  • As an Admin open in notepad c:\windows\system32\drivers\etc\hosts file.
  • Enter following as a line to map localhost to 127.0.0.1 IP address.
  • a. 127.0.0.1 localhost

    System: Internet Explorer Security Settings

    The Creo UI pieces of the Peer to Peer Solution at times reference Pro/Web.Link Code. This requires that the localhost is defined as a trusted site and also that trusted sites can run unsigned ActiveX controls. There are other options for users running Chromium Based Browser config.pro option, see PTC tech support.

    If you do not do this at some points in the interactions with the App you will see this message from the webpage.

  • Start Internet Explorer separately
  • Pick Internet Options
  • Pick Security Tab, Pick Trusted Sites
  • Add http://localhost as a trusted site
  • Choose to configure the trusted site zone to accept
  • Downloading of unsigned ActiveX controls
  • Enabling scripting of ActiveX controls not marked as safe
  • App: Setup Gitchill.js

    Depending on where you installed GIT and the Peer to Peer app, you will need to edit GitChill.js such that the ‘configuration options’ make sense. Gitchill.js is the ‘main App’ based on clicks inside Creo, different URL’s are sent to the node app running this program and the program handles the logic of what to do per event.

  • Edit D:\peerTopeer\App\gitchill.js in a text editor
  • Check the path to GIT is logical
  • Check the path to where you want to store your repository is logical
  • Check the path to the App directory is logical
  • Change the user name to yours
  • Change the user email to yours
  • Change the workspace path to be where you wish to work from
  • App: Setup d:\peertopeer\p2ppdm.pro

    This file will allow you to specify different repositories without changing the full gitchill javascript app.

  • Change it such that the path matches the likely Repository folder.
  • App: Setup NodeStart.bat

    The NodeStart batch file is used to start up the ‘server’ App to run the Peer to Peer UI. All we need to do is to ensure the various components of the commands in it are correct..

  • Check the path to node.exe is correct, change as required.
  • Check the path to gitchill.js is correct, change as required.
  • Create a shortcut to the NodeStart.bat file and place on your desktop.
  • Test: Test the app starts with no problems

  • Doubleclick the nodestart.bat
  • Allow elevated access to this process if you want folks external to yourself to come through the firewall.
  • Check the setupp directories again
  • App: Adjust protk.dat if required

    If you didn’t install to d:\peertopeer then you need to redirect the protk.dat file.

  • Open it a text editor D:\peerTopeer\App\code\protk.dat equivalent
  • Edit the text_dir value to be correct
  • Creo: Adjust config.pro options

    Some pages still have remnants of Pro/Web.Link in them (so in addition to setup of your IE security settings to enable that API just like you would for using any custom Pro/Web.Link app, you need to also add config options to enable the Pro/Web.Link API). We also need to reference the Peer to Peer Creo App path so that will start with Creo.

  • Edit you config.pro file
  • Add the Pro/Web.Link influencing config options as below
  • Add the Peer to Peer Creo App creotkdat option as below
  • Test: Start Creo

    Assuming the Creo side of the App is configured correctly a UI will result.

    Repo Setup

    In a completely empty install there is no actual repository. The first thing to do is to Pick Initialize P2P Repo.


     
  • Populate the User Name (it will be defaulted to your gitchill.js settings)
  • Populate the Email (it will be defaulted to your gitchill.js settings)
  • Leave Rep Locn to be default (currently there is no handling of non-default)
  • Leave Public Share box checked should you ever wish to collaborate with others
  • Pick Initialize button.
  • Inspect the result which may appear as below
  • Notes:

    The Peer to Peer code calls GIT with a ‘create repository’ command. Based on the response back from that command, the UI is updated.

    Add Files

    In a completely empty install there are no files. The first thing to do is add some files to the repository. Files get added to the repository from the Workspace. So if we didn’t start Creo in the Peer To Peer ‘workspace’ directory then we should change to that directory.

    We create files as we would normally, storing them to the workspace folder on disk. For checking purposes just make a simple box and save it (Peer to Peer PDM works of files on disk, not files in memory).

  • Pick Add files to Rep
  • Pick Check boxes under Action Column for changed files or uncheck boxes for files you DO NOT wish to add (in Peer to Peer you are responsible for relationships so remember Assemblies need parts to regenerate)
  • Pick Stage (this means copy the file up to the repository)
  • Enter a commit message (this is the text which in a couple of months will tell you what you changed)
  • Pick Commit
  • Notes:

    The Peer to Peer code copies file to the repository, stages them and commits them based on your choices in the UI. Based on the response back from those commands, the UI is updated.

    Create A Branch

    In Peer to Peer working you will tend to make your changes in a ‘sandbox’ rather than immediately start changing the ‘master’ branch. The master branch convention being that it is the authoritative source of truth.

  • Pick New Branch
  • Enter a Branch name (cannot have spaces)
  • Pick Create Branch
  • Notes:

    The Peer to Peer code executes a GIT command to create a new Branch based on your choices in the UI. Based on the response back from those commands, the UI is updated.

    Make Changes, Add Files

  • Make new files
  • Add new/modified files to repository and Stage them
  • Commit changes
  • Switch Branch

    In Design you tend to find your ideas are not linear. Branches are where we store those ideas while we are working on them.


     

     
  • Pick Switch Branch
  • Check the checkbox next to the Branch you want to switch to
  • Pick Switch Branch
  • Update In Session

    WARNING: Currently you need to manually erase from memory and reopen. At some point the manual steps will be reworked so that they work when pressing this button. for now you have to do it manually.

    New Branch

    You can have many branches, create another one.


     

     
  • Pick New Branch
  • Create files, stage and commit them
  • Switch Branch

    As more and more branches are created, you’ll find the list available when switching gets longer. Just check the code is showing more than one branch.

    Branch from a Branch

    You don’t have to just create branches from the master, you can branch from any branch.

  • Create a new Branch called e.g. working
  • Create a design assembly and another part, e.g.
  • Save the files, Add the files to the repository.

  • Save the files, Add the files to the repository.
  • Continued in a linear fashion detailing out the design parts of interest…

    Branch History

    As you commit more and more, you’ll sometimes wish to remind yourself what you did.


     
  • Pick Branch History
  • Click on URL’s on left and right to see what they do and make sure they are functional.
  • Branch from Historical Commit

    If you wish to go back in time to fork to another idea, simply click on the commit you wish to go back to and pick Branch Commit.

  • Pick the update workspace command to match the repo button to force a copy back of the files from that point in the past.
  • Pick to retreive the files into memory again
  • Assuming you think ‘yes this is the point I do want to fork from’, create another branch from this branch.
  • Delete Branch

    And you may want to execute a bit of cleanup by deleting the temporary branch name we created


     
  • Pick Delete Branch
  • Pick a branch checkbox to delete
  • Pick Delete button
  • Conclusion

    If you’ve managed to get this far, it is highly likely that you have got a working installation. Congratulations and I hope you find value in the idea. If you have any fixes or improvements made to the code which you’d like to propose and share, contact chrislewis@proetoolbox.co.uk and I’ll look into making a GIT Hub repository of the codebase for folks to fork.

     

    <<Demo Workflow