This is your cursor for adding connection.
- The position of the tip of the cone represent the position of the adding connection 
- The axle of the cone represent the orientation and the versus. Notice that versus of adding connections is from tip of the cone to inside it, so, to add a stud connection this is the correct positioning of the cone
- Finally, to add the connection, you have to press the <Space> key. A dialog box appears allowing you to select the TYPE of the connection you are going to add. Select the approriate one and press OK or double click on it.
- Pressing <ESC> you will exit from patch mode and application ask you if new connection should be saved or not.
- The patch file for the specified part will be saved in the \lDraw\Conns folder
In order to allow patched part work correctly, you have to restart the application

The following is a list of the managed connection types:
NotConnection = 0
Stud = 1     
'Stud* part
ToStud = 2    'Is normally in the back of the stud and is where a Stud connection can be stored
PegHole = 3   'PegHole Part
HingeM = 4    'Hinge Male
HingeF = 5    'Hinge Female
MidStud = 6   'Centre of stud2 typical part, store BackStud connections
Belt = 7      'Belt connection (added at runtime only)
Connect = 8   'Connect* Part/subpart
Friction = 10 'Crowned connections
Axle = 11     'Axle part connection
AxleHole = 12 'AxleHole
MidStudUp = 13'Connection among 4 studs up, can connect BackStud2
Gearc = 14    'Gear Connection (added at runtime only)
Rack = 15
ToStudNoHide = 16
'Like ToStud, but show connected studs

TowBallM = 17 'BallJoint BALL (Male)
TowBallF = 18
'BallJoint OpenSphere (Female)

HoseM = 21   
'FlexPart Male (typical a pneumatic air connector)
HoseF = 22   
'FlexPart Female (any flex extremity)
HoseF2 = 25  
'FlexPart Female used when a tube connect with a peghole

FixedM = 23  
'Fixed connection Male to build assembly
FixedF = 24  
'Fixed connection Female to build assembly

BackStud2 = 9
'BackStud Big (Stud4 part)
BackStud = 4  'BackStud Small (Stud3 part) = HingeM connection
'Check if connection type CT1 and CT2 can be connected each other. return mobility grade for the connection
Private Function CanConnect(ByVal CT1 As ConnType, ByVal CT2 As ConnType) As MobT
Select Case CT1
Case ConnType.Stud
   If CT2 = ConnType.ToStud Or CT2 = ConnType.ToStudNoHide Then Return MobT.Fixed
   If CT2 = ConnType.BackStud2 Then Return MobT.Fixed
Case ConnType.BackStud2
   If CT2 = ConnType.Stud Or CT2 = ConnType.MidStudUp Then Return MobT.Fixed
Case ConnType.ToStud, ConnType.ToStudNoHide
   If CT2 = ConnType.Stud Then Return MobT.Fixed
Case ConnType.Axle
   If CT2 = ConnType.AxleHole Then Return MobT.Fixed
   If CT2 = ConnType.PegHole Then Return MobT.RotoTransl
Case ConnType.AxleHole
'If CT2 = ConnType.Axle Or CT2 = ConnType.HingeM Then Return MobT.Fixed
   If CT2 = ConnType.Axle Then Return MobT.Fixed
  
If CT2 = ConnType.BackStud Or CT2 = ConnType.HingeM Then Return MobT.Rotation
  
If CT2 = ConnType.HoseF Then Return MobT.Flex
Case ConnType.PegHole
   If CT2 = ConnType.Connect Then Return MobT.Rotation
  
If CT2 = ConnType.Axle Then Return MobT.RotoTransl
  
If CT2 = ConnType.HoseF2 Then Return MobT.Flex
Case ConnType.Connect
  
If CT2 = ConnType.PegHole Then Return MobT.Rotation
  
If CT2 = ConnType.HoseF Then Return MobT.Flex
Case ConnType.HingeF
  
If CT2 = ConnType.HingeM Or CT2 = ConnType.BackStud Then Return MobT.Rotation
  
If CT2 = ConnType.HoseF Then Return MobT.Flex
Case ConnType.HingeM
   If CT2 = ConnType.HingeF Or CT2 = ConnType.AxleHole Then Return MobT.Rotation
   If CT2 = ConnType.MidStud Then Return MobT.Fixed
Case ConnType.MidStud
   If CT2 = ConnType.BackStud Or CT2 = ConnType.HingeM Then Return MobT.Fixed
Case ConnType.BackStud
   If CT2 = ConnType.MidStud Then Return MobT.Fixed
  
If CT2 = ConnType.AxleHole Or CT2 = ConnType.HingeF Then Return MobT.Rotation
  
If CT2 = ConnType.HoseF Then Return MobT.Flex
Case ConnType.Gearc
   If CT2 = ConnType.Gearc Then Return MobT.Rotation
   If CT2 = ConnType.Rack Then Return MobT.Translation
Case ConnType.Friction
   If CT2 = ConnType.Friction Then Return MobT.Fixed
Case ConnType.MidStudUp
   If CT2 = ConnType.BackStud2 Then Return MobT.Fixed
Case ConnType.TowBallF
   If CT2 = ConnType.TowBallM Then Return MobT.TowBall
Case ConnType.TowBallM
   If CT2 = ConnType.TowBallF Then Return MobT.TowBall
Case ConnType.SlideM
  
If CT2 = ConnType.SlideF Then Return MobT.Translation
Case ConnType.SlideF
   If CT2 = ConnType.SlideM Then Return MobT.Translation
Case ConnType.FixedM
   If CT2 = ConnType.FixedF Then Return MobT.Fixed
Case ConnType.FixedF
  
If CT2 = ConnType.FixedM Then Return MobT.Fixed
Case ConnType.HoseF, ConnType.HoseF2
  
If CT2 = ConnType.Connect Or CT2 = ConnType.HoseM Or CT2 = ConnType.BackStud Or CT2 = ConnType.Axle Or CT2 = ConnType.HoseF Or CT2 = ConnType.AxleHole Or CT2 = ConnType.HingeF Or CT2 = ConnType.PegHole Then Return MobT.Flex
Case ConnType.HoseM
  
If CT2 = ConnType.HoseF Then Return MobT.Flex
End Select

Return
MobT.NotConnected
End Function
Furthermore, to quick add most common connections, while in patch mode, you can press <ALT-P> again (or more times) to switch to a better tool for adding connections, so you can find a connector, a 1x1 brick, some hinges and other.

Plus, you can load any part and use it as a tool for adding connections. The application itself add all correct connections that are inside the patching part accordling to the previous tables.

So, consider this example: patching the yellow part using loaded part 481.DAT.
Part 481.DAT has 2 HingeM connections in the sloped left part and 4 AxleHole connections in the round right part.
Pressing <Space> with the green part in that position, will cause the two HingeF(emale) connections to be added where the green patch tools enters the yellow part. The AxleHole connections are outside the surrounding box of the yellow part and will not be added

Debug Version - Patching mode

When you start the debug version of SR 3D Builder, you don't see the preview of the parts.
When you load a model or a part, you will see a little segment wherever a connection is found and recognized.

Any connection is defined by Type, Position, Orientation, Versus. For example a Stud connection has
Type = Stud
Position = position of the stud
Orientation = orientation of the stud, typical vertical
Versus = from bottom to top

So you can imagine the connection as an arrow starting from the centre of the base of the stud and exiting from the top centre of the stud. All these information are required to correctly identify a working connection.
The debug version of the program has a tool that simplify introducing these data

If you need to patch a part, you have to do the following:
- Clear the model
- Load the specified part
- Centre the part in the model window using the 'reset view' button
- Press <ALT-P> to enter patch mode. You will see a small green cone you can move and rotate.
And here is how the connections interact each others and what mobility generates (this is an extract from the source of my application, but it is easy to understand):

CT1 and CT2 are the connection type of the two involved connection
Using this technique is fast, but can sometimes add unwanted connections for example when the patching tool part you are using has connections that cannot be placed outside the patching part. In this case (and better in all cases) check the patch file to ensure that only the correct connections has been added.

REMEMBER: all connections of the patching tools that are inside the patching part will be added

If anybody of you patch any part and tested them correctly, please send me so I share them with the community.

This will be a good help for everybody