I'm trying to move a cell, not the cell's "internal" origin but rather its location in my design file.
When I try oCell.move(oPoint3d) I get this compile error: "Variable required - can't assign to this expression"
I have lines in my design file that have tags. There are also cells with arrow heads that basically function as call-outs so they also have visible text. The text in these cells correspond to the tag text for the line that the cell is pointing to. The macro I'm trying to write will move the cells so that they once again point to the correct line if the line has been moved.
My macro scans through every line in the file, checks that it has a tag, gets the text from the tag, then scans through every cell with a certain name, finds the text in that cell and compares the two text fields. If the text is equal a random point on the line is found and the cell is supposed to move to that point.
I've condensed the code a bit. I can post more if needed. Thanks for looking!
Do While oScan.MoveNext 'looking for lines with tags
'if a line is found with a tag
oLineTag = CStr(oTag.TagDefinitionName)
Do While oScanForCell.MoveNext 'looking for cells
'if a cell is found get its text by scanning through it
Do While oScanCell.MoveToNextElement 'scan cell to find text
oCellText = oScanCell.Current.AsTextElement.Text
If (oLineTag = oCellText) Then
dim oPoint as Point3d
'I have a function at this point that gets a random point on a line called placePoint
oPoint.X = (placePoint.X - oScanForCell.Current.AsCellElement.Origin.X)
oPoint.Y = (placePoint.Y - oScanForCell.Current.AsCellElement.Origin.Y)
oPoint.Z = (placePoint.Z - oScanForCell.Current.AsCellElement.Origin.Z)
oScanForCell.Current.AsCellElement.Move (oPoint) 'this is where the error happens, not sure why
End If
Loop
If you are coding this in MVBA and not in VB.Net or something, then remove the () around oPoint. This has special meaning in VBA. It should read:
oScanForCell.Current.AsCellElement.Move oPoint
Oh wow, I just knew it was going to be one of those slap myself on the forehead kinds of solutions. Now why didn't I think of that! I'll try it in the morning. Keeping my fingers crossed overnight.
And yes, it's MVBA.
Thank you, Gerald!
-Steve
BTW, what release of MicroStation are you using?
I'm using V8 XM, Version 08.09.04.51.
Gerald's suggestion did indeed work. Thanks again, Gerald!