VBA not reading reference file offset correctly

Hi,

I have a frustrating issue where VBA is not reading the reference file offset correctly. I'm working with a bunch of existing drawings and need to know this for inserting some cell's in bulk. Some drawings it works perfectly but not for others. Ive checked scales etc as far as I know they are OK.

Ideas? Screen shots below showing the X offset in the reference file dialog vs the VBA result.

Parents
  •  wrote: Microstation noob, I miss AutoCAD :-(.

    Welcome to the MicroStation Programming Forum!

    I have a frustrating issue where VBA is not reading the reference file offset correctly

    MicroStation Help tells us: Offset — Displays and sets the distance between the global origin of the reference from the global origin of the parent file, measured in units of the parent file. If the parent is 2D, Offset X and Y values are displayed. If the parent is 3D, Offset X, Y, and Z values are displayed.

    OffsetArray (0) = oAtt.MasterOrigin.X

    You're not calculating the offset, but reading the master origin.  Try something like this...

    Dim offset As Point3d
    offset = Point3dSubtract (oAtt.MasterOrigin, oAtt.AttachmentOrigin)
    OffsetArray (0) = offset.X
    

    Depending what you're attempting to achieve, methods GetMasterToReferenceTransform and GetMasterToReferenceTransformGetReferenceToMasterTransform may be useful.

     
    Regards, Jon Summers
    LA Solutions

Reply
  •  wrote: Microstation noob, I miss AutoCAD :-(.

    Welcome to the MicroStation Programming Forum!

    I have a frustrating issue where VBA is not reading the reference file offset correctly

    MicroStation Help tells us: Offset — Displays and sets the distance between the global origin of the reference from the global origin of the parent file, measured in units of the parent file. If the parent is 2D, Offset X and Y values are displayed. If the parent is 3D, Offset X, Y, and Z values are displayed.

    OffsetArray (0) = oAtt.MasterOrigin.X

    You're not calculating the offset, but reading the master origin.  Try something like this...

    Dim offset As Point3d
    offset = Point3dSubtract (oAtt.MasterOrigin, oAtt.AttachmentOrigin)
    OffsetArray (0) = offset.X
    

    Depending what you're attempting to achieve, methods GetMasterToReferenceTransform and GetMasterToReferenceTransformGetReferenceToMasterTransform may be useful.

     
    Regards, Jon Summers
    LA Solutions

Children