33-macros

41
Macros EPLAN Training 1 Macros

Upload: alin-fazacas

Post on 19-Jan-2016

59 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 33-Macros

Macros

EPLAN Training 1

Macros

Page 2: 33-Macros

Macros

EPLAN Training 2

1 Creating Macro Projects...............................................................................3

2 Using Macro Boxes.......................................................................................5

2.1 Generate macros automatically from macro projects................................5

2.2 Recreate macros.......................................................................................9

2.3 Exchange macros ...................................................................................11

2.4 Select macro objects...............................................................................13

2.5 Assign individual objects to a macro box ................................................14

2.6 Move handles..........................................................................................15

3 Creating Placeholder Objects ....................................................................17

4 Extending Placeholder Objects .................................................................22

5 Editing Placeholder Objects ......................................................................24

6 Inserting Macros .........................................................................................26

6.1 Insert window macros and symbol macros .............................................26

6.2 Insert page macros .................................................................................28

7 Creating Macros..........................................................................................31

7.1 Create window macros and symbol macros ...........................................31

7.2 Create page macros ...............................................................................35

8 Creating Macros from DXF / DWG Files....................................................39

This functionality is only available for certain module packages. Info

Page 3: 33-Macros

Macros

EPLAN Training 3

1 Creating Macro Projects

You can use macro projects to manage and automatically create window macros.

Precondition:

You have created a basic project *.epb or project template *.ept .

Project > Management

1. In the Project management dialog you create a new project as described under Creating a Project from a Project Template or Creating a Project from a Basic Project.

EPLAN opens the Project properties: <Project name> dialog.

2. In the Properties tab select the "Settings" category.

The "Type of project" setting will still be displayed.

Page 4: 33-Macros

Macros

EPLAN Training 4

3. Click here in the Value column on the associated field and select the "Macro project" setting from the drop-down list.

4. Click [OK].

The new macro project is created and can be edited like a "normal" project.

Notes:

• Creating a new project is not the only way to create macro projects. You can also first create a schematic project, prepare corresponding schematics cut-outs for the macros to be generated, and then convert to a macro project by changing the project properties. To do this you only have to change the project setting "Type of project" to "Macro project" as described in step 3.

• Macro projects do not contain cross-references, and connections are not generated.

This functionality is only available for certain module packages. Info

Page 5: 33-Macros

Macros

EPLAN Training 5

2 Using Macro Boxes

Use the macro boxes to specify the outline and data for the macros to be generated. You can then use the EPLAN utilities to automatically generate macros from these prepared macros.

When writing window or symbol macros a macro box is also saved in the macro for the specified cut-out. If you insert the macros on project pages, you will have the option of inserting the macro box as well. To do this you have to select the Insert macro boxes too check box (under Options > Settings > Projects > "Project name" > Graphical editing > General). The inserted macro boxes are placed on a certain layer (EPLAN308 = Symbol graphic.Macro.Macro boxes). In layer management you can then specify the settings for this layer.

Special program functions in the macro box enable you to retroactively change the objects associated with an inserted macro and thus exchange variables for a macro, for example.

Notes:

• A macro box cannot be located within a macro box. The inner box is deleted when the macro is written.

• There are no macro boxes in a page macro. The macro name, version, source, etc., are stored on all of the pages available. You can find this data in the page properties under the "Macro" category.

• When compressing projects, there is a setting available for deleting all of the inserted macro boxes in a project. To do this, select the Macro boxes check box (in the Remove placed functions compression settings) and execute the subsequent compression (see also Compress project).

2.1 Generate macros automatically from macro projects

You can use macro boxes to automatically generate macros in macro projects.

Preconditions:

Page 6: 33-Macros

Macros

EPLAN Training 6

• You are in a macro project.

• You have inserted objects on at least one page (e.g., schematics cut-outs, graphics, etc.), from which macros are to be automatically generated.

1. Select Insert > Box / connection point / mounting panel > Macro box.

Page 7: 33-Macros

Macros

EPLAN Training 7

2. Click with the mouse to determine the first corner of the box (request displayed in the status bar).

3. Use the mouse to drag the frame around the desired objects.

4. Click once more with the mouse to determine the second corner of the box.

5. Repeat steps 2-4 until all macro boxes are drawn.

6. Finish this action via the Popup menu > Cancel action.

Page 8: 33-Macros

Macros

EPLAN Training 8

7. Double-click a macro box.

EPLAN opens the Properties <...> dialog.

8. In the Macro box tab specify the data for the macro to be generated. In order to create a macro, you have to specify at least one macro name in the Name field.

9. Click [OK] to confirm your entries and close the Properties <...> dialog.

10. Repeat steps 7-9 for all other macro boxes.

11. Select the menu items Utilities > Generate macros > Automatically from macro project.

The areas identified above the macro boxes are written as window macros (*.ema) in specified directory (default is <Drive_EPLAN>:<Program

Page 9: 33-Macros

Macros

EPLAN Training 9

folder>\<Macros>\<Company code>). When doing this the necessary data is taken from the macro box properties.

2.2 Recreate macros

Using a macro box that is inserted with a macro you have the option of editing the objects associated to a macro and saving the macro anew. Possible changes for the macro objects would be, for example, a symbol exchange for a component, changed data in a properties dialog, or a new value set for a placeholder object.

Preconditions:

• Under Options > Settings > Projects > "Project name" > Graphical editing > General, you have defined that macro boxes must also be inserted.

• You are in a project and have inserted a macro.

1. Make the desired changes to the macro objects.

Page 10: 33-Macros

Macros

EPLAN Training 10

2. Click the associated macro box.

3. Select the menu items Popup menu > Create macro.

EPLAN opens the Save as dialog. The file name and variant of the macro are predefined.

4. Click [OK] to confirm the overwrite.

Page 11: 33-Macros

Macros

EPLAN Training 11

5. Confirm the prompt regarding overwriting the macro variant with [Yes].

2.3 Exchange macros

Using a macro box inserted with the macro you have the option in the schematic of replacing an inserted macro with a different one–for example a different variant – to be swapped.

Preconditions:

• Under Options > Settings > Projects > "Project name" > Graphical editing > General, you have defined that macro boxes must also be inserted.

• You are in a schematic project and have inserted a macro.

1. Click the desired macro box.

Page 12: 33-Macros

Macros

EPLAN Training 12

2. Select the menu items Popup menu > Exchange / rotate / update macro.

EPLAN opens the Macro file selection dialog. If the selected macro is in a pre-defined directory, then the file name is already predefined.

3. Here you select another macro, variant, or nothing. In the latter case the macro is updated.

4. Click [Open].

The macro inserted previously into the schematic is deleted and the new macro is attached to the cursor.

Page 13: 33-Macros

Macros

EPLAN Training 13

5. Position the new macro with a click at the desired position.

Additional dialogs are possible afterwards, if you insert window macros and symbol macros.

2.4 Select macro objects

If you would like to check whether objects belong to a macro (to which a macro box is assigned), there is a function that enables you to do this.

Preconditions:

• Under Options > Settings > Projects > "Project name" > Graphical editing > General, you have defined that macro boxes must also be inserted.

• You are in a schematic project and have inserted a macro.

1. Click the desired macro box.

Page 14: 33-Macros

Macros

EPLAN Training 14

2. Select the menu items Popup menu > Select associated objects.

All objects belonging to the macro are selected.

You can then copy, move, or edit all of the macro objects in a table, for example.

2.5 Assign individual objects to a macro box

Normally, all objects located in a macro box belong to one macro. In a macro project you have the option of changing this macro object assignment.

Preconditions:

• You are in a macro project.

• You have inserted one or more objects in a project page, from which a macro is to be automatically generated, and you have defined the plan of the macro to be created, using a macro box.

1. Select the objects that should belong to the macro. When doing this you can also select objects that are not within the macro box, or exclude objects that do lie within the macro box.

Page 15: 33-Macros

Macros

EPLAN Training 15

2. Click the desired macro box and select the menu items Popup menu > Assign objects to macro box.

The objects are assigned to the macro. You can check the assignment by selecting Popup menu > Select macro box for the respective macro box.

By making this assignment the Individual object assignment check box will be selected in the Macro box tab in the properties dialog. If you want to remove the individual object assignment, you have to deselect the corresponding check box. The associated objects in the macro box will then be back in the future macro.

2.6 Move handles

The handle is defined as the point where the cursor "sticks" when the macro is inserted. Normally, the macro hangs at the "top left" on the first insertion point. Use the macro box to define the position of the handle.

Preconditions:

• You are in a macro project.

• You have inserted one or more objects in a project page, from which a macro is to be automatically generated, and you have defined the plan of the macro to be created, using a macro box.

1. Click the desired macro box.

Page 16: 33-Macros

Macros

EPLAN Training 16

2. Select the menu items Popup menu > Move handle.

3. Move the cursor to the desired position and with a single mouse click define the position where the contact point of the macro is to be located.

When generating macros automatically from the macro project, the handle is also written to the macro with the macro box.

This functionality is only available for certain module packages. Info

Page 17: 33-Macros

Macros

EPLAN Training 17

3 Creating Placeholder Objects

To insert placeholder objects, i.e., to define variables, proceed as follows:

Precondition:

You have opened a page in the graphical editor.

Insert > Placeholder object

1. Drag a frame around the objects for which you wish to define placeholders.

2. In the Placeholder dialog, specify a name for the placeholder object in the Name field.

3. Select the Show preview check box if you would like to display the graphical preview of the selected elements.

4. In the Assignment tab select the Category of elements (for example, devices or revision data) to be displayed.

Page 18: 33-Macros

Macros

EPLAN Training 18

5. Select the Page properties check box if these should also be displayed in the list.

6. Change to the Values tab.

7. Select Popup menu > New variable.

Page 19: 33-Macros

Macros

EPLAN Training 19

8. In the Name new variable dialog specify the name of the new variable. EPLAN will automatically check whether the specified name is valid.

The new variable is inserted as a new cell below the Variable column heading.

9. Select Popup menu > New value set.

10. Specify the new value set in the newly created column.

11. Repeat these steps for all additional variables and value sets to be generated.

Page 20: 33-Macros

Macros

EPLAN Training 20

12. Change back to the Assignment tab.

13. In the Placeholder field, click the desired schematic objects with the right mouse button in order to open the popup menu and select Popup menu > Select variable.

14. In the subsequent dialog select the desired variable and click [OK].

The variable is inserted into the selected column in the form <name_entered>.

15. Repeat this variable assignment for all desired schematics objects.

16. Click [OK].

The new placeholder object is automatically placed on the left above the previously marked area.

Note:

• If you marked nothing when you called the Insert > Placeholder object menu items, you first have to determine the desired object (for example via Edit >

Page 21: 33-Macros

Macros

EPLAN Training 21

Select > Area) (request displayed in the status bar).

• If you have selected individual schematic objects instead of an area, then you must next define the position of the placeholder object with a mouse click (request displayed in the status bar).

This functionality is only available for certain module packages. Info

Page 22: 33-Macros

Macros

EPLAN Training 22

4 Extending Placeholder Objects

In order to expand placeholder objects, select other objects that should also belong to the placeholder object.

Precondition:

The cursor is positioned on a placeholder.

1. Select Popup menu > Select associated objects.

The schematics elements that belong to the current placeholder object are selected.

2. Select other objects to be assigned by holding the [Ctrl] key.

Page 23: 33-Macros

Macros

EPLAN Training 23

3. Right-click the placeholder object and select Popup menu > Assign objects to placeholder object.

The selected objects are assigned to the placeholder object (new).

This functionality is only available for certain module packages. Info

Page 24: 33-Macros

Macros

EPLAN Training 24

5 Editing Placeholder Objects

You are editing placeholder objects by specifying variables.

1. Double-click on the desired placeholder object (graphical symbol of an anchor).

2. In the Placeholder - <Placeholder name> dialog edit the variables in the Assignment tab. Use the popup menu for this as well.

3. Select the Show preview check box in order to display the graphical preview for the selected schematics object, i.e., the location, where the variable value is defined.

4. Edit the value sets in the Values tab. Use the popup menu for this as well.

When opening the placeholder object, EPLAN checks whether all objects defined for the placeholders in the placeholder object are still available. If this is not the case, then an appropriate message is displayed. You can still call the editing mode for the placeholder object. In this case, the object is simply reduced by the number of missing elements.

Page 25: 33-Macros

Macros

EPLAN Training 25

When leaving the cell and closing the dialog with [OK], every specified value is verified for validity for the properties in question. If an error occurs, a message will appear. This check only takes the data type into consideration. This check also takes place after editing a placeholder assignment, but only when the corresponding variable is not empty.

Note:

• It is not possible to block edit multiple placeholder objects.

• When compressing projects there is a compression setting available that enables you to delete all placeholders from a project. To do this, select the Placeholder object check box (in the Remove placed functions compression settings) and execute the subsequent compression.

This functionality is only available for certain module packages. Info

Page 26: 33-Macros

Macros

EPLAN Training 26

6 Inserting Macros

Macros can be inserted on project pages as window or symbol macros. New project pages are created when inserting page macros.

The macros are generally broken up when inserted, but it is still possible to change data via the placeholder objects.

6.1 Insert window macros and symbol macros

Preconditions:

• You have opened a project page.

• Under Options > Settings > User > Display > General you have selected the Open value set selection dialog for placeholders when inserting macros check box.

1. Select the menu items Insert > Window macro or Insert > Symbol macro. Window macros can also be inserted via Popup menu > Insert macros.

EPLAN opens the Select macro dialog.

2. Select the desired macro. If a selected macro has variables, you can use the Variant drop-down list to specify which variant should be inserted.

Page 27: 33-Macros

Macros

EPLAN Training 27

3. Click [Open].

The macro is attached to the cursor and can be positioned wherever you want (one click).

If value sets are available, select a suitable value set for the placeholder in the Value set selection dialog. The inserted components contain the data from the value set.

If there are device tags in the macro, and you have selected the With prompt check box under Options > Settings > Projects > "Project name" > Devices > Numbering (online) in the On insertion of macros and copies group box, EPLAN opens the Insertion mode dialog. Specify here how the device tags in the inserted macro should be numbered.

4. The macro is still attached to the cursor. Insert the macro again if you want.

5. Press [Esc] to finish the action.

Note:

• When positioning the macro with the mouse you can also use the additional following keys: [Y] + mouse movement: The macro can only be moved horizontally on its original position. [X] + mouse movement: The macro can only be moved vertically on its original position. [Y] + [X]: The macro is fixed to its original position and cannot be moved.

• If there are variants in a macro, you can select among the different variants when positioning the macro with the mouse. To do this press [Ctrl] and move the cursor in a circle. The various macro variants are displayed.

• If you return to inserting macros, the most recently selected macro is selected by default in the Select macro dialog.

• Below the graphical preview of the dialog is a comments field. For window and symbol macros, the source project from which the macro originates is displayed here along with the description, if available. For window macros created from DXF / DWG files this field only displays a note regarding their "source" ("DXF" for macros from DXF files; "DWG" for macros from DWG

Page 28: 33-Macros

Macros

EPLAN Training 28

files).

• If the macro box should be inserted with the macro when inserting window or symbol macros, you have to select the Also insert macro boxes check box in the settings (under Options > Settings > Projects > "Project name" > Graphical editing > General).

6.2 Insert page macros

1. Select the menu items Page > Page macro > Insert.

EPLAN opens the Select macro dialog.

2. Select the desired macro. When doing this you can select window (*.ema) or symbol macro file types (*.ems) in the Files of type field in addition to page macros (*.emp).

Page 29: 33-Macros

Macros

EPLAN Training 29

3. Click [Open].

EPLAN opens the Adjust page structure dialog.

4. Here you specify the placement of the new pages in the page structure of your project.

5. In the Adjust page structure dialog, click [OK]. The continuation of this process is the same as for copying pages (see Adjusting the Page Structure).

The pages are created or overwritten.

Note:

• If you return to inserting macros, the most recently selected macro is selected by default in the Select macro dialog.

• Up to 12 pages are shown for page macros in the graphical preview of this dialog. The source project from which the macro originated is displayed below this graphical display in a comments field along with the description and the number of pages, if available.

• The special property "Macro: Inserted by" is available in the page properties for inserting page macros (Category: "Macro"). When manually inserting a page macro, the user who inserted the macro is automatically entered here.

Tip:

You can insert macros using drag and drop, by dragging a selected file from the

Page 30: 33-Macros

Macros

EPLAN Training 30

Windows Explorer into the graphical editor or the page navigator of your project.

This functionality is only available for certain module packages. Info

Page 31: 33-Macros

Macros

EPLAN Training 31

7 Creating Macros

In EPLAN you have the option of saving certain selected elements or areas of project pages as window or symbol macros. In addition, you can save one or more pages as page macros if you have either selected them in the page navigator or opened them in the graphical editor. For all these actions, stored image files are saved along with the macro.

7.1 Create window macros and symbol macros

Precondition:

You are in graphical editing and have either selected the area on the page that contains the elements you want, or selected individual elements ([Ctrl] + mouse click).

Page 32: 33-Macros

Macros

EPLAN Training 32

1. Select the menu items Edit > Create window macro or Edit > Create symbol macro. The menu item Create window macro is also available as an option in the Popup menu after you have selected the elements on the page.

EPLAN opens the Save as dialog. In the Directory field, the default target directory is displayed.

Page 33: 33-Macros

Macros

EPLAN Training 33

2. In the File name field, enter the name of the macro. Click [...] to select another name and / or another target directory.

3. If necessary, select one or more variant designations for the macro in the Variant field. This is an interesting option if you want to create different variants for one macro. By default, one macro is saved as "variant A". You can create up to eight variants for one macro under the same file name.

4. If desired, enter a description of the macro into the Description field. The text entered here is displayed in a comments field when inserting macros and simplifies the selection for you.

5. If the page scale should be taken into consideration when inserting macros, you have to select the To page scale check box.

Page 34: 33-Macros

Macros

EPLAN Training 34

6. Click the Handle button if you want to manually determine the point in the macro on which the cursor depends when inserting.

The Save as dialog will close briefly as it waits for a selection.

7. Move the cursor to the desired position and specify the new location of the handle with a mouse click.

The Save as dialog will open again.

8. Click [OK].

Page 35: 33-Macros

Macros

EPLAN Training 35

The macro is saved to the specified directory under the name <Name>.ema (window macros) or <Name>.ems (symbol macros). EPLAN checks whether a variant already exists under the specified name. If so, you will be requested to decide whether the old macro variant should be overwritten or not.

Notes:

• If nothing is selected on the page, you can still select that area / individual elements after selecting the menu item (request displayed in the status bar).

• Angular and other macro variations are not created automatically, but must be manually generated by you on the project pages, and then finally stored under the same name with a different variant designation. If you have created different variants of a macro, then you can choose between the variants when inserting.

• The macro box is saved in the window or symbol macro according to the specified cut-out.

7.2 Create page macros

If the cursor is on a project page in the graphical editor, you can only save related pages in a page macro. On the other hand, you also can't write unrelated pages into a page macro in the page navigator.

Precondition:

You have opened the page navigator.

Page 36: 33-Macros

Macros

EPLAN Training 36

1. Select the desired page(s) in the page navigator.

Page 37: 33-Macros

Macros

EPLAN Training 37

2. Select the menu items Page > Page macro > Create. Page macros can also be created via Popup menu > Create page macro.

EPLAN opens the Save as dialog. In the Directory field, the default target directory is displayed.

3. In the File name field, enter the name of the macro. Click [...] to select another name and / or another target directory.

Page 38: 33-Macros

Macros

EPLAN Training 38

4. If desired, enter a description of the macro into the Description field. The text entered here is displayed in a comments field when inserting macros and simplifies the selection for you.

5. If necessary, in the Number of pages field specify the number of pages to be written into the macro. The default in this field can only be changed if you have not selected more than one page in the page navigator.

6. Click [OK].

The macro is saved in the specified directory under the name <Name>.emp and EPLAN checks whether a macro with the specified name already exists. If so, you will be requested to decide whether the old macro should be overwritten by the new one or not.

Tip:

You can create page macros with drag and drop, by dragging selected pages from the page navigator of your project into the Windows Explorer.

This functionality is only available for certain module packages. Info

Page 39: 33-Macros

Macros

EPLAN Training 39

8 Creating Macros from DXF / DWG Files

Utilities > Generate macros > From DXF / DWG files

1. In the DXF / DWG files selection dialog select the desired DXF / DWG files.

2. Click on [Open].

3. In the DXF / DWG import dialog select the desired scheme and specify the target directory.

4. Click [OK].

The selected files are saved in the specified directory (default is <Drive_EPLAN>:<Program folder>\Macros\<Company code>) as window

Page 40: 33-Macros

Macros

EPLAN Training 40

macros <original_name>.ema and can be inserted like "normal" window macros in EPLAN. When inserting the resulting window macros, a "DXF" is displayed for macros from DXF files and a "DWG" is displayed for macros from DWG files.

Page 41: 33-Macros

Macros

EPLAN Training 41