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
Parents
  • Unknown said:
    distance = Point3dSubtract(oOrigin, oRef.Range(True).Low)

    I don't think this is the immediate problem, but it could lead to other curiosities.  By setting Range(True) you're asking for the range of the attachment, which happens to be the active model, including all its references

    What is the value of oRef.Range.Low?

    Debug.Print "Ref Range XY=" & Format (oRef.Range.Low.X, "#,##0") & ","  & Format (oRef.Range.Low.Y, "#,##0")

     
    Regards, Jon Summers
    LA Solutions

  • 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.

    When running the command you sent, the value is "Ref Range XY=0,0"

    When doing a watch on oRef.Range.Low i get the above.

  • 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

Reply
  • 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

Children