proc SCHEMATIC_electrical_diode {} {

make inout -name tp -origin {30 70}
make inout -name tm -origin {150 70}

}

proc ICON_electrical_diode args {
  icon_setup $args {{origin {0 0}} {orient R0} {name d} {on_resistance 1e-7} {off_resistance 1000e9} {von 0}}
icon_term -type inout -origin {-40 0} -name tp
icon_term -type inout -origin {40 0} -name tm
icon_property -origin {-10 30} -label {$name}
  icon_property -origin {-90 160} -type user -name name -default d
  icon_line -40 0 -20 0 -20 -20
  icon_line 20 0 40 0
  icon_property -origin {-90 180} -type user -name on_resistance -default 1e-7
  icon_property -origin {-90 200} -type user -name off_resistance -default 1000e9
  icon_property -origin {-40 70} -text {[if {$off_resistance != 1000e9} {set x "r_off=$off_resistance"}]}
icon_property -origin {-40 50} -label {r_on=$on_resistance}
  icon_property -origin {-200 140} -type fixed -name spice -text {$name $tp $tm  ideal_diode_model}
  icon_line -20 0 -20 20 20 0 -20 -20
  icon_line 20 -20 20 20
  icon_property -origin {-40 -30} -text {[if {$von != 0} {set x "von=$von"}]}
  icon_property -origin {-90 220} -type user -name von -default 0
}

