×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writing text from a dwg to a text file?

Writing text from a dwg to a text file?

Writing text from a dwg to a text file?

(OP)
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

RE: Writing text from a dwg to a text file?

(OP)
Here is the script I am trying to use.

<script language="VBScript" type="text/VBScript">

  Set CATIA = GetObject(, "CATIA.Application")
  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 = "C:\inetpub\wwwroot\eng1\dwg_notes\backup\dwg_notes2.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
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 "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.

RE: Writing text from a dwg to a text file?

Hello,
this should do the job:
...
for i=1 to AllTexts.count
   ts.WriteLine AllTexts.Item(i).Text
next

Regards TPale

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources