Wait or Delay function for 3dxware 10 custom macro

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
AButler
Posts: 6
Joined: Thu Mar 12, 2015 11:25 am

Wait or Delay function for 3dxware 10 custom macro

Post by AButler » Thu Mar 12, 2015 11:30 am

The old software had a wait function that i had to use to keep keystrokes from piling up when using custom macros in AutoCAD 2015. Is there a way to add this into the .XML File?

ngomes
Moderator
Moderator
Posts: 1944
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Wait or Delay function for 3dxware 10 custom macro

Post by ngomes » Thu Mar 12, 2015 1:09 pm

Hi AButler,

If you do not mind getting yourself in to editing driver profiles, you can try the following:
  1. Stop the driver and AutoCAD.
  2. Open the AutoCAD.xml file ("Cfg" directory of the driver installation folder) in a text editor.
  3. Add a new button action of type "MotionMacro" immediately after the <ButtonActions> element.
  4. Save the file.
  5. Start the driver and then start AutoCAD.
  6. Open the "3Dconnexion Properties" panel and then the "Buttons" panel.
  7. Pick the button that you want and look for the new action in the "3Dconnexion" category.
  8. Select (click) the action to assign it.
  9. Return to AutoCAD and press the button that you assigned the new action.
Below is an example of a "MotionMacro" action that will type "asd" pausing for 1 second (1000 ms) after each key press/release events.

Code: Select all

    <ButtonAction Type="MotionMacro">
      <ID>MotionMacro_PressASD</ID>
      <Name>Motion Macro Test</Name>
      <Event>KeyPress(04); KeyRelease(04); Pause(1000); KeyPress(16); KeyRelease(16); Pause(1000); KeyPress(07); KeyRelease(07); Pause(1000); </Event>
      <Increment>0</Increment>
      <Count>0</Count>
      <Sleep>0</Sleep>
    </ButtonAction>
To get the key ID numbers, you can look at how user-created macros are saved. When you use the driver panel, the changes are saved in %APPDATA%\3Dconnexion\3DxWare\Cfg (normally this expands to C:\Users\<user name>\AppData\Roaming\3Dconnexion\3DxWare\Cfg).

AButler
Posts: 6
Joined: Thu Mar 12, 2015 11:25 am

Re: Wait or Delay function for 3dxware 10 custom macro

Post by AButler » Tue Mar 17, 2015 8:01 am

This is the spot in the code i need to add a pause. For this macro i am entering a length to a line then trying to finish the line command then restart the line command by pressing enter again. Problem is the "<KeyPress>28</KeyPress>" is the enter key and if i have 3 in a row it just keeps creating the line without ending the command. So i end up with 2 ".125" lines stacked instead of creating the .125 line then "enter" to accept it followed by "enter" to end the command followed by an "enter" to restart the line command. If i type those keys myself it works but when using the same sequence in the macro it seems to process to fast for AutoCAD. Thanks in advance for any help. I just couldn't see how your code would fit into my .xml file.

Thanks,
Aaron

Code: Select all

 <MacroEntry>
      <ID>Sink Centerline</ID>
      <Sequence>
        <KeyPress>37</KeyPress>
        <KeyRelease>37</KeyRelease>
        <KeyPress>1E</KeyPress>
        <KeyRelease>1E</KeyRelease>
        <KeyPress>1F</KeyPress>
        <KeyRelease>1F</KeyRelease>
        <KeyPress>22</KeyPress>
        <KeyRelease>22</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>

ngomes
Moderator
Moderator
Posts: 1944
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Wait or Delay function for 3dxware 10 custom macro

Post by ngomes » Tue Mar 17, 2015 8:30 am

Hi AButler,

You will need to add the new "ButtonAction" (of type "MotionMacro") to the AutoCAD.xml file in the driver installation directory.

The macro that you posted has the necessary key codes that you will need to use.

AButler
Posts: 6
Joined: Thu Mar 12, 2015 11:25 am

Re: Wait or Delay function for 3dxware 10 custom macro

Post by AButler » Tue Mar 17, 2015 8:54 am

My AutoCAD.xml File doesn't have a <ButtonAction> area. I have <ButtonBank>... I attached my entire code for you to review. This is a new frontier for me. I can usually figure stuff like this out but I guess I'm just not seeing or understanding it correctly. I tried adding the code you supplied in a couple areas but i couldn't get the new button to display.

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AppCfg Default="false" xmlns="" CfgFormatVersion="1.1" ThisFileVersion="1.21">
  <AppInfo>
    <Name>STR_AUTOCAD</Name>
    <ExecutableName>acad.exe</ExecutableName>
    <ApplicationIcon>AutoCAD.ico</ApplicationIcon>
    <Transport>S80</Transport>
  </AppInfo>
  <CfgProperties>
    <InheritsFrom>STR_AUTOCAD</InheritsFrom>
    <Access />
  </CfgProperties>
  <Settings>
    <OverallScale>5.00</OverallScale>
  </Settings>
  <Devices>
    <Device>
      <Name>Standard 3D Mouse</Name>
      <VendorID>0</VendorID>
      <ProductID>0</ProductID>
      <Axis>
        <Enabled>false</Enabled>
        <Input>
          <ActionID>HIDMultiAxis_Rx</ActionID>
          <Min>-512</Min>
          <Max>511</Max>
          <Deadband>0</Deadband>
        </Input>
        <Output>
          <ActionID>HIDMultiAxis_Rx</ActionID>
          <NameID>STR_TILT</NameID>
          <Min>-512.0000</Min>
          <Max>511.0000</Max>
          <Scale>1.0000</Scale>
          <Reversed>false</Reversed>
        </Output>
      </Axis>
      <Axis>
        <Enabled>false</Enabled>
        <Input>
          <ActionID>HIDMultiAxis_Ry</ActionID>
          <Min>-512</Min>
          <Max>511</Max>
          <Deadband>0</Deadband>
        </Input>
        <Output>
          <ActionID>HIDMultiAxis_Ry</ActionID>
          <NameID>STR_ROLL</NameID>
          <Min>-512.0000</Min>
          <Max>511.0000</Max>
          <Scale>1.0000</Scale>
          <Reversed>false</Reversed>
        </Output>
      </Axis>
      <Axis>
        <Enabled>false</Enabled>
        <Input>
          <ActionID>HIDMultiAxis_Rz</ActionID>
          <Min>-512</Min>
          <Max>511</Max>
          <Deadband>0</Deadband>
        </Input>
        <Output>
          <ActionID>HIDMultiAxis_Rz</ActionID>
          <NameID>STR_SPIN</NameID>
          <Min>-512.0000</Min>
          <Max>511.0000</Max>
          <Scale>1.0000</Scale>
          <Reversed>false</Reversed>
        </Output>
      </Axis>
    </Device>
    <Device>
      <Name>SpaceExplorer</Name>
      <VendorID>46d</VendorID>
      <ProductID>c627</ProductID>
      <InheritsFrom>Standard 3D Mouse</InheritsFrom>
      <ButtonBank Default="true">
        <Name>STR_DEFAULT_BUTTONBANK</Name>
        <ID>Default</ID>
        <Button>
          <Input>
            <ActionID>HIDButton_13</ActionID>
          </Input>
          <Output>
            <ActionID>Window Right</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_14</ActionID>
          </Input>
          <Output>
            <ActionID>Window Left</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_3</ActionID>
          </Input>
          <Output>
            <ActionID>F8</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_5</ActionID>
          </Input>
          <Output>
            <ActionID>Chamfer</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_4</ActionID>
          </Input>
          <Output>
            <ActionID>Delete</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_6</ActionID>
          </Input>
          <Output>
            <ActionID>Fillet</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_1</ActionID>
          </Input>
          <Output>
            <ActionID>Macro_AutoCAD_Line</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_15</ActionID>
          </Input>
          <Output>
            <ActionID>Explode</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_9</ActionID>
          </Input>
          <Output>
            <ActionID>Align</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_2</ActionID>
          </Input>
          <Output>
            <ActionID>Sink Centerline</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_10</ActionID>
          </Input>
          <Output>
            <ActionID>Driver_Toggle_3DxNumPad</ActionID>
          </Output>
        </Button>
      </ButtonBank>
    </Device>
  </Devices>
  <MacroTable>
    <MacroEntry>
      <ID>Window Right</ID>
      <KeyStroke>
        <Modifiers>
          <Modifier>Control</Modifier>
        </Modifiers>
        <Key>2B</Key>
      </KeyStroke>
    </MacroEntry>
    <MacroEntry>
      <ID>Window Left</ID>
      <KeyStroke>
        <Modifiers>
          <Modifier>Control</Modifier>
          <Modifier>Shift</Modifier>
        </Modifiers>
        <Key>2B</Key>
      </KeyStroke>
    </MacroEntry>
    <MacroEntry>
      <ID>F8</ID>
      <KeyStroke>
        <Key>41</Key>
      </KeyStroke>
    </MacroEntry>
    <MacroEntry>
      <ID>Delete</ID>
      <KeyStroke>
        <Key>4C</Key>
      </KeyStroke>
    </MacroEntry>
    <MacroEntry>
      <ID>Chamfer</ID>
      <Sequence>
        <KeyPress>6</KeyPress>
        <KeyRelease>6</KeyRelease>
        <KeyPress>B</KeyPress>
        <KeyRelease>B</KeyRelease>
        <KeyPress>4</KeyPress>
        <KeyRelease>4</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>
    <MacroEntry>
      <ID>Fillet</ID>
      <Sequence>
        <KeyPress>9</KeyPress>
        <KeyRelease>9</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>
    <MacroEntry>
      <ID>Explode</ID>
      <Sequence>
        <KeyPress>8</KeyPress>
        <KeyRelease>8</KeyRelease>
        <KeyPress>1B</KeyPress>
        <KeyRelease>1B</KeyRelease>
        <KeyPress>13</KeyPress>
        <KeyRelease>13</KeyRelease>
        <KeyPress>F</KeyPress>
        <KeyRelease>F</KeyRelease>
        <KeyPress>12</KeyPress>
        <KeyRelease>12</KeyRelease>
        <KeyPress>7</KeyPress>
        <KeyRelease>7</KeyRelease>
        <KeyPress>8</KeyPress>
        <KeyRelease>8</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>
    <MacroEntry>
      <ID>Align</ID>
      <Sequence>
        <KeyPress>4</KeyPress>
        <KeyRelease>4</KeyRelease>
        <KeyPress>F</KeyPress>
        <KeyRelease>F</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>
    <MacroEntry>
      <ID>Sink Centerline</ID>
      <Sequence>
        <KeyPress>37</KeyPress>
        <KeyRelease>37</KeyRelease>
        <KeyPress>1E</KeyPress>
        <KeyRelease>1E</KeyRelease>
        <KeyPress>1F</KeyPress>
        <KeyRelease>1F</KeyRelease>
        <KeyPress>22</KeyPress>
        <KeyRelease>22</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
      </Sequence>
    </MacroEntry>
  </MacroTable>
</AppCfg>

AButler
Posts: 6
Joined: Thu Mar 12, 2015 11:25 am

Re: Wait or Delay function for 3dxware 10 custom macro

Post by AButler » Tue Mar 17, 2015 9:09 am

nevermind i was using the file in appdata not the one in the install area. I should work on my reading.

ngomes
Moderator
Moderator
Posts: 1944
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Wait or Delay function for 3dxware 10 custom macro

Post by ngomes » Tue Mar 17, 2015 9:13 am

AButler wrote:nevermind i was using the file in appdata not the one in the install area.
I've been there and done that.

Let us know how you get on.

AButler
Posts: 6
Joined: Thu Mar 12, 2015 11:25 am

Re: Wait or Delay function for 3dxware 10 custom macro

Post by AButler » Tue Mar 17, 2015 9:30 am

Works perfectly. Can i adjust the delay from the (1000)? Thanks again I have been missing that button for about 6 months now. Can i just copy that file in the Installation area to the others people in my dept. I would like to configure all the keys that we use so they would just have to pick the location on the space ball and not worry about programming anything. Also is the a legend that shows what the "key code" is for each key or does it differ based on computer and keyboard?
ngomes wrote:
AButler wrote:nevermind i was using the file in appdata not the one in the install area.
I've been there and done that.

Let us know how you get on.

ngomes
Moderator
Moderator
Posts: 1944
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Wait or Delay function for 3dxware 10 custom macro

Post by ngomes » Tue Mar 17, 2015 9:57 am

AButler wrote:Can i adjust the delay from the (1000)
Yes. The number is in milliseconds. I think you can use anything larger than zero.
AButler wrote:Can i just copy that file in the Installation area to the others people in my dept.
That's one approach. There's another method to distribute "default" profile files: copy them in "%ProgramData%\3Dconnexion\3DxWare\Cfg". Please make sure you test this carefully as I do not recall what takes precedence (if the file in %ProgramFiles%... or in %ProgramData%...).
AButler wrote:Also is the a legend that shows what the "key code" is for each key or does it differ based on computer and keyboard?
That key code is invariant but keyboards are very confusing devices: it is the operating that converts the key code (not exactly the same but equivalent to a "scan code") into an actual character. That conversion is dependant on the "locale" that the target program is set to. If you have AutoCAD.exe running with a German locale, you will get a different key sequence than what the same application would get if run in -- say -- an English locale.

LampyDave
Posts: 1
Joined: Thu Jul 30, 2015 7:20 pm

Re: Wait or Delay function for 3dxware 10 custom macro

Post by LampyDave » Thu Jul 30, 2015 7:23 pm

In case it helps someone, this also works with the CADmouse in this form

Code: Select all

  
<MacroTable>
    <MacroEntry>
      <ID>Excel find xxx</ID>
      <Sequence>
        <KeyPress>E0</KeyPress>
        <KeyPress>9</KeyPress>
        <KeyRelease>9</KeyRelease>
        <KeyRelease>E0</KeyRelease>
        <KeyPress>1B</KeyPress>
        <KeyRelease>1B</KeyRelease>
        <KeyPress>1B</KeyPress>
        <KeyRelease>1B</KeyRelease>
        <KeyPress>1B</KeyPress>
        <KeyRelease>1B</KeyRelease>
        <KeyPress>28</KeyPress>
        <KeyRelease>28</KeyRelease>
        <Pause>250</Pause>
        <KeyPress>29</KeyPress>
        <KeyRelease>29</KeyRelease>
        <Pause>250</Pause>
        <KeyPress>4C</KeyPress>
        <KeyRelease>4C</KeyRelease>
      </Sequence>
    </MacroEntry>
  </MacroTable>
so all the keypresses were entered via the properties box, then the delays - via <Pause>xxx</Pause> added on their own lines to the xml. Thanks for your help finding this.

neodd70
Posts: 2
Joined: Thu May 19, 2016 1:12 pm

Re: Wait or Delay function for 3dxware 10 custom macro

Post by neodd70 » Thu May 19, 2016 1:22 pm

I have the Spacemouse Enterprise and I have tried to adjust the autocad.xml file according to the steps you have provided and then my spacemouse stops working and just shows that there is no application selected. I'm not sure if this is what I need but it looks to be. I want to create a custom macro that lets me type in a few letters then enter then delay for a half to 1 second then another letter and so on. So it looks like this is what I need. The location of the xml file I adjusted is C:\Program Files\3Dconnexion\3DxWare\3DxWinCore64\Cfg which is the only place I can find the autocad.xml aside from the AppData location. Any help you can give would be greatly appreciated.

neodd70
Posts: 2
Joined: Thu May 19, 2016 1:12 pm

Re: Wait or Delay function for 3dxware 10 custom macro

Post by neodd70 » Thu May 19, 2016 1:30 pm

neodd70 wrote:I have the Spacemouse Enterprise and I have tried to adjust the autocad.xml file according to the steps you have provided and then my spacemouse stops working and just shows that there is no application selected. I'm not sure if this is what I need but it looks to be. I want to create a custom macro that lets me type in a few letters then enter then delay for a half to 1 second then another letter and so on. So it looks like this is what I need. The location of the xml file I adjusted is C:\Program Files\3Dconnexion\3DxWare\3DxWinCore64\Cfg which is the only place I can find the autocad.xml aside from the AppData location. Any help you can give would be greatly appreciated.
Here is what it looks like. Am I missing something or did I do it wrong?

Code: Select all

<ButtonActions>
    <ButtonAction Type="MotionMacro">
    </ButtonAction>
    <!-- 
		These are the only ButtonActions that will be displayed to the user.
	-->    

    <!-- Macros -->
    <ButtonAction Type="Macro">
      <ID>Macro_Open</ID>
      <Name>STR_OPEN</Name>
    </ButtonAction>
    <ButtonAction Type="Macro">
      <ID>Macro_Save</ID>
      <Name>STR_SAVE</Name>
    </ButtonAction>
    <ButtonAction Type="Macro">
      <ID>Macro_SaveAs</ID>
      <Name>STR_SAVEAS</Name>
    </ButtonAction>

Post Reply