26 | 02 | 2017

Users Interaction

Code can be pauzes to ask for users input. Or just create a whole new command that uses users interaction. The code below shows how intercation is made with the user to set the activelayer to a different color.

Sub Interact()
 
'****************************************
'*** Code from VisibleVisual.com ********
'****************************************
 
Dim StrColor As String
 
'Set the keywords
ThisDrawing.Utility.InitializeUserInput 0, "Blue Red Yellow Green"
 
'Send the command to the commandline and wait for return input
StrColor = ThisDrawing.Utility.GetKeyword(vbCr & "Enter text color[Blue/Red/Yellow/Green]:")
 
'Check the users input
Select Case StrColor
 
    Case "Blue": ThisDrawing.ActiveLayer.color = acBlue
    Case "Red": ThisDrawing.ActiveLayer.color = acRed
    Case "Yellow": ThisDrawing.ActiveLayer.color = acYellow
    Case "Green": ThisDrawing.ActiveLayer.color = acGreen
End Select
 
MsgBox "The activelayercolor has changed to " & StrColor
 
End Sub

 


 

Download AutoCad sample Here

 

Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2179704
Latest Articles