Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extract Text Attributes to Text File

115 views
Skip to first unread message

Mel Arquiza

unread,
Nov 10, 2005, 11:26:05 PM11/10/05
to
I am using Microstation Basic.
How can you able to extract all the text attributes on a given dgn file?
Thanks.

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

Mel Arquiza

unread,
Dec 11, 2005, 9:27:39 PM12/11/05
to
"Mel Arquiza" <carq...@hotmail.com> wrote in message
news:240f743821922a9eda6...@mygate.mailgate.org

> I am using Microstation Basic.
> How can you able to extract all the text attributes on a given dgn file?
> Thanks.


Nobody answer this question. I will answer it.

Here is just a basic code: Any comment great appreciated.

'Microstation Basic
'The purposed of this macro is to extract text to DGN files and create a
txt file name "textout.txt"
'Created and program by Mel Arquiza


Sub main

Dim elemSet as New MbeElementSet
Dim elem as New MbeElement
Dim setMember as MbeSetMember
Dim origin as MbePoint
Dim elemText as String
Dim fontnam as String
Dim justi as Integer
Dim CharW as Double
Dim CharH as Double
Dim filePos as Long
Dim fileNum as Integer
Dim saveMsgs as Integer
Dim stat as long
Dim rMatrix(0 to 2, 0 to 2) as Double

A = FreeFile

'Turn off messages

saveMsgs = MbeState.messages
MbeState.messages = 0

'Creates an output file
Open "C:\textout.txt" for output access write as #A

'Get element set from either selection set or fence
If elemSet.fromSelectionSet (1) <> MBE_Success Then
If elemSet.fromFence () <> MBE_Success Then
MbeWriteStatus "No fence or selection set"
Else
MbeWriteStatus "Processing Fence"
End If
Else
MbeWriteStatus "Processing Selection Set"
End If

'Get first member
status = elemSet.getFirst (setMember)

'Do While Loop
Do While status = MBE_Success
filePos = elem.fromFile (setMember.filePos, setMember.fileNum)
If elem.type = MBE_Text Then
If elem.getOrigin (origin) = MBE_Success Then
If elem.getString (elemText) = MBE_Success Then
If elem.getRotation(rMatrix) = MBE_Success Then

'Get Angle Rotation
txt1$ = Format$(Str$(rMatrix(0,0)),"0.000")
txt2$ = Format$(Str$(rMatrix(0,1)),"0.000")
txt3$ = Format$(Str$(rMatrix(1,0)),"0.000")

'Get Font Name
fontnam = elem.fontname

'Get Justification
justi = elem.justification

'Get Character Width
charW = elem.charWidth

'Get Character Height
charH = elem.charHeight

'Write to text file

write #A,
txt1$,txt2$,txt3$,Format$(origin.x,"#######.####"),Format$(origin.y,"#######.####"),fontnam,justi,charW,charH,elemtext

End If
End If
End If
End If
status = elemSet.getNext (setMember)
Loop

'close all open files
Close #A

'clear selection set
elemSet.clear

'restore messages
MbeState.messages = saveMsgs

End Sub

Gra

unread,
Nov 10, 2006, 6:35:32 AM11/10/06
to
If i understand correctly you wish to place all text within the design file
into a text file.

I believe there is a very simple way that does not involve programming or
the use of any macros:

Ensure all the text you wish int the dgn file is displayed (does not
matter if it is too small to read.

Using the selection tool select all the text by draging the selection tool
from one corner to the other all elements will be highlighted showing they
are selected.

Open Notepad or Wrod or Wrodpad or Excell theb slect EDIT > PASTE or use
CRTL V

I have used this many times and it works a treat.

Hope this helps.

0 new messages