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

Replace select points with a cell.

411 views
Skip to first unread message

Richard Humphrey

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Hello,
Does anyone know of a way of replacing all the points within a selection
with a nominated cell.
What I want to do is select all my text strings with a cell placed at
the origin of the text string.
Your help would be much appreciated, I have been asked to do this to a
DGN by Friday, ahhhhhhhhh.
Thanks
Rich.


Ravis

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Richard,

In the Client Server(sept/oct '96) there is a MicroStation Basic code
for replacing points with a cell.

I will e-mail you(and anyone else who wants it) this macro so that you
can run it straight away.

regards
Tor Eivind Ravndal
----------------------------------------------------------------------------
-----------------------------------
'MicroStation BASICware Name: Pnt2cel.bas
'Company: Bentley Systems, Inc.
'Product Category: MicroStation 95
'Platforms tested on: Windows 3.1x, Windows 95
'Keywords: Point, Object, Replace, Cell, Convert,
'BASIC, Macro
'Description: Sample code allows you to change or convert
'all point objects in a design (through a fence or a selection
'set) to cell objects. The current cell name, scale and rotation
'settings are used for cell placement. Feel free to use and
'modify as required.


Richard Humphrey <richard....@infrasoft-civil.com> wrote in article
<37F347AB...@infrasoft-civil.com>...

Inga

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Ok, this is going to sound really stoopid, but it does work.
Using the "Export Coordinates" tool from the XYZ tool box, export the
coordinates of the text to a txt file. The tool will allow you to do one at
a time, use a fence or process the entire file.

Then attach a cell library, selected an active cell and now select the the
"Import Coordinates" tool from the same tool box. You'll have to enter the
txt file created above, and the cell name. It wil then proceed to place a
cell at each xy coordinate, which is esentially the location of the text.

Of course, you'll have to delete the text now or turn that level off.

Neat little work around!

Regards,
Inga Morozoff
WorkPlace Wisdom Inc.


Richard Humphrey wrote in message <37F347AB...@infrasoft-civil.com>...

Jim Weir

unread,
Oct 6, 1999, 3:00:00 AM10/6/99
to
Richard,
One possible way to do it, in SE, is to write the coordinates of the text to a
file with tools>annotation>xyztext>export coordinates, then import the
coordinate file as cells with tools>annotation>xyztext>import coordinates.
Hope this helps,
Jim Weir

In article <37F347AB...@infrasoft-civil.com>,
richard....@infrasoft-civil.com says...


>
>Hello,
>Does anyone know of a way of replacing all the points within a selection
>with a nominated cell.

Chris Cockerill

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
I have done this with cells but not text...

You can export cells to a file as xyz text, and then read in the xyz text
and place cells at the points.

Also you can write a fairly simple macro to do it :
(note that this changes cells)

Sub main
Dim element As New MbeElement
Dim filePos As Long
Dim origin As MbePoint

filePos = element.fromFile(0)
Do While filePos >= 0
If element.type = MBE_CellHeader Then
If element.cellName = "ARRO" Then
If element.getOrigin(origin) = MBE_Success Then
MbeSendCommand "place point"
MbeSendDataPoint origin,1%
End If
End If
End If
filePos = element.fromFile(filePos + element.fileSize)
Loop

End Sub

Richard Humphrey

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
For your info, this is the macro I adapted from Bentley that replaces the
select text will a nominated cell. Thanks to all those who have helped me out
with this one, its much appreciated.

' text2cel.bas
' Based on a macro pnt2cel.bas supplied by
' Phil Chouinard of Bentley
Sub main
Dim elemSet as New MbeElementSet
Dim elem as New MbeElement
Dim setMember as MbeSetMember
Dim opoint as MbePoint
Dim filePos as Long
Dim fileNum as Integer
Dim saveMsgs as Integer
Dim i as integer
i = 1

' turn off messages

saveMsgs = MbeState.messages
MbeState.messages = 0

If MbeSettings.Cell = "" Then
MbeWriteStatus "No cell defined - exiting TEXT2CEL"
Exit Sub
End If

' 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 - exiting PNT2CEL"
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
status = elem.getOrigin (oPoint)
MbeSendCommand "DELETE"
MbeLocateElement setMember.filePos, elem.componentFilePos, _
setMember.fileNum, oPoint
If MbeState.cmdResult <> MBE_ElementNotFound Then
MbeSendDataPoint oPoint
MbeSendCommand "NULL"
MbeSendCommand "PLACE CELL"
MbeSendDataPoint oPoint
MbeSendCommand "NULL"
End If

End If
status = elemSet.getNext (setMember)
MbeWriteStatus "Processing element number " + Str$(i)
i = i + 1
Loop
MbeWriteStatus "Processing completed"

' clear selection set

elemSet.clear

' restore messages

MbeState.messages = saveMsgs
End Sub

0 new messages