Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Programming with Microstation > Re: Basic Tags ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 373 of 473
Post > Topic >>

Re: Basic Tags - Please Help

by "Mel Arquiza" <carquiza@[EMAIL PROTECTED] > Nov 11, 2005 at 06:30 AM

"Mike A." <wildcanada1@[EMAIL PROTECTED]
> wrote in message
news:4729c913.0206040914.3ef86b83@[EMAIL PROTECTED]
> Hi Group,
> 
> I've been reading the newsgroup regarding tags and BASIC and just cant
> get something to work for me.  Help is much appreciated.
> 
> What I want to do is scan a design file for tags and convert the tags
> to text elements.  I can't seem to read the values of the tags, but I
> can find other properties such as their origin coords, or color, etc
> ...
> 
> Can someone help?
> 
> Thanks
> 
> Mike A.

Hi Mike,

Here it is what you are looking for:

' TAG TO TEXT



'***************************************************************************
' Searches for tags and changes the tag to text then deletes the tag..

' Author Bentley - 479


'***************************************************************************


const STARTofFILE = 0



'==============================================================================
' This sub will change a tag to text and delete the tag.

' Version 1.0
' Author - Bentley 0479


'------------------------------------------------------------------------------

sub Tag2Text(filePos As Long)
    Dim element As New MbeElement
    Dim tag As New MbeTag

    filePos = element.fromfile(filePos)
    if element.type = Mbe_Tag then
        status = element.getMbeTag(tag)
        status = tag.getTextElement(element)
        status = element.addToFile()
        MbeSendCommand"DELETE ELEMENT"
        MbeLocateElement filePos
        MbeLocateElement filePos
        MbeSendCommand "UPDATE ALL"
    end if
end sub



'==============================================================================

Sub main
    Dim element As New MbeElement
    Dim filePos As Long
    Dim endOfFile As Long

    endOfFile = MbeDgnInfo.endOfFile
    filePos = element.fromfile(STARTofFILE)

    While filePos <= endOfFile
        fileSize = element.fileSize
        if element.type = Mbe_Tag then
            Tag2Text filePos
        End If
        filePos = element.fromFile (filePos + fileSize)
    Wend
End Sub

---------------------------------------------------------------------

'DON'T FORGET TO PLACE THE FENCE BEFORE RUNNING THE MACRO

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 filePos as Long 
Dim fileNum as Integer 
Dim saveMsgs as Integer 

'turn off messages 
 
saveMsgs = MbeState.messages 
MbeState.messages = 0 
 
'Creates an output file 
Open "C:\textout.txt" for output access write as #1 
 
'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 
 
 
 
status = elemSet.getFirst (setMember) 
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 

 
write #1, origin.x, origin.y, elemText


End If 
End If 
End If 
status = elemSet.getNext (setMember) 
Loop 
 
'close all open files 
Close 
 

'clear selection set 
 
elemSet.clear 
 
'restore messages 
 
MbeState.messages = saveMsgs 
End Sub 

 
 


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




 1 Posts in Topic:
Re: Basic Tags - Please Help
"Mel Arquiza" &  2005-11-11 06:30:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Nov 23 3:55:21 CST 2008.