Re: Extract Text Attributes to Text File
- From: "Mel Arquiza" <carquiza@xxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 02:27:39 +0000 (UTC)
"Mel Arquiza" <carquiza@xxxxxxxxxxx> wrote in message
> I am using Microstation Basic.
> How can you able to extract all the text attributes on a given dgn file?
Nobody answer this question. I will answer it.
Here is just a basic code: Any comment great appreciated.
'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
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"
MbeWriteStatus "Processing Fence"
MbeWriteStatus "Processing Selection Set"
'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
justi = elem.justification
'Get Character Width
charW = elem.charWidth
'Get Character Height
charH = elem.charHeight
'Write to text file
status = elemSet.getNext (setMember)
'close all open files
'clear selection set
MbeState.messages = saveMsgs
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG