AutoCAD MacroMitt

605

7

1

Introduction: AutoCAD MacroMitt

About: IT Manager and CAD Designer with a keen interest in technology for the visually impaired.

In my work I use a small number of AutoCAD commands and keys repeatedly. These include:

  • OSNAP- 将捕获的切换到对象。
  • - 切换正交运动。
  • 皮卡风格- 切换组和单个对象选择(又称组开 /组关闭)
  • CANCEL- pressing the Escape key
  • RETURN- pressing of the Return key

其中一些是乏味的,因为它们需要许多击键,鼠标点击或需要从鼠标中移除我的手来按键。我决定设计并构建一个解决这些问题的解决方案。

This Instructable describes the design, construction and testing of a five key, one handed keyboard for these frequently used functions in AutoCAD.

Such dedicated keyboards are often called MacroPads because they send strings of characters (Macros) to a computer.

This keyboard has been designed to be used specifically with AutoCAD and has been shaped to allow the fingers and thumb of my left hand to rest on the keys comfortably. It is thus possible to press the desired key without having to look.

It resembles a mitten in shape hence the nameMacroMitt.

手掌放在宏观上,将其牢固地放在桌子上。

MacroMitt also features a rotary encoder that is used as a physical volume control. This control is also a button that can be clicked to Play / Pause media.

The keys and controls of MacroMitt could be reprogrammed for other AutoCAD commands or for other software including games.

补给品

3D Printer- I use an Original Prusa i3 MK2 - no longer available but the current version can be found here:Prusa 3d

PLA Filament- 我在这里使用了黑色细丝:Geeetech Black Filament

Arduino Micro-mustbeAtmega32U4based to allow full USB communication with the PC:Arduino Micro

5 off Keyboard switches- I used Cherry MX Red keyboard switches:Cherry Keyboard Switches

5 Off Cherry MX Relecendable KeyCaps:Keycaps

1 off Rotary Encoder:Rotary Encoder

旋转编码器的旋钮:我使用了与此类似的Prusa打印机套件中的备用旋钮:Knob

Stripboard: 64x95mm -Stripboard

6 OFF 3x12mm的自攻螺钉。我使用了此组中的那些:螺丝

1 off 2m Left Angle micro USB charging and data lead:USB Lead

1折叠2.5mm的索环。I used one from this set:Grommets

4脱胶橡胶脚- from stock.

步骤1:设计案例

上的按键MacroMitt必须定位so the fingertips of my left hand rested comfortably on the keytops. I drew a line around my hand resting on a sheet of paper and measured initial dimensions.

I then transferred these dimensions to an AutoCAD drawing. This was then printed out at full size and the positions checked by resting my hand on the printout. Any adjustments were then made to the drawing.

This process was repeated several times until the button positions were satisfactory.

The final AutoCAD DWG file is attached, and a graphic version is shown in the picture.

Step 2: 3D Printing the Case

使用上一步中创建的绘图,使用Microsoft 3D Builder生成了案例的3D模型。

表壳分为三个部分:顶部,底座和电缆夹 - 图片1至3。

电缆夹本可以与基座合并,但这在打印过程中需要大量支撑。

最终图片是爆炸的组装视图。

The three parts were printed in the orientations in the .3mf files using the following settings:

顶部:0.1mm层的高度,20%的填充物,支撑材料

Bottom: 0.1mm Layer height, 20% infill, Support Material Off

Clamp: 0.05mm Layer height, 100% infill, Support Material Off

夹具可以超级粘在底座中的插槽中。确保夹具的方向是正确的,半圆形切口向上 - 请参阅组件视图。

Step 3: Circuit Schematic

电路示意图显示在图片和附加的PDF文件中。它非常简单,包括从密钥开关和旋转编码器到Arduino Micro Pro的连接。

The circuit is powered through the USB cable that also carries the data to the PC.

diagr DWG版本am is included in the next step.

步骤4:电路板

The circuit board is shown in the picture and the attached PDF and DWG files.

建议的施工顺序:

  1. Drill 4 mounting holes (3mm diameter).
  2. Cut copper strips where indicated - I use this tool:布里姆切割器
  3. Solder the onboard blue and green wires into position. The colours are optional.
  4. Solder the header pins into position. I used header pin strips, removing the unwanted pins by pulling them out of the plastic strip with pliers. The remaining pins are then easier to solder into position as they are mechanically stable. It is advisable to remove the unwanted pins to allow wires to pass through neatly.
  5. Solder the Arduino Micro into position.

在此阶段,不焊接外部开关连接到标题引脚。将板安装在案件中时将进行。

Step 5: Assembly - Part 1

Note that the pictures show the key switches and rotary encoder in position. In fact these do not need to be fitted until the next step.

  1. Insert the USB connector into the Arduino Micro and route the wire as shown, snaking above and below the board mounting pillars. This helps to provide some pull protection.
  2. Cut the grommet on one side and push it over the USB cable and down into the slot in the case where the cable emerges.
  3. Carefully fit the circuit board onto the mounting pillars. Fix the board in place with two 3mm screws - do not overtighten or the PLA may break. The other two pillars have protruding pegs.

Step 6: Assembly - Part 2

Important: During this step be careful to keep the soldering iron tip away from the case as the PLA将要melt and deform if heated.

The next step is to connect the key switches and rotary encoder to the circuit board pins.

I used single core insulated wire so that it could be bent into neat paths that would stay in shape.

Remove the key switches and encoder if they have been fitted. Solder suitable lengths of insulated wire to their pins (approx. 10cm). The colours are optional but recommended to make laying out clearer.

从拇指开关开始,将电线的尾部馈入安装孔,然后将开关推入位置。请注意,开关最适合一个特定的方向,将“唐斯”与侧面的“唐”相提并论。

将尾巴弯曲成整洁的路径,通向正确的板销。剥离末端并在相关销周围绕。焊接连接。

重复此过程,直到5个开关连接到板。

Mount the rotary encoder using a washer and nut. The nut will have to be carefully tightened using small needle nose plyers (or a suitable socket driver). Connect the 5 tails to the correct pins.

Cut about 3mm off each of the 6 SPI header pins on the top surface of the Arduino (next to the reset button). This is necessary as the full height pins prevented the case base plate from being fixed in place.

Step 7: Assembly - Part 3

将底座安装到位,确保正确夹紧索环和电缆。

Screw in the 3 fixing screws - do not overtighten.

Affix the 4 rubber feet.

步骤8:添加主键标签和编码器旋钮

The key tops used in this project have removable transparent covers. Good looking keytop labels can thus be created by printing out the required symbols, cutting them to size and placing them under the transparent covers.

The first picture shows the labels I created in using AutoCAD. The DWG and PDF files are attached.

当PDF或DWG文件以A4打印时,每个标签是正确的尺寸-14x14mm。我使用了HL3150颜色激光打印机的兄弟。

The final assembly step is to fit the rotary encoder knob. The knob I had in stock could be pushed down too far so it would not turn or allow the button action to operate. The solution was to 3D print a spacer to be inserted into the knob before pushing it onto the encoder. This is the smallest and quickest to print item I have ever produced! See picture 2.

.3mf文件已连接。

The third picture shows the completed MacroMitt with the keytop labels and encoder knob in place.

The next step is to add the Arduino code to make the MacroMitt functional.

Step 9: Code

The code is shown below and the Arduino .ino file is attached.

使用了三个库:

The Libraries and full documentation can be found via the links.

The listing below includes comments to explain the operation of the code.

Notes:

The Main Loop polls the state of the key switches - if any are pressed the required actions are dealt with by functions at the end of the code.

The main loop also checks the state of the encoder and produces the required outputs (Volume Up, Volume Down and Media Play/Pause).


要发送到PC的字符字符串包含在列表末尾的功能中:


EmulateEscapekey press:

键盘.press(key_esc);

EmulateF8key press (ORTHO toggle):

键盘.press(key_f8);

EmulateF3键按(OSNAP切换):

Keyboard.press(KEY_F3);

EmulateControl-Shift-acombined key press (PICKSTYLE toggle):

键盘.press(key_left_ctrl);

Keyboard.press(KEY_LEFT_SHIFT);

键盘.press('a');

EmulateReturnkey press:

键盘。press(key_return);


要更改为不同的功能,请用所需的键代码替换线或行。

/ /库# include < HID-Project.h > / / https://www.arduino.cc/reference/en/libraries/hid-project/ #include  // https://www.arduino.cc/reference/en/libraries/onebutton/ #include  // https://github.com/mprograms/SimpleRotary // Encoder Pin A, Pin B, Button Pin SimpleRotary rotary(3, 2, 6); //setup buttons with OneButton OneButton button1( 4, // Pin Number ESCAPE true, // Input is active LOW true // Enable internal pull-up resistor ); OneButton button2( 8, // Pin Number ORTHO true, // Input is active LOW true // Enable internal pull -up resistor ); OneButton button3( 10, // Pin Number OSNAP true, // Input is active LOW true // Enable internal pull-up resistor ); OneButton button4( 11, // Pin Number PICKSTYLE TOGGLE true, // Input is active LOW true // Enable internal pull-up resistor ); OneButton button5( 12, // Pin Number THUMB true, // Input is active LOW true // Enable internal pull-up resistor ); void setup() { button1.attachClick(button1click); // Set up button 1 button2.attachClick(button2click); // Set up button 2 button3.attachClick(button3click); // Set up button 3 button4.attachClick(button4click); // Set up button 4 button5.attachClick(button5click); // Set up button 5 Serial.begin(9600); Keyboard.begin(); // Init keyboard emulation Consumer.begin(); // Initializes the media keyboard } void loop() { //Start of main loop button1.tick(); // Read button states button2.tick(); button3.tick(); button4.tick(); button5.tick(); int rDir = rotary.rotate(); //Rotary encoder direction: 0=Stationary 1=Clockwise, 2=Anticlockwise int rBtn = rotary.push(); //Rotary // Encoder- Check direction if ( rDir == 1 ) { // Clockwise Consumer.write(MEDIA_VOLUME_UP); //Increase Volume Serial.print("Encoder turned clockwise"); Serial.println(); } if ( rDir == 2 ) { // Anticlockwise Consumer.write(MEDIA_VOLUME_DOWN); // Decrease Volume Serial.print("Encoder turned anticlockwise"); Serial.println(); } if ( rBtn == 1 ) { Serial.print("Encoder Button Push"); Serial.println(); Consumer.write(MEDIA_PLAY_PAUSE); // Play/Pause Toggle } } // End of Main Loop //FUNCTIONS // This function will be called when button 1 (ESCAPE) is pressed. void button1click() { Keyboard.press(KEY_ESC); //Emulate Escape key press Serial.print("Escape Key Push"); Serial.println(); delay(50); Keyboard.releaseAll(); } // This function will be called when button 2 (ORTHO TOGGLE) is pressed. void button2click() { Keyboard.press(KEY_F8); //Emulate F8 key press Serial.print("F8 Key Push"); Serial.println(); delay(50); Keyboard.releaseAll(); } // This function will be called when button 3 (OSNAP TOGGLE) is pressed. void button3click() { Keyboard.press(KEY_F3); //Emulate F3 key press Serial.print("F3 Key Push"); Serial.println(); delay(50); Keyboard.releaseAll(); } // This function will be called when button 4 (PICKSTYLE TOGGLE) is pressed. void button4click() { Keyboard.press(KEY_LEFT_CTRL); //Emulate Control-Shift-a combined key press Keyboard.press(KEY_LEFT_SHIFT); Keyboard.press('a'); Serial.print("CTRL-SHIFT-a Push"); Serial.println(); delay(50); Keyboard.releaseAll(); } // This function will be called when button 5 (THUMB BUTTON) is pressed. void button5click() { Keyboard.press(KEY_RETURN); //Emulate Return key press Serial.print("Return Key Push"); //Warning: Pressing the Tumb Button (Return) during debugging //can cause freezes as a carriage return is sent to the PC! Serial.println(); delay(50); Keyboard.releaseAll(); }


Connect the MacroMitt to the PC using the USB cable.

使用Arduino IDE或您喜欢的替代方案上传代码。

启动AutoCAD并测试Macromitt的功能。

If there are problems, the Serial Monitor in the Arduino IDE can be used to check the operation of the MacroMitt. Be aware, however, that as the MacroMitt is emulating keystrokes unexpected actions can occur while debugging! For example, I found that the thumb key caused the serial monitor to freeze.

Step 10: Final Thoughts

这是一个令人满意的项目,Macromitt在使用AutoCAD时肯定会提高我的生产率。

Producing a hand shaped case was definitely the most challenging part. Perhaps someone could produce a parameterised version so that MacroMitts can be easily produced for different hand sizes and shapes?

The MacroMitt sits to the left of my workstation with the USB cable disappearing under the keyboard.

我是右撇子,所以我的Macromitt必须是左撇子版本。左撇子需要一个右撇子的宏观运动吗?

Which AutoCAD commands wouldyouput in MacroMitt?

What other software would benefit from a MacroMitt?


I hope that you have found this Instructable interesting. I look forward to your feedback and seeing your versions of this project.

Electronics Contest

这是一个条目
Electronics Contest

Be the First to Share

    Recommendations

    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • 折纸速度挑战

      折纸速度挑战

    评论

    0
    JeremySCook

    8小时前

    Looks like you used an Arduino Micro. An "Arduino" Pro Micro is a different board, but both use the ATMega32U4.

    做得很好,我绝对喜欢有一个大型棒球来加快速度!