CAD

Following are my developments on this topic. This is related to what is exposed in this post. I’m considering making an ExcelCAD add-in. Excel has the basic tools to draw (in the CAD sense of delineate), although it’s not easy to work with them. But this can be get more easily via a macro add-in. To get a CAD add-in, it should perform some computation tasks:
  • intersection between a line an a plane (2D/3D)
  • intersection between two planes (3D)
  • intersection between two segments -lines- (2D/3D)
  • intersection between a conic and a line (2D/3D)
  • intersection between a conic and a plane (2D/3D)
  • intersection between two conics (2D/3D)
  • minimal distance between two points (2D/3D)
  • minimal distance between a point and a line (2D/3D)
  • minimal distance between a point and a plane (2D/3D)
  • minimal distance between a point and a conic (2D/3D)
  • tangents between a point and a circle/sphere (2D/3D)
  • ray-casting algorithm
Some of this computations are nicely explained by Paul Bourke in this link (original post and researchgate PDF). He kindly provides some code. Other source of information came from Rod Stephen’s vb-helper.com. He also has published some books on Graphics computation. I like Dough Jenkins‘s posts on the Excel graphical side. And finally Dan Sunday’s blog is another great source for algebraic computations, although is in C#. We will need some other procedures:
  • reference system traslation
  • reference system rotation
  • scale
  • symmetry
One thing that I really like of CAD software is the use of text commands, instead of the need for the mouse to be chasing the command-buttons to be clicked. But Excel has not this kind of behaviour; the question is, can it be emulated?. I think this is possible via a Text area that always has the focus on it, and tracking the key board inputs. It has to rely on the OnKey method (MS online help). This example assigns “Proc1” to the key sequence CTRL+PLUS SIGN and assigns “Proc2” to the key sequence SHIFT+CTRL+RIGHT ARROW:
Application.OnKey "^{+}", "Proc1" 
Application.OnKey "+^{RIGHT}","Proc2"
This example returns SHIFT+CTRL+RIGHT ARROW to its normal meaning.
Application.OnKey "+^{RIGHT}"
This example disables the SHIFT+CTRL+RIGHT ARROW key sequence.
Application.OnKey "+^{RIGHT}", ""