In the first post I demonstrated one way to convert a 3DPolyline to a profile. In this post will show how to have the user provide a name for the profile. Help provides various samples on how to get an input for a string. So I'll use the sample and modify it to prompt for a profile name. Put the new code above the Set oProfile = oProfiles.Item("FromPoints") line of code.
' Prompt for Profile Name
' Sample code from help modified to prompt for profile name
' Prompt & Input can contain blanks, but not an empty string
Dim NoNull As Integer
Dim sProfileName As String
NoNull = 1 ' Disallow null
ThisDrawing.Utility.InitializeUserInput NoNull
sProfileName = ThisDrawing.Utility.GetString(True, "Enter profile name (<enter> terminates input): ")
The NoNull =1 ensures that the user provides an input. If a profile name is not entered, the profile will be "", which is not a valid profile name. The True after GetString indicates that spaces are allowed. If it is changed to False, then spaces are not allowed. If enter is used for the profile name we will need to exit the sub in order to not get an error message for the user. So after the above code add the following lines of code:
If sProfileName = "" Then
MsgBox("A valid profile name was not given")
Exit Sub
End If
Now where ever "FromPoints" was in the code change it to the profile name variable sProfileName. No run the code and you should be prompted for the 3DPolyline, then an Alignment and then the Profile name. You could change the code to use a default value, but that's another post.
Related Posts:
Create a Profile without a Surface - VBA
Create a Profile Without A Surface - 3DPolyline VBA
Create a Profile Without A Surface - 3DPolyline VBA II
Create a Profile Without A Surface - 3DPolyline VBA III
No comments:
Post a Comment