There are a few tips that make wiring schematic elements together easier:
Use the coordinates of the schematic element nodes as the wire connection points to ensure connections.
Wire segments need to be orthogonal, trying to add non-orthogonal wires will fail.
Wires added to a schematic cannot form a connectivity loop. Attempting to add wires that create a loop will fail.
Let's look at an example that adds some elements to a schematic and connects them with wires.
In this code we start by adding a schematic named "MySchematic" to the project:
Next we add two schematic elements to the new schematic:
The first element has node 1 located at x = 0, y = 0, with no rotation angle, the second one has node 1 located at x = 2000, y = -2000 and is rotated by an angle of 90 degrees. Next we use the element references to get the coordinates for the nodes we want to connect.
So here we want to connect node 2 of the first element to node 1 of the second element. When adding the wires we will add them in two segments, because one segment between to two coordinates would be non-orthogonal and the system would not accept the add wire request. Adding the wire segments is done through the wires collection on the schematic.
The resulting schematic looks like below:
Here we've used the node objects associated with the schematic to ensure the wires connect correctly and we've added two orthogonal segments to ensure that the wires will be accepted by the schematic object.