Create Annotation in Visual Basic
Create Annotation in Visual Basic
(OP)
Multiple problems with this code, hoping someone can help with two of them.
First reading a file where I want to get two strings and three double.
I receive the error: "'Parse' is not a member of 'String'"
I cannot seem to find the call out for reading a string from a file.
Second problem, I need to then place the strings on the drawing sheet as a note.
The error I receive for this is: "Value of type 'String' cannot be converted to '1-dimensional array of String'
Documentation of the creatNote callout read:
public void CreateNote(
int num_lines_text,
string[] text_string,
double[] origin_3d,
int orientation,
out Tag note_tag
)
Where orientation 0 means horizontal and 1 means vertical.
Any help would be greatly appreciated.
First reading a file where I want to get two strings and three double.
CODE
line = sr.ReadLine()
While Not line is Nothing
Dim pt1 As Point3d
Dim pt2 As Point3d
Dim noteLoc(2) as Double
Dim douX1Loc as Double
Dim douX2Loc as Double
Dim strLayer as String
Dim strMaterial as String
Dim douRotation as Double
Dim strRotate as String
Dim delim As Char () = { ","C }
Dim strings As String () = line.Split(delim)
strLayer = String.Parse(strings(0))
strMaterial = String.Parse(strings(1))
douRotation = Double.Parse(strings(2))
douX1Loc = Double.Parse(strings(3))
douX2Loc = Double.Parse(strings(4))
While Not line is Nothing
Dim pt1 As Point3d
Dim pt2 As Point3d
Dim noteLoc(2) as Double
Dim douX1Loc as Double
Dim douX2Loc as Double
Dim strLayer as String
Dim strMaterial as String
Dim douRotation as Double
Dim strRotate as String
Dim delim As Char () = { ","C }
Dim strings As String () = line.Split(delim)
strLayer = String.Parse(strings(0))
strMaterial = String.Parse(strings(1))
douRotation = Double.Parse(strings(2))
douX1Loc = Double.Parse(strings(3))
douX2Loc = Double.Parse(strings(4))
I cannot seem to find the call out for reading a string from a file.
Second problem, I need to then place the strings on the drawing sheet as a note.
CODE
ufs.Drf.CreateNote(1,strLayer, noteLoc, 0, theNote)
noteLoc(0) = x + 30
ufs.Drf.CreateNote(1,strMaterial, noteLoc, 0, theNote)
noteLoc(0) = x + 65
strRotate = douRotation + "<$s>"
ufs.Drf.CreateNote(1,strRotate, noteLoc, 0, theNote)
noteLoc(0) = x + 30
ufs.Drf.CreateNote(1,strMaterial, noteLoc, 0, theNote)
noteLoc(0) = x + 65
strRotate = douRotation + "<$s>"
ufs.Drf.CreateNote(1,strRotate, noteLoc, 0, theNote)
The error I receive for this is: "Value of type 'String' cannot be converted to '1-dimensional array of String'
Documentation of the creatNote callout read:
public void CreateNote(
int num_lines_text,
string[] text_string,
double[] origin_3d,
int orientation,
out Tag note_tag
)
Where orientation 0 means horizontal and 1 means vertical.
Any help would be greatly appreciated.





RE: Create Annotation in Visual Basic
The split function returns an array of strings, there is no parse function involved, just reference them according to their offsets.
CODE
Dim pt2 As Point3d
Dim noteLoc(2) as Double
Dim douX1Loc as Double
Dim douX2Loc as Double
Dim strLayer(0) as String
Dim strMaterial(0) as String
Dim douRotation as Double
Dim strRotate(0) as String
Dim delim As Char () = { ","C }
Dim strings As String () = line.Split(delim)
strLayer(0) = strings(0)
strMaterial(0) = strings(1)
douRotation = CDbl(strings(2)
douX1Loc = CDbl(strings(3)
douX2Loc = CDbl(strings(4)
For the last question, the CreateNote function expects, nay - demands, an array of string objects even if you are only passing in a single string. Try declaring it and assigning it as above and change your function call to:
CODE
RE: Create Annotation in Visual Basic