Wait or Pause after SendCommand

Wait or Pause after SendCommand

ace_guru
Advocate Advocate
1,706 Views
2 Replies
Message 1 of 3

Wait or Pause after SendCommand

ace_guru
Advocate
Advocate

 

Hey Folks,

 

Looking at trying to do something new, from my point of view.

 

The idea is as follows;

  1. Find current layer
  2. Make current layer equal wipeout layer.
  3. Start wipeout command
  4. Change back to original layer

Coding is as following.

 

Sub WipeOut()
    Dim CurrLayer As AcadLayer
    Dim NewLayer As AcadLayer
    
    
    ' Find Current Layer
    Set CurrLayer = ThisDrawing.ActiveLayer         ' Current Layer
        Debug.Print CurrLayer.Name
    
        
    ' Change To New Layer
    Set NewLayer = ThisDrawing.Layers.Item("Wipeout")
    ThisDrawing.ActiveLayer = NewLayer
        Debug.Print NewLayer.Name
        
    
    ThisDrawing.SendCommand "Wipeout" & vbCr
    
    ' Reset To Previous Layer
    ThisDrawing.ActiveLayer = CurrLayer
        Debug.Print ActiveLayer.Name

End Sub

 It all seems to work ok up until point 3. It then reverts back to the original layer before the user gets a chance to start putting in a wipeout.

 

My question is... Is there a way to put in a pause or something after the wipeout commands starts for the user to be able to start drawing something before the layer gets changed back to its original state? Or is there a smarter way of doing what I'm trying to do?

 

 

Thanks & Regards,

 

Ace

 

0 Likes
1,707 Views
2 Replies
Replies (2)
Message 2 of 3

h_s_walker
Mentor
Mentor

I'm not too up on VBA for Autocad, but I've have done a little bit of programming

 

What you need to look for to put BETWEEN

 

    ThisDrawing.SendCommand "Wipeout" & vbCr

 

AND

 

 
    ' Reset To Previous Layer
    ThisDrawing.ActiveLayer = CurrLayer
        Debug.Print ActiveLayer.Name

Is a command to suspend the macro operation until Autocad relinquishes control.

 

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 3 of 3

fenton_webb
Autodesk
Autodesk

Supplying a backslash to the command line pauses input, however, in your case I you will need two separate commands because of your requirement to 'draw some stuff' in between




Fenton Webb
AutoCAD Engineering
Autodesk

0 Likes