Turning a folder into a namespace folder

A namespace folder is a folder within the application navigator in which the included objects are automatically declared within a →namespace. The namespace is the name of the namespace folder.

The advantages of a namespace folder are:

  • logi.CAD 3 is updating the namespace in case of actions within the application navigator, for example when objects are moved. This means that you do not have to update the namespace yourself.

  • logi.CAD 3 is validating the objects in a namespace folder based on belonging rules. If – for example – a namespace within an object and the namespace folder do not match, this deviation is immediately reported so that you are able to correct the deviation at once.

How to create a namespace folder:

  1. Make the application navigator visible.

  2. Within the application navigator, create a subfolder below the existing folder Project blocks. Details on how to create: See " Creating new objects and folders ".

  3. Optional: Create the required objects (e.g. POUs and/or data types) in this subfolder.

    Restriction

    Avoid creating POUs with the name of one of the system blocks and declaring them within a namespace. Reason: At present, it is not possible to use language elements with the same name from the global namespace.
    Example: A TON block declared within the namespace Standard might result in the fact that the standard TON block of the global namespace cannot be used. In particular, if Standard is provided as a namespace folder and there is a USING instruction fo this namespace folder.

  4. In the context menu of this subfolder, select Assign Namespace .
    Result:

    • The folder is displayed as a namespace folder with the icon images/download/thumbnails/409862621/IconNamespace-version-1-modificationdate-1531214318282-api-v2.png within the application navigator.

    • The name of the namespace folder is entered as a namespace in the existing objects.

    • If you create a new object in the namespace folder, the name of the namespace folder is also entered as a namespace in the new object. When creating an object, the field Namespace name in the wizard will be disabled.

Example for folders that are turned into namespace folders:

images/download/thumbnails/484245841/Namespace_AppNav01_EN-version-2-modificationdate-1640251946616-api-v2.png

The folders HelperPOUs and myPOUs have been created. Each folder contains 2 function blocks.

images/download/attachments/484245847/Namespace_AppNav02_EN-version-1-modificationdate-1640252025100-api-v2.png

The folders HelperPOUs and myPOUs have been turned into namespace folders. (They are not regular folders any longer.)
Moreover, the namespace folder HelperPOUs contains a USING instruction with the icon images/download/thumbnails/484245873/IconNamespaceUsing-version-1-modificationdate-1640171593962-api-v2.png . Details on creating a USING instruction: See " Assigning USING for accessing a different namespace folder ".

images/download/thumbnails/484245854/Namespace_AppNav03-version-1-modificationdate-1640170187761-api-v2.png images/download/thumbnails/484245854/Namespace_AppNav04-version-1-modificationdate-1640170187751-api-v2.png

The content of one function block of each namespace folder in order to illustrate that the respective namespace has automatically been entered in the function blocks.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg As mentioned in the introduction, logi.CAD 3 updates the namespace within the objects of the namespace folder, when certain actions are executed in the application navigator. Hence, the following is valid:

  • How to change the current namespace for all objects within the namespace folder: Just rename the namespace folder itselft. Details on renaming: See "Renaming resources".

  • How to change the namespace for only one object within the namespace folder: Move the object from the current namespace folder into a different namespace folder. Details on moving: See "Moving resources".

  • How to create a copy of an object within a different namespace folder: Copy the object in the current namespace folder. Then paste the object from the clipboard into a different namespace folder. Details on copying and pasting: See "Copying resources" and "Pasting resources".

  • How to delete namespace for all objects or for only one object within the namespace folder: See " Removing the namespace assignment and namespaces for objects " .

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg After each action in the application navigator check the messages in the Problems view whether deviations are reported. For example, that a namespace in an object and the namespace folder do not match.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg If you change a namespace within the editor of the object yourself and you save the change, a deviation to the namespace folder is also reported by logi.CAD 3. The best practice is to undo the change in the editor of the object.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The name of a namespace folder is also used as namespace for objects that are located in a regular subfolder of the namespace folder.
Example 1: If the namespace folder myPOUs contains a regular folder testing, the namespace myPOUs is also used for the objects within testing. In this case, deviations to the namespace folder myPOUs are reported.
Example 2: If the namespace folder myPOUs contains the namespace folder testing instead, the namespace testing is used for the objects in testing. In this case, deviations to the namespace folder testing are reported.