NEC code viewer



Forums support

There is a user script for most browsers that allows nec models posted on digitalhome.ca forums to be viewed inline. The script simply searaches for code blocks containing valid nec code and inserts a small frame that displays the model. There are few installation variants:

  1. user script for Firefox with Greasemonkey and IE8,9 with Trixie, and
  2. another one for Chrome users.
  3. Safari users may try to install the Firefox user script as described here
  4. On IE10 (and may be other browsers) one can use the demo bookmarklet below. Just add it to you bookmarks toolbar and press it whenever you have a model you want to see.

The actual nec to model conversion happens when you click on the model link, so the overall process does not slow the page load!

A demo of this functionality can be observed by pressing on this bookmarklet. As a result of it, a models section wiil be added to the nec code.

Code:
CE
SY aradius=0.003175
SY rradius=0.003175
SY fradius=aradius

SY feed=0.066219' 0.02, 0.2

SY b=0.1442197' 0.05, 0.75
SY a1y=0.1385343' 0.05, 0.7
SY a1z=0.1860493' 0.05, 0.6
SY gap=0.02512351' 0.025, 0.3
SY a2y=a1y+feed-gap'this is to avoid self intersection since gap is to be > radius+2.5mm
SY a2z=0.1362141' 0.05, 0.6
SY a3y=0.489115' 0.05, 0.6
SY a3z=0.05699361' 0.05, 0.6

SY x=-0.06365954' -0.4, -0.05
SY _g1=-0.02006255' -0.045, 0.045
SY _g2=0.01748137' -0.045, 0.045
SY _g3=-0.03600042' -0.045, 0.045
SY g1= max(0, _g1)
SY g2= max(0, _g2)
SY g3= max(0, _g3)
SY l1=0.6979379' 0.1, 0.7
SY l2=0.3311583' 0.1, 0.7
SY l3=0.2311463' 0.1, 0.7
SY rwidth = max(l2+g2, max(l1+g1, l3+g3))

SY dz1=0.04561453' 0.02, 0.4
SY dz2=0.1231853' 0.02, 0.4
SY dz3=0.1546767' 0.02, 0.4

SY z1 = dz1
SY z2 = z1+dz2
SY z3 = z2+dz3


SY ay1=feed+a1y
SY ay2=feed+a1y-a2y
SY ay3=feed+a1y-a2y+a3y
SY ay4=feed+a1y-a2y+a3y+b
SY az1=a1z
SY az2=a1z+a2z
SY az3=a1z+a2z+a3z

SY width = max(rwidth, max(ay4,ay1))
SY height = max(z3, az3)


GW 1 5 0 feed 0 0 ay1 az1 aradius'#00f
GW 2 5 0 ay1 az1 0 ay2 az2 aradius'#00f
GW 3 10 0 ay2 az2 0 ay3 az3 aradius'#00f
GW 4 3 0 ay3 az3 0 ay4 az3 aradius'#00f
GW 5 14 x g1 z1 x g1+l1 z1 rradius'#0f0
GW 6 7 x g2 z2 x g2+l2 z2 rradius'#0f0
GW 7 5 x g3 z3 x g3+l3 z3 rradius'#0f0
GX	20	010
GX	40	001
GW 100 5 0 -feed 0 0 feed 0 fradius'#f40
GE	0
LD	5	0	0	0	24900000
GN	-1
EK
EX 0 100 3 0 1
FR	0	0	0	0	300	0
EN

					

Limitations

There are some minor limitations on the nec2 code that can be converted:

  • TL cards and NT cards have no visualization

License

This website uses the javascript libraries Raphael, Sylvester and JSEP which are covered by MIT license.

All other sources from this website can be used under the GPL v3.


Valid XHTML 1.0 Strict

Copyright 2013 Nikolay Mladenov.
nikolay dot mladenov at gmail dot com