Creating library in TwinCAT 3 - plc

I have made some "standard" functionblocks that I would like to add to a new library that I can include when making a new project, but for the sake of me I can't figure out how to do it.
On Beckhoffs website it says to create a new library-project from the library template. I don't have that template though, and I just reinstalled TC3 with everything included.
So my question is:
What is the procedure to make a new library in TC3, and how do I add functions to it?

I figured it out.
If you right click on a project under "PLC" in the solution explorer, you get the option to save as a library.
Also, you don't create a library project from a template when you create a new project, as I initially thought. You create an "Empty PLC project" when you add a new item to the PLC folder in an existing project.

Related

Add a new Template in Eclipse for Project Type / Executable

First I'm really new to Eclipse.
I searched a long time for a solution for my problem, and I already found some threads but I can't really follow what they are doing.
So my problem is, I want to add a new "Template" to the New -> C Project -> Project Type - Executable folder in the Wizard.
Like the default "Empty Project" and the "Hello World"
http://s1.directupload.net/images/131027/ktganjqa.png
Somebody know how I can do this?
And it would be nice if you could explain it fully cause, like I'm said, I'm quiet new to Eclipse
Greetz AllesFam
You have to create a plug-in, add a simple definition in the plugin.xml that points to a template.xml where you define what files should be copied to the newly created project.
For simple to average templates, no Java programming is required, the descriptive xml-s are enough.
You can take a look how I added templates to GNU ARM Eclipse Plug-in, the source code is available from the SourceForce git.

How to set up customized project type?

I want to ask how to create a customized project type in Eclipse. For example, when I create my project, a project with some built-in read-only folders will appear and in these folders, some files are added. Any help will be appreciated.
Best regards.
You have to create a New project wizard using the extension point org.eclipse.ui.newWizards.
Then in the implementation you could rely on an existing wizard (look the plug-in spy to get the contributor plug-in of the wizard you are using - select the contribution of the first page in the New wizard, and press Alt+Shift+F3), and override the performFinish method to create your own content. However, you could also create your brand new wizard.
For creating the project/contents, you have to use the Eclipse resources API. A quick tutorial is included in the Java AST tutorial of Lars Vogel - it is Java specific, but has some information about creating files/folders.

How to link two or more projects in Eclipse?

I am trying to develop my application in different Eclipse Java projects where each will contain a certain feature. Then I want to combine them in one complete Java project.
However, I have a problem when linking the sources.
The sub-projects can correctly refer to parent-project classes but some of the source files that are accessed by the parent projects cannot be identified in the sub-projects.
I have a workspace/ParentProject/src/main/resources/file, where in the ParentProject I am accessing with "src\main\resources\" from within Java.
However, at runtime the ChildProject throws an exception that they cannot access the file : 'file:/E:/Eclipse%20workspace/ChildProject/src/main/resources/file'
So, when using a method of the ParentProject from the ChildProject, the classpath is somewhat transfered to the ChildProject. My question is how to resolve this.
I hope I made it clear what the problem is and will be really appreciative for any help.
Regards,
Petar
Btw: It is explained there How to link project in eclipse but I still have the error, that the child project cannot access resources accessed by the parent project.
Although I am not entirely sure what you need to do, it sounds to me that you are trying to create circular dependencies, which is an anti-pattern. You want to avoid creating dependencies where project a depends on project b, but project b also depends on project a. If you provide more details on your use case and what you are trying to create I will be happy to provide some guidance as to how you could structure your dependencies.
Hope this helps.
Right click the Parent project and click properties. Then click Java Build Path on the left hand side. Next click the projects tab. Make sure the Child project is selected as a required project, if it is not Add the Child project.
You should also do this for the Parent Project.

how do I reference a separate project in xcode 4?

How do I reference another project which has code I wish to leverage in XCode 4. In particular I'm trying to make use of the NSDate extensions from here.
Some notes:
I was assuming I should probably reference rather than trying build a framework
I tried copying the existing "Hello World" xcode project file across into my project, however this didn't seem to work
Do I need to create a new "Target" based on "coco touch static library" option?
Then would I need to Edit the current Product Scheme so that when I build the new target would build
What do I need to do on my project side exactly - should going Add Files, and choosing the extensions Xcode Project File be enough?
thanks
I was assuming I should probably reference rather than trying build a framework
yes, reference and link with it, unless you need only a bit of it. at this stage, separating the bits you want may be an advanced topic (depends on the lib's layout/depends as well). you should prefer to reference and link because it will normally minimize your maintenance time, especially if you use it in multiple projects.
I tried copying the existing "Hello World" xcode project file across into my project, however this didn't seem to work
you don't create a project, you add the library's xcode project to your app or library, set the lib as a dependency, add the library to your search paths if needed, then link with the library.
Do I need to create a new "Target" based on "coco touch static library" option?
no
Then would I need to Edit the current Product Scheme so that when I build the new target would build
no. you configure it as a dependency. you may need to alter the lib's build settings if there is a major conflict, which the linker or compiler would point out.
What do I need to do on my project side exactly - should going Add Files, and choosing the extensions Xcode Project File be enough?
start with the process outlined above.
There is no reason to bring in an actually project. Either you can bring in the source files themselves and you could even use the same exact files instead of copying them if you want. However, if you have more than just a few files, and you don't think you will be changing the code much, then creating a static library would probably be the best option.

How to make a new Eclipse project template?

I am using a kind of framework where every time I make a new Java project. I have to arrange the files in the appropriate packages and reference the appropriate external JAR libraries. How do I make a new project template like in the New Project dialog under a new folder?
I've just done a bit of research on this for our own nefarious purposes, and found the answer.
You need to create an Eclipse plugin that uses the org.eclipse.ui.newWizards package. You can define your own category or use an existing one once you find the category ID. To create a new project wizard rather than a new resource wizard, you need to set the "project=true".
Also, your plugin must contain a class that implement org.eclipse.ui.INewWizard. Clicking on the class link from the plugin.xml editor will do the trick.
That class must do all the work in the performFinish override, and must return true to indicate that it actually did its thing and the wizard can close. This is where you create files, directories, set natures, and so forth.
You need to write an Eclipse plugin for that, and concentrate on New Project Wizard.
Writing Eclipse plugins is covered in Stack Overflow question How to write a plugin for Eclipse?.