In my career, several times I've ended up being the pet programmer for a team of engineers and CNC operators, which frequently meant helping them do automation in their CAD tools. At its peak complexity, it resulted in a (mostly unsuccessful) attempt to build a lens/optics simulator in RhinoCAD.
Which brings us to the code Nick L sends us. It sounds like Nick's in a similar position: engineers write VB.Net code to control their CAD tool, and then Nick tries desperately to get them to follow some sort of decent coding practice. The result is code like:
'Looping Through S_Parts that have to be inital created
For Each Item As Object In RootPart.S_PartsToCreate
If Item.objNamDe IsNot String.Empty Then
If Item.objNamEn IsNot String.Empty Then
If Item.artCat IsNot String.Empty Then
If Item.prodFam IsNot String.Empty Then
If Item.prodGrp IsNot String.Empty Then
'Checking if the Mandatory Properties are in the partfamilies and not empty
If Item.Properties.ContainsKey("From_sDesign") Then
' I omitted 134 lines of logic that really should be their own function
Else
MsgBox("Property From_SDesign is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Else
MsgBox("Property prodGrp is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Else
MsgBox("Property prodFam is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Else
MsgBox("Property artCat is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Else
MsgBox("objNamEn is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Else
MsgBox("objNamDe is missing or empty.", MsgBoxStyle.DefaultButton2, "Information RS2TC")
Exit Sub
End If
Next
All of their code is stored in a single file called Custom.vb
, and it is not stored in source control. Yes, people overwrite each other's code all the time, and it causes endless problems.
Nick writes:
I really wish we'd stop letting engineers code without supervision. Someone should at least tell them about early returns.