Problem with Moving Reference File

Hi All,

I am having issues with Moving a Reference file. 

I am trying to Insert the Default Model into a Sheet Model, Scale it, then Move it to around the location of the Drawing Sheet (XY = 18,50)

The Code...

Set oRef = ActiveModelReference.Attachments.Add(sFileToImport, "Default", "DistributionDesign", "Design Extract", oPoint, oPoint)
oRef.Redraw msdDrawingModeErase
oRef.ScaleFactor = 0.5 
oRef.Rewrite
oRef.Redraw msdDrawingModeNormal
Dim distance As Point3d
oRef.Redraw msdDrawingModeErase
Dim oOrigin As Point3d
oOrigin.X = 18
oOrigin.y = 50
oOrigin.z = 0
distance = Point3dSubtract(oOrigin, oRef.Range(True).Low)
oRef.Move distance, True
oRef.Rewrite
oRef.Redraw msdDrawingModeNormal

It is moving the reference, but not as it should. I want the lowest part of the Reference File - which according the Default Model is (952082.7161, 6242208.3894), to move to (18, 50).

What it does, is moves the 0,0 point to 18,50

I have attached the DGN for reference.

Any help would be appreciated. I don't know what I am doing wrong

Thanks in Advance!

GIS Test.dgn
  • Unknown said:
    I'm leaning towards the idea of the Files - or perhaps the seed from SmallWorld is corrupt

    If you're seeing that problem consistently, I suggest that you submit a TR to Bentley Systems, with a SmallWorld DGN file as evidence.  See what they can make of it.  If they can definitively say what's wrong with it, you can (a) firstly send it back to SmallWorld for them to fix their DGN exporter and (b) secondly devise a work-around that solves the problem for bad SmallWorld DGN files.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    I notice that it has a master model (the map) and a sheet border model.  Is that how SmallWorld exports it?

    Sorry, the default model is straight from SmallWorld, I have added a sheet model with Title Block. But this file now works for me too... I don't understand why? All others don't seem to...

    Attached is a straight extract from SmallWorld, which hasn't been touched

    I had a play around with different options for Sheet Models to see if that was the issue. Instead of creating it from my seed, i would use the normal "Create Sheet" function and do everything through MicroStation tools, but same result. I even checked another PC to see if it was an issue with my MicroStation install.

    I Have tried to Clip the Default model to certain parts of the Default Model then do the process manually. Still same result.

    Im leaning towards the idea of the Files - or perhaps the seed from SmallWorld is corrupt

    Kununurra sample_0000.dgn
  • Unknown said:
    Attached is a file directly from Smallworld.

    I notice that it has a master model (the map) and a sheet border model.  Is that how SmallWorld exports it?

    This file behaved rationally.  First, the refernence has the expected boundary, Second, I was able to attach the map, scale and move it  manually.

    Now you have good data, you can continue with your VBA development.

    I ran VerifyDgn on your bad DGN, but it told me nothing.  Perhaps you could ask Bentley Systems to analyse it to understand why its reference boundary is so bizarre.  Bear in mind that it could be the sheet model that's wacky.

     
    Regards, Jon Summers
    LA Solutions

  • V8 DGN

    Attached is a file directly from Smallworld. 

    I have tried a few different files, all with the same issue. Where the Extents in the Default Model are just of the elements, but reference it into a Sheet and the Extents are massive.

    sample_0000.dgn
  • Unknown said:
    The DGN we are getting...

    Does SmallWorld create a V7 DGN or a V8 DGN?

     
    Regards, Jon Summers
    LA Solutions

  • I was afraid of that...

    The GIS file is exported from our GIS System (GE Small World) into a DGN. The DGN we are getting isnt the best as is (levels are limited, text is a weird font etc.). So i wouldn't be surprised if there is something else wrong.

    I will see if I can do anything with Small World but I don't like my chances.

    Would there be something we could do in MicroStation to help "fix" the problem?

  • I detached your master model, then reattached manually.  I used the default settings (1:1 scale, coincident world).  The screenshot shows the result.  There's something fishy about the attachment extents. 

    The map in the master model is crammed up in the north-east corner.  The Y value is six billion master units north of the origin. When I attempt to move it manually I get strange results — the map vanishes.

    I think your VBA problems may be down to something in the DGN models.

     
    Regards, Jon Summers
    LA Solutions

  • Does anyone have any ideas for moving this reference file? I have been playing around for a bit over a day but cannot make any progress. I have a demonstration soon and would like to get this sorted beforehand.

    Thanks in advance

  • I will definitely use the hints above with Boolean, makes it much more clear to read!

    Is there anything else that can be done to achieve what im after? eg to Move the reference file to 18, 50?

    It was, at one point working, however I am unable to recreate it.

    If the X value is suspect, could it be a corruption? I have tried it on a few different DGN files and have the same issue on all.

  • Unknown said:

    The reason i put (True) in there is because when run i get an error message stating "Compile Error: Argument Not Optional"

    If i put in an argument (I put false this time) it will work.

    I find those methods that take a Boolean hard to remember, especially when I review my code after a few weeks or months.  A solution I like to use is to define local constants that document the Boolean value...

    Const IncludeAttachments As Boolean = True
    Const IgnoreAttachments As Boolean = False
    range = oRef.Range(IgnoreAttachments)

    Unknown said:
    When doing a watch on oRef.Range.Low I get the above

    Well, anything times 10 to the power -308 is small enough to be considered zero for practical purposes  8-)  However, that X-value looks suspect: it's a huge number that doesn't appear to include a decimal point.

     
    Regards, Jon Summers
    LA Solutions