Replace cells and keep tag data: How to

Replace cells and keep tag data: How to

Post by Jos Groot Lipm » Sat, 23 Oct 1999 04:00:00



I want to update my (not shared) cell definitions in my
drawing. The cells have Tags attached to them. Whenever
I replace the cells (through REPLACE CELL or REPCELL.MA)
the tag information disappears.

I tried to create a Basic program to store the tag-info
before replacing and putting it back afterwards but this
produces very strange results (new tags attached to
wrong elements)

Anyone any suggestions?
--
J. Groot Lipman

 
 
 

Replace cells and keep tag data: How to

Post by Jerry Walte » Sat, 23 Oct 1999 04:00:00


Jos;
When you replace the cell in the basic macro, I presume you are placing
a new cell. Chances are that the new cell is not *exactly* like the old
one therefore the file pointers will not be the same. The  new cell will
probably be placed at the end of the file. If you save the eof position
before placing the new cell, and then read the cell from this new
position, you should be able to attach the tag data to the correct
element.


> I want to update my (not shared) cell definitions in my
> drawing. The cells have Tags attached to them. Whenever
> I replace the cells (through REPLACE CELL or REPCELL.MA)
> the tag information disappears.

> I tried to create a Basic program to store the tag-info
> before replacing and putting it back afterwards but this
> produces very strange results (new tags attached to
> wrong elements)

> Anyone any suggestions?
> --
> J. Groot Lipman


--
================================================
Jerry Walter
Bentley Systems, Inc.
Geoengineering Business Group

(937) 332-0053
================================================

 
 
 

Replace cells and keep tag data: How to

Post by Craig Lemo » Mon, 25 Oct 1999 04:00:00


Jos,

I have had a very bad experience attaching tags to cell elements.  I found that after some time, for some reason, that tag element became un-associated from the cell element.  This meant that I had tag elements not attached to anything.  After much reading and talking with our SELECT support guys, that Bentley say " .. while possible, it is Bentley don't advise attaching tags to cell elements".  This information is in one of the readme files in the MicroStation root directory.  After this I have stayed away from tags and cell elements.

Just my $0.02 worth.

cheers, Craig

--
----

21A Dinton Street, Russley
Christchurch, New Zealand, 8004
Phone: +64 3 342 7877
Mobile: +64 025 268  2762
----

  I want to update my (not shared) cell definitions in my
  drawing. The cells have Tags attached to them. Whenever
  I replace the cells (through REPLACE CELL or REPCELL.MA)
  the tag information disappears.

  I tried to create a Basic program to store the tag-info
  before replacing and putting it back afterwards but this
  produces very strange results (new tags attached to
  wrong elements)

  Anyone any suggestions?
  --
  J. Groot Lipman

 
 
 

Replace cells and keep tag data: How to

Post by Jos Groot Lipm » Tue, 26 Oct 1999 04:00:00




Quote:> Jos,

> I have had a very bad experience attaching tags to cell elements.  
>> (snip)
>> This information is in one of the readme files in the
>> MicroStation root directory.  After this I have

stayed away from tags and cell elements.

Actually the (ustation 95) readme says: "Use of Tags in
Cells is possible, but not encouraged.". I think they
tried to discourage use of tags inside cell-definitions
as opposed to attaching tags to cell placements as I do.
Nevertheless that is giving me problems too...

--
J. Groot Lipman

 
 
 

Replace cells and keep tag data: How to

Post by Jos Groot Lipm » Tue, 26 Oct 1999 04:00:00




Quote:> Jos;
> When you replace the cell in the basic macro, I presume you are placing
> a new cell. Chances are that the new cell is not *exactly* like the old
> one therefore the file pointers will not be the same. The  new cell will
> probably be placed at the end of the file. If you save the eof position
> before placing the new cell, and then read the cell from this new
> position, you should be able to attach the tag data to the correct
> element.

Actually I already do so. Code fragment is:

endOfFilePos = MbeDgnInfo.endOfFile
filePos = element.fromFile(0)
nObjects =0
While filePos <> -1 AND filePos < endOfFilePos
    if isCell(element.type) <> 0 Then
        ' Keep old Tag-info
        Dim tagArray() as MbeTag
        If element.getOrigin(point) = MBE_Success Then
            total = element.numTags
            stat = element.extractTags(tagArray)
            PrevEndOfFilePos = MbeDgnInfo.endOfFile
            MbeSendCommand "REPLACE CELL"
            MbeLocateElement element.filePos
            ' JGL: Somehow I have to do this twice
            MbeSendDataPoint point '
            MbeSendDataPoint point '
            MbeSendCommand "NULL"
            ' Attach old tags
            Dim newElem As New MbeElement
            If newElem.fromFile(PrevEndOfFilePos) > 0
Then
                stat = newElem.getOrigin(point)
                for idx = 0 to total -1
                    stat =
newElem.AttachTag(tagArray(idx))
                next idx
                stat = newElem.rewrite() ' Do I need to
do this.
            End If
        End If
   End If
  filePos = element.fromFile(filePos + element.fileSize)
Wend
MbeSendCommand "NULL"

(BTW When I do not send the datapoint twice some cells
are not replaced)

--
J. Groot Lipman

 
 
 

1. replace cell but keep rotation and/or scale

how do you replace a cell or update a cell so that it retains any scaling or
rotation that may have been applied to it ??? the "replace attributes"
option seems to only be related to database info.

thanks,

George

2. OS3/Find doesn't work properly

3. Copy n Paste tagged elements and keeping the tag

4. Palm T-shirts

5. Attaching Tag data to cells

6. V.34 throughput

7. tags / how can you attach a tag to a cell so

8. Nikon Coolscan Ls30

9. Replace Cell Macro ~ get current cell rotation angle

10. Replace Cell in Cell Library

11. cells: replace cells utility???