Add and Delete Links to an Element

                In this discussion you will learn a very handy and important use of Links. Let's take a real scenario, suppose you are working on a big project and the specification of a particular part of the model is taken from a different model or stored in a XML file. If multiple people are working on that project and you don't know where the files are located but you want to make sure that the data is consistent as per CAD/Company standard. In this scenario what you can do is that you can request all the members of your team to create a link to the file where they are referring data from and link it to the element it corresponds to. So just by following the link on element you can straight away go to the resource and see the required information.
               In other scenario suppose you want to modify an element in a dgnfile while reviewing a project. If the element is non-trivial graphic element, probably it would have been much easier and faster if the drafts-man would have linked this element with a key-in that he used for creating this element. Or suppose a particular element has been referred from some website. In that case too you can have a link to the website and attach it with the element so that just by visiting the element you can navigate to the website.
Adding Link:

Tools > Project Navigation > Links > Add Link to Element

Or

Tasks > Drawing Composition > Organize > Add Link to Element

 You can open this dialog box using Key-In "LINKS ADD ELEMENT" too.
All the three above mentioned options are available at your disposal.

  • The first item in the drop-down combo-box is "From File". After selecting this item you can browse to the file using browse button and select the file where you want to make link from. Once you select the file another dialog box pops up showing all the links in that file. You can expand the Link Tree and then select a link from that file and make link to the element.
  • For other two items you can simply write the URL or key-in and then select the element which you want to link it with.

After adding the link to the element we can go to the link by selecting "Follow Link" at the right-click menu of the element.

The above mentioned technique to add link to an element was using "Add link To Element" tool. Moreover, there are multiple ways to add link to an element which might be helpful in many ways. Let's see how they can be used.

  1. In the Project Explorer, Models and Saved view dialogs, directly drag the link with ALT key pressed and drop it into view window. This will start add Link to element tool. Select element to make link to the element. You can add same link to multiple elements. Do a Right click to reset the tool.
  2. In Project Explorer, Models, Saved Views and References dialog box, you have right click menu item "Add Link to Element" which can be used to add link directly from the dialog box without going to the "Add link to Element" tool.

      3.   You can use relative path while attaching links to element. E.g. Your active file is in D:\Project\DGN files\A.dgn and file you want to attach link is in D:\Project\Models\B.dgn, then you can use relative path as "links add element "..\Models\B.dgn". This will add "B.dgn" file link to the element. This will also make the link portable.

Note 1: Double-click  on video to view Full Screen
Note 2: To run this video in Fire fox Click Here to download plug in.

We covered how to add link to element and now we will see how to delete links added to element.

Deleting Link added to Element:

              After adding links you might sometimes need to delete the links from element. This can be done using Element Information dialog box.

              You can do this by selecting the element and in right-click menu selecting "Element Information" and then selecting "Links" tab from that dialog box. In this dialog box you can change its inherent value or delete it. To delete you have to select "Delete Link" right-click menu item.
Element-> Right click - Element Information -> Links Tab.

Note 1: Double-click on video to view Full Screen
Note 2: To run this video in Fire fox Click Here to download plug in.

Selecting elements having links:
You can select elements having links attached to it using "Select Element with Links" at Tools > Project Navigation > Links > Select Element with Links. You have three Key-Ins at your disposal for selecting elements based on Links. These are:

  1.  LINKS SELECT ALL - Selects all the elements having links attached.
  2. LINKS SELECT VALID - Select elements having valid links.
  3. LINKS SELECT INVALID - Select elements with invalid links.

More blogs  are coming up so be there:

  • Just found the LINKS DELETE ALL keyin.  It appears to work but after saving/closing/reopening the file, the links are back

  • Is there a way to globally remove all hyperlinks in a DWG file, preferably through keyin or api call, in OpenBuildings Update 6 or Update 8?

  • Mark,  I'm trying to export an object from one drawing and exporting it into another drawing.  Is this the similiar function? It seems simple but cannot complete the task.  Can you help me on this?

      Doug

  • Hi Evan,

    Check the following macro:

    Sub Add_Link_To_Element()

       Dim startPoint As Point3d

       Dim point As Point3d, point2 As Point3d

       Dim lngTemp As Long

    '   Create link set

       CadInputQueue.SendKeyin "PROJECT TREE CREATE ""Add_Link"" ""<Path to DGN where you want to create link set>\output\DesignModelLink.dgn"""

    '   Add DGN in link set to create DGN link in PE

       CadInputQueue.SendKeyin "PROJECT CREATE LINK FILE ""<Path of the file which user add in PE to create Link in above created link set>\AddLink_ToElement.dgn"""

    '   Start a command "Add Link to element"

       CadInputQueue.SendCommand "MDL KEYIN BENTLEY.DESIGNLINKSAPP,DESIGNLINKS PROJECT SELECTION CLEAR"

       CadInputQueue.SendCommand "MDL KEYIN BENTLEY.DESIGNLINKSAPP,DESIGNLINKS PROJECT SELECTION ADD AddLink_ToElement.dgn_Default"

       CadInputQueue.SendKeyin "LINKS ADD ELEMENT BYSELECTEDNODES"

    '   Coordinates are in master units

       startPoint.X = 1.66987088453309

       startPoint.Y = -7.95835264769266E-05

       startPoint.Z = 0#

    '   Send a data point to the current command

       point.X = startPoint.X

       point.Y = startPoint.Y

       point.Z = startPoint.Z

       CadInputQueue.SendDataPoint point, 1

    '   Send a reset to the current command

       CadInputQueue.SendReset

       CommandState.StartDefaultCommand

    End Sub

    HTH

    Mark