Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing text from a dwg to a text file?

Status
Not open for further replies.

joltinjohn

Aerospace
May 7, 2003
20
0
0
US
Hello again guys. I am having trouble writing text from my dwg to a text file.

I have no problem counting the number of text items and I can easily put text into a dwg but when I try to read the text and write it to a file I'm having a very hard time.

I would like to know how to read a DrawingText into a variable. Any examples????

Thanks,
John
 
Replies continue below

Recommended for you

Here is the script I am trying to use.

<script language=&quot;VBScript&quot; type=&quot;text/VBScript&quot;>

Set CATIA = GetObject(, &quot;CATIA.Application&quot;)
Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets
Set Selection = DrwDocument.Selection
Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView
Set DrwTexts = DrwView.Texts

Dim oText
file_set = &quot;C:\inetpub\Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set ts = fs.CreateTextFile(file_set, True)
Set AllTexts = DrwView.Texts
if AllTexts.Count > 0 Then
For Each oText In AllTexts
ts.WriteLine oText.Text
Next
End If
ts.close
</script>

I keep getting the Error &quot;object does not support this action 'Text'.

I can understand why I keep getting this. Which is saying that the oText.Text line is not valid???????

Thanks for your help.
 
Status
Not open for further replies.
Back
Top