Program-Independent > Mechanical
Wiring CAD
Contributors:
Nate Johnson
Nate Johnson
How to CAD wires using the custom wiring onshape featurescript
To get started, select the button at the top right of a new sketch. A drop-down menu should appear asking for a link or file.
Paste in the following link to download the correct featurescripts
Select all of the feature scripts from the list that appears
When everything's all said and done, the drop-down menu should look like the bottom image
This feature script uses Onshape variables and custom tables to determine each wire's gauge, color, length, and other important characteristics.
To create your own wiring system, begin by creating a new spreadsheet in Google Sheets, Microsoft Excel, or any other spreadsheet software.
The spreadsheet should include the following column headers
Wire ID
From Ref
To Ref
From Pin
To Pin
Gauge
Color
(The featurescript is case sensitive, so make sure the headers are precisely the same as listed)
For the Wire ID header, a simple letter and number are good enough for the process. For example, if I wanted to route a ground wire, I would put in the column as G1 for ground 1, and for power it would be similar, P1.
This column deals with which devices the wires are going from and to. If we wanted to route wires (in the case of FTC) from the control hub to a motor, we would type in the From Ref column CH fro control hub (or whatever else you want to call it in your file) and in the To Ref you would put in MT for motor.
The next two columns deal with the specific pins the wires go from and to. So for instance (in the case of FRC) if we wanted to route from the ground pin of the PDH to the ground pin of a VRM, we would type in GND1 for both the From Pin column and the To Pin column, or GND2, or GND# for whichever wire you're routing. The case is similar for power, but using PWR instead of GND
The last two columns are self-explanatory; type in which AWG gauge you want for the wire, and type in which color you want the wire to be
So when all is said and done, your spreadsheet should look something like this.
(The pins aren't labeled with numbers as there are only 2 devices)
Then go ahead and download this file as a .csv and we can move onto the actual wiring phase
The featurescript relies heavily on in context editing so create an assembly with all of the electrical components you want
The image is an example that uses the csv file made in the previous stage
On the left side of the screen, open up the "variable table screen" and go ahead and select the "Insert Variable Studio" option and head over to Shared with Me > FTC Teams > FTC Shared Files > Custom Wiring and then select the Wire Defaults variable studio
Import the CSV file into your workspace, and then right-click on the origin, select "Create Part Studio in context," and confirm. Then open up the feature script tab in the top right and select "Wire Data" and then finally select the csv file you imported earlier
This step is more up to you; if you want to make your own connectors and/or cable guides, you can do that, but for this tutorial, I will be using ones already made from the same file the wire defaults came from.
In the part studio you made in context, select the featurescript "Wire connector" and select the connector you want. In the case of FTC, the document that we got the wire defaults from, there are two important connectors, the FTC Power connector and FTC Signal connector.
All you need to do for these is select the connector you want, click the port on the part you want in the assembly, and then orient it to whatever direction you need
The final two steps are to set up the references and route the actual wires. First, select the "Wire ref" featurescript and click the add reference button. If you're using the FTC connector library, all you need to do is highlight the "part" selection box and click the connector on the device listed in the reference. Repeat this step for all the parts you have
To route the wires, select the "Wire route" featurescript and then click "add wire" for each wire. To connect the cables, click the "create cable" option.
If you want to create another cable, just select "Wire route" again and repeat the steps.
To edit the wires and their length and whatnot, if they're cabled, select the first wire and click the "edit wire" button. Then select the dot on the wire where you want to edit and go from there
Finally, insert the wires into your assembly and mate them to your electronics
If you want a video explanation of all this, plus a bit more, in the CAD file of the feature script in the start of this page, there are great video tutorials of how all of this is done