Switch Symbols |
I initially had a single switch call that handled many different types of switches. However, that made the function very complicated to use. So I cut back to defining several types. Like Toggle, Slide, Push Button, etc..
Switch (Toggle || Slide) (SPST || SPDT || DPST || DPDT) |
Description: Draws a Toggle Switch starting at point Lib_S_Start_X, Lib_S_Start_Y.
Where:
Lib_S_RefDes - Reference Designator = "S1" || "S2" || etc.
Lib_S_Label - Switch Label = "None " || "Power" || "On/Off" || etc.
Lib_S_Type - Switch Type = "Toggle" || "Slide"
Lib_S_Contact - Switch Contact = "SPST" || "SPDT" || "DPST" || "DPDT"
Lib_S_End_Swap - Switch Ends = "Norm" || "Swap"
Lib_S_Label_Flip - Flip RefDes/Label = "Norm" || "Flip"
Lib_S_Rot - Switch Rotation = "R0" || "R90", || "R180" || "R270" degrees
To create DP, 3P, or 4P switches, use multiple instances of the SPST or SPDT switch.
The table below is just for testing purposes and does not include all of the possible parameters that can be passed. Parameters like Lib_S_RefDes and Lib_S_Label can be any ascii string.
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
S1 Power |
|
Lib_S_RefDes | Switch Reference Designator ("S1" || "S2" || "S1-A"). |
|
|
Lib_S_Label | Arbitrary Switch Label ("Power" || "On/Off" || etc.) |
|
|
Lib_S_Type, Lib_S_Contact | Type - "Toggle" || "Toggle Ctr Off" || "Slide" Contact "SPST" || "SPDT" || "DPST" || "DPST Inv" || "DPDT" |
|
|
Lib_S_End_Swap, Lib_S_Labels_Flip | Switch Ends ("Norm" || Swap") RefDes/Label ("Norm" || Flip") |
|
|
Lib_S_Rot | Rotation Angle, CCW. |
|
|
Lib_S_Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark, Pins (green dot). |
|
Lib_S_Center_Y | Symbol Center Y Position |
Return: The switch In_X/Y and Out_X/Y are returned. In the case of Double Pole switches, InA_X/Y, InB_X/Y, OutA_X/Y and OutB_X/Y will be returned.
Note: A Lib_S_Swap value of "Swap" will swap the switch inputs and outputs. A Lib_S_Label_Loc value of "Flip" will flip the RefDes and Label from above to below the switch.
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
// Declare and Set the center point.
var S1_Center_X = ??; var S1_Center_Y = ??;
// Declare the switch return variables (C, NO, NC, Return[]).
var S1_C_X, S1_C_Y, S1_NO_X, S1_NO_Y; S1_NC_X, S1_NC_Y; var S1_XY_Return = new Array();
// Draw the symbol.
S1_XY_Return = TO_SL_Switch( Dwg_Obj, "S1", "Power", "Toggle_CO", "SPDT", "Norm", "Norm", "0", S1_Center_X, S1_Center_Y );
// Extract the switch end points (C, NO, NC) from the return array.
S1_C_X = S1_XY_Return[0]; S1_C_Y = S1_XY_Return[1];
S1_NO_X = S1_XY_Return[2]; S1_NO_Y = S1_XY_Return[3];
S1_NC_X = S1_XY_Return[4]; S1_NC_Y = S1_XY_Return[5];
Toggle_Switch (SPST, SPDT, DPST, and DPDT) |
Description: Draws a Toggle Switch starting at point Lib_S_Start_X, Lib_S_Start_Y.
Where:
Lib_S_RefDes - Reference Designator = "S1" || "S2" || etc.
Lib_S_Type - Switch Type = "Toggle" || "Slide"
Lib_S_Funct - Switch Function = "SPST" || "SPDT"
Lib_S_Rot - Switch Rotation = "R0" || "R90", || "R180" || "R270" degrees
To create DP, 3P, or 4P switches, use multiple instances of the SPST or SPDT switch.
The table below is just for testing purposes and does not include all of the possible parameters that can be passed. Parameters like Lib_S_RefDes and Lib_S_Label can be any ascii string.
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
S1 Power |
|
Lib_S_RefDes | Switch Reference Designator ("S1" || "S2" || "S1-A"). |
|
|
Lib_S_Label | Arbitrary Switch Label ("Power" || "Enable" || etc.) |
|
|
Lib_S_Funct | Switch Function, "SPST" || "DPST", "SPDT-A" Type A and B, and "SPDT" Type A and B) |
|
|
Lib_S_Swap | Switch End Swap ("No-Swap" || Swap") |
|
|
Lib_S_Label_Loc | Switch RefDes/Label Location "" || "Norm" = Above, "Flip" = Below |
|
|
Lib_S_Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark, Pins (green dot). |
|
Lib_S_Center_Y | Symbol Center Y Position |
Return: The switch In_X/Y and Out_X/Y are returned. In the case of Double Pole switches, InA_X/Y, InB_X/Y, OutA_X/Y and OutB_X/Y will be returned.
Note: A Lib_S_Swap value of "Swap" will swap the switch inputs and outputs. A Lib_S_Label_Loc value of "Flip" will flip the RefDes and Label from above to below the switch.
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
// Declare and Set the center point.
var S1_Center_X = ??; var S1_Center_Y = ??;
// Declare the switch return variables (C, NO, Return[]).
var S1_C_X, S1_C_Y, S1_NO_X, S1_NO_Y; var S1_XY_Return = new Array();
// Draw the symbol.
S1_XY_Return = Toggle_Switch( Dwg_Obj, "S1", "Power", "SPST", "No-Swap", "Norm", S1_Center_X, S1_Center_Y );
// Extract the end points (C, NO) from the return array.
S1_C_X = S1_XY_Return[0]; S1_C_Y = S1_XY_Return[1]; S1_NO_X = S1_XY_Return[2]; S1_NO_Y = S1_XY_Return[3];
Slide_Switch (SPDT and DPDT) |
Description: Draws a Slide Switch starting at point Lib_S_Start_X, Lib_S_Start_Y.
Where:
Lib_S_RefDes - Reference Designator = "S1" || "S2" || etc.
Lib_S_Funct - Switch Function = "SPST" || "DPDT"
Lib_S_Rot - Switch Rotation = "R0" || "R90", || "R180" || "R270" degrees
To create DP, 3P, or 4P switches, use multiple instances of the SPST or SPDT switch.
The table below is just for testing purposes and does not include all of the possible parameters that can be passed. Parameters like Lib_S_RefDes and Lib_S_Label can be any ascii string.
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
S1 Power |
|
Lib_S_RefDes | Switch Reference Designator ("S1" || "S2" || "S1-A"). |
|
|
Lib_S_Label | Arbitrary Switch Label ("Power" || "Enable" || etc.) |
|
|
Lib_S_Funct | Switch Function, "SPST" || "DPST" |
|
|
Lib_S_Swap | Switch End Swap ("No-Swap" || Swap") |
|
|
Lib_S_Label_Loc | Switch RefDes/Label Location "" || "Norm" = Above, "Flip" = Below |
|
|
Lib_S_Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark, Pins (green dot). |
|
Lib_S_Center_Y | Symbol Center Y Position |
Return: The switch In_X/Y and Out_X/Y are returned. In the case of Double Pole switches, InA_X/Y, InB_X/Y, OutA_X/Y and OutB_X/Y will be returned.
Note: A Lib_S_Swap value of "Swap" will swap the switch inputs and outputs. A Lib_S_Label_Loc value of "Flip" will flip the RefDes and Label from above to below the switch.
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
// Declare and Set the center point.
var S1_Center_X = ??; var S1_Center_Y = ??;
// Declare the switch return variables (C, NO, NC, Return[]).
var S1_C_X, S1_C_Y, S1_NO_X, S1_NO_Y; S1_NC_X, S1_NC_Y; var S1_XY_Return = new Array();
// Draw the symbol.
S1_XY_Return = Slide_Switch( Dwg_Obj, "S1", "Power", "SPDT", "No-Swap", "No-Swap", "Norm", S1_Center_X, S1_Center_Y );
// Extract the switch end points (C, NO, NC) from the return array.
S1_C_X = S1_XY_Ret[0]; S1_C_Y = S1_XY_Ret[1]; S1_NO_X = S1_XY_Ret[2]; S1_NO_Y = S1_XY_Ret[3];S1_NC_X = S1_XY_Ret[4]; S1_NC_Y = S1_XY_Ret[5];
Rotary Switch |
Description: Draws a Rotary Switch that has from 3 to 8 contacts. The contacts rotate Counter Clock Wise (CCW) starting at the Start angle for the Span angle specified. The table below illustrates the limitations.
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
S1B |
|
Lib_S_RefDes | Switch Reference Designator ("S1" || "S2" || "S3). |
|
|
Lib_S_Label | Arbitrary Switch Label ("Power" || "Enable" || etc.) |
|
|
Lib_S_RSW_NPos | Switch Positions (1 to 8) |
|
|
Lib_S_RSW_Start_Ang | Start Angle, Rotation CCW (0 = Center Right). |
|
|
Lib_S_RSW_Span_Ang | Span Angle, Rotation CCW (360° = Spread evenly over 360°). |
|
|
Lib_S_RSW_Rot_Dir Not Implemented |
Rotation Direction ("CW", "CCW"). |
|
|
Lib_S_Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark, Pins (green dot). |
|
Lib_S_Center_Y | Symbol Start Y Position |
Return: The draw function will return the X/Y coordnates for the Common and each switch position (2, 3, 4, 5, 6, 7, 8, 9, 10).
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
var RSW_Info = [ "S1B", "Power", 4, 0, 180, "CW" ];
S1B_Rtn = Rotary_Switch( Dwg_Obj, RSW_Info, S1B_Start_X, S1B_Start_Y );
S1B_C_X = S1B_Rtn[0]; S1B_C_Y = S1B_Rtn[1];
S1B_P1_X = S1B_Rtn[2]; S1B_P1_Y = S1B_Rtn[3]; S1B_P2_X = S1B_Rtn[4]; S1B_P2_Y = S1B_Rtn[5];
S1B_P3_X = S1B_Rtn[6]; S1B_P3_Y = S1B_Rtn[7]; S1B_P4_X = S1B_Rtn[8]; S1B_P4_Y = S1B_Rtn[9];
Relay |
Description: Draws a Relay that consists of a Relay Coil and one, or two, sets of Switch Contacts. The contacts can be SPST || SPDT || DPDT. The Relay can also be rotated CCW, in it's entirety, 0 || 90 || 180 || 270 degrees.
The table below is only meant as an example, meaning that, RefDes and Voltage are not limited to the available selections from the drop down menu. They can be anything, as long as they are wrapped in quotes on the command line.
Parameter | Description | Example | |
---|---|---|---|
Lib_S_Dwg_Obj | jsGraphics Object that points to the drawing. |
K1 12VDC |
|
Lib_S_RefDes | Reference Designator (K1 || K2 || K3). |
|
|
Lib_S_Voltage | Relay Coil Voltage (5VDC || 6VDC || 12VDC) |
|
|
Lib_S_Type | Relay Contact Type (SPST || SPDT || DPDT) |
|
|
Lib_S_Coil_pins, Lib_S_Switch_pins, Lib_S_Label_Loc | Flip Coil || Flip Switch || Label Loc |
|
|
Lib_S_Rot | Rotation Angle, CCW. |
|
|
Lib_S_Center_X | Symbol Center X Position |
Show/Hide Grid (10x10), Center Mark, Pins (green dot). |
|
Lib_S_Center_Y | Symbol Center Y Position |
Return: The draw function will return the X/Y coordnates for the Relay Coil terminals (e.g. K1-C_X/Y) and each switch position (e.g. K1-A_Common_X/Y, K1-A_NO_X/Y, K1-A_NC_X/Y).
Usage: The selections from the table above, are used to create the example below. After selecting and entering your specific information, the example can be used directly, with a copy/paste. The items in Red are the only ones that need to be adjusted to your specific needs. The lines in Green are just comments and can be deleted. Due to space limitations, some of the lines below may be split onto more than one line.
// Declare and Set the center point.
var K1_Center_X = ??; var K1_Center_Y = ??;
// Declare the coil and switch return variables (CA, CB, Sw_Com, Sw_NO).
var K1_CA_X, K1_CA_Y, K1_CB_X, K1_CB_Y;
var K1_A_Com_X, K1_A_Com_Y, K1_A_NO_X, K1_A_NO_Y; var K1_XY_Return = new Array();
// Draw the symbol.
K1_XY_Return = Relay( Dwg_Obj, "K1", "12VDC", "SPST", "Norm", "Norm", "Norm", 0, K1_Center_X, K1_Center_Y );
// Extract the end points from the return array.
K1_CA_X = K1_XY_Return[0]; K1_CA_Y = K1_XY_Return[1];K1_CB_X = K1_XY_Return[2]; K1_CB_Y = K1_XY_Return[3];
K1_A_Com_X = K1_XY_Return[4]; K1_A_Com_Y = K1_XY_Return[5];
K1_A_NO_X = K1_XY_Return[6]; K1_A_NO_Y = K1_XY_Return[7];