<< Click to Display Table of Contents >> Create an AutoCAD Properties Link |
This chapter describes how AutoCAD Property Links allow modifying AutoCAD properties like Layer, Color, LineType.
A link with the project created during this chapter is at the end of this chapter.
The table we use in this example has 4 columns. The column rowid is shown by default, but doesn't exist in the table. We want to update the AutoCAD Color and Layer of the P&ID Symbols and Pipe Line Segments. We will later see, that for Equipment Symbols we use the columns LayerName and for Pipe Line Segments we use LayeName Lines. As you can see in the two layer columns, you can also use Plant 3D classes and properties which will later be evaluated by PlantLink when needed.
|
Setting up the Link Configuration
This time we will setup two link configurations. One for Equipment symbols and the other for Pipe Line Segments. To setup a link configuration we need to open the main user interface of PlantLink from the PlantTools ribbon. Next you click on New... to create a new Link Configuration. This opens the PlantLink Wizard. Since we are using an SQLite database you select Data Source File:. For all other data sources you have to use a UDL file. More about this under Use SQL Server, Use MS Access, Use MS Excel. Click on Browse to open the file selector. In this example, the SQLite database is stored in the Related Files folder in our project. After you click Open the Wizard checks if the path to the database file can be change to a relative path. This makes it easier in case you later want to copy the project. Then there is no need to adapt the Link Configuration. We keep the default selection Update AutoCAD P&ID/Plant 3D properties. The other options will be explained in the following chapters. Since this table contains equipment catalog data, we select the Equipment class to map the data from the table to the equipment properties our P&ID symbols. You can select Tables and Views from the database file. But in this case there is just one table available. Now we need to define the linked fields. This essentially tells PlantLink how to find suitable rows/datasets in the table. It more or less filters the table. In this example, we use the Status from the table. There are some standard Conditions available. We select = Equals, because the type of the equipment symbol is used to filter for Status in the table. Select Type which contains the selection list with the various equipment types in our equipment symbols. The option Show warning box if no suitable datasets can be found opens a warning dialog informing you, that PlantLink couldn't find anything based on the linked column/property. Show only suitable datasets when using 'Assign Data' later limits the presented rows/datasets to only the ones where the linked columns/properties meet the set conditions. Otherwise the PlantLink - External Database Viewer will show all rows/datasets from the table. In this case we don't want to see the database viewer, because we are sure, that for each Status there is just one row in the table. Next we define the columns from the table and map them to the AutoCAD properties. The order of the mapping defines the order of the columns when there are multiple choices. Although, this is unlikely for mapping AutoCAD properties, because typically there is just one choice. The option The layer values in the external database may contain formatted values needs to be check, because we use class and property names in the table which need to be evaluated. Meaning, that an expression like [EngineeringItems.Status] will result for example in New. The option for In case of unsuccessful mapping has to options. do not change the current values of object properties means, that the current AutoCAD properties of the symbol or line segment will stay as they are in case PlantLink cannot find a suitable row in the table. use the value from the class symbol as defined in the project configuration means, that in case PlantLink cannot find a suitable row the AutoCAD settings from project setup will be used. The option Behaviour for multiple records controls what should happen, if there are more than one suitable rows/datasets. The default setting is Ask User. In this case the PlantLink - External Database Viewer dialog will show up and the user selects the correct row/dataset. When using Select first matching record PlantLink will just use the first of the found candidates from the table. Since we don't expect multiple choices in the table, we can set this option to Select first matching records. You select the column and the AutoCAD property to which the columns should be mapped. Let's start with Color (Index-no.). This AutoCAD property expects color numbers like 1, 2, 3 for red, yellow, green. There is also the option to use RGB in the table. For Sync Mode we use On drawing save. This ensures, that the mapping for those properties will be refreshed when the drawing is saved, or closed and saved. So when you close and save your drawing, your mapped properties are up-to-date. More details about Sync Mode can be found under Mapping Options. As the second mapping we choose the Layername. Lastly, we define the name of the Link Configuration. The option Use this Link Configuration in PlantDataManager tells PlantDataManager if this Link Configuration can also be used in PlantDataManager. Of course, in PlantDataManager we cannot change AutoCAD properties. Therefore, PlantDataManager will automatically ignore AutoCAD properties link configurations. We now see the Link Configuration in the main dialog of PlantLink and it shows Active. The Link Configuration appearing in alphabetical order. This can become important when Link Configurations depend on each other and must be executed in a certain order (see Rename, Edit, Delete, Deactivate Link Configurations). For the Pipe Line Segments we need a second link configuration. We start again with New... We select the same database file as before. Again AutoCAD Properties. This time we select the Pipe Line Segment class. We select the same table. We link the same column and property. For the Layername we now select LayerName Lines. And finally a name. And now we have two link configurations.
|
Testing the Link Configuration
When we insert a pump symbols it uses the AutoCAD properties setting from project setup while being inserted. When the Assign Tag dialog is closed we see that the symbol is red and the Layer is the same as the Status. When changing the Status in the Property Palette... ...the Color and Layer will change accordingly. Be aware, that the properties change only when your mouse leaves the PropertiesPalette. And again with a different Status. If you type in something which is not in the table... ...then the color and layer defined for this symbol in project setup will be used. If we draw a Pipe Line Segment, then we see the Status used as the first part of the Layer. After saving the drawing the Color will be updated too, because the saving updates the link configurations. If you change the Status the Color and layer will be updated again. When editing a Line Number for the Pipe Line Group, the Layer will be updated too.
|
Next Chapter: Create Drawing Properties Link