ER/Studio Data Architect allows you to remove all bends from a relationship symbol:
PowerDesigner has no equivalent, so I’ve just written one, as a demonstration of our ability to add functionality to what is already a great product.
I’ve added a ‘Straighten this line’ command to the contextual menu for individual links – it works in any type of model, on most types of link:
Here’s an example before running the command:
and afterwards – the line connects the same two points, and the corners have been removed:
Here‘s how I did it
I added a new extension for all model types, which adds the ‘Straighten this line’ command for all symbols based on the ‘Polyline’:
Here’s the tricky bit, the code for the method (which includes a set of output commands so you can see what it’s doing in the Script tab of the output window). The code has a few steps:
- change the line style if necessary
- If the line has more than just the beginning and end points
- take a record of the coordinates of the destination point
- remove all points except the first one
- adds back the destination point
- refreshes the diagram
Simples!
Sub %Method%(obj)
‘changes the line style to “normal”, then removes all corners
output obj
if obj.CornerStyle <> “0” then obj.CornerStyle = “0” ‘ set the line style to straight
dim dest_point_X, dest_point_Y, Point_Count, current_point
point_count = obj.ListOfPoints.Count
if point_count > “2” then ‘ line has one or more corners
output ” – Initial points: ” & obj.ListOfPoints.AsText
‘ capture the values held in the destination point
dest_Point_X = obj.ListOfPoints.Item.X
dest_Point_Y = obj.ListOfPoints.Item.Y
current_point = Point_Count-1 ‘so that the first link point is not removed
do until current_point = 0
‘remove the last link point in the collection
obj.ListOfPoints.Remove()
current_point = current_point – 1
loop
‘ add a new destination point
obj.ListOfPoints.AddPoint dest_Point_X, dest_Point_Y
output ” – Replaced by points: ” & obj.ListOfPoints.AsText
‘ Refresh the view
ActiveDiagram.RedrawAllViews
end if
End Sub
Hi George,
That is cool that the tool can be customized and extended, but for this specific functionality isn’t that what Right click > Disposition > Horizontal or Vertical do, or the rightmost 2 icons on the Layout toolbar?
Hello Eric, thanks for responding
I produced this extension today when I was specifcally asked how to make relationship lines straight, no matter where the entity symbols are on the diagram.
There are three ways this is different from the standard horizontal/vertical alignment feature:
1. it doesn’t move the end connectors at all
2. it changes the line style to the only one that allows us to have lines with no corners
3. the horizontal / vertical alignment feature only works on links where the joined symbols (e.g. entities) line up horizontally or vertically; this extension works on every link
Thanks for the clarification, George. And good work!
In PowerDesigner 16.5 SP3 intermidiate points could also be removed by Ctrl + left mouse button clicking
You’re right – that’s the manual way of doing it 🙂