How to copy elements from one .dgn to another

Hi All:

How do you copy elements from one .dgn file to another and keep the elements at the same x, y.

In AutoCad I would copy and paste at 0,0...but can't find the command in Microstation.

Thanks!

Parents
  • If you've ever tried to copy elements from an XREF in AutoCAD, you might think the process in MicroStation is fraught with peril, but MicroStation's Reference Files are far more flexible and friendly than AutoCAD.

    The idea of attaching a reference file to copy a few elements from another file seems very foreign to an AutoCAD user, but long before either of these packages supported the Windows Clipboard, that was the only way to do this. In AutoCAD, you would have to WBLOCK out the elements and INSERT and EXPLODE to accomplish the same thing. And that left the DWG sitting somewhere on your drive.

    With the MicroStation workflow, the preocess was simple and fast. And everyone used the XY, DX, DL keyins all of the time, so they were like second nature.

    This process also allowed you to fix global origin or datum shifts. You could use the move reference command to get the reference file into the proper datum and coordinates and then copy or merge the data into the active file. All you needed was one point of commonality in both files to line up and if the master units were identical, set a scale of 1:1 and even adjust for working units discrepancies.

    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • This works for me...

    1. Select elements to copy
    2. Tentative snap at 0,0 or base point
    3. Copy
    4. Paste
    5. DP to 0,0 or base point
  • have you all watched: NINJA POINT (some more to laugh)

    communities.bentley.com/.../paste-elements-at-same-graphical-location.aspx

    Regards

    Frank

    since 1985: GIS, CAD, Engineering (Civil)  Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads,  HHK Geograf, IBr DAVID] :  Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML]
    [direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"
    Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)

  • I thought that it should be possible to skip the point placement - who wants to leave an point at 0,0,0 in a file anyway? However, it appears that a tentative snap in space is not the same as a tentative snap on an element.

    So it might be possible to place the point, snap to it, copy to clipboard and undo the point placement. Or to place a transient element at 0,0,0 which would simply go away on its own.

    And with this code:

    If Not ActiveModelReference.AnyElementsSelected Then

         ShowError "The macro requires a selection set"

         Exit Sub

    End If

    You can even exit if no selection set is active.

    One more thing - on the Pasting End ...

    The simple key-in of XY= is sufficient to specify a paste point of 0,0,0


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • Actually the point is not left in the file after the script has run.

    Of course it's possible to develop the script further as you suggest, but I'm no expert at VBA so I leave it to others.

  • Should we really have to go through all this trouble just to set a base point? Autocad has the feature built in.

    Neil Wilson (aka Neilw)

    Power Civil v8i 08.11.07.245

    AutoCAD Civil 3D 2018

  • When I tried it, it certainly was left in the first file. However, here is a version that uses a transient element and eliminates the problem. I added the test for a selection set, added code so the last view used by the user is used for the copy. This can be critical if view 1 is rotated from top orientation but the user was working in a different view.

    Sub CopyClipboardWithBasePoint()

       Dim ele As LineElement

       Dim flags As MsdTransientFlags

       Dim activeView As View

    '   Exit the macro if there is no selection set and explain it to the user...

       If Not ActiveModelReference.AnyElementsSelected Then

           ShowError "The macro requires a selection set"

           Exit Sub

       End If

    '   Get the last view a user interacted with since we want to copy

    '    the selection set based upon that view.

       Set activeView = CommandState.LastView

    '   Use this pair of flags to make the elements in the container snappable and

    '   to make them display on top of other elements

       flags = msdTransientFlagsOverlay + msdTransientFlagsSnappable

       Set ele = CreateLineElement2(Nothing, Point3dFromXYZ(0#, 0#, 0#), Point3dFromXY(0#, 0#))

    '   Create a new container and put a copy of the element into it.  The container holds a copy;

    '   changes to the original element are not displayed.

    '

       Set tec1 = CreateTransientElementContainer1(ele, flags, msdViewAll, msdDrawingModeHilite)

    '   Send a tentative point

    '   Coordinates are in master units

       CadInputQueue.SendTentativePoint Point3dFromXYZ(0#, 0#, 0#), activeView.Index

    '   Start the command

       CadInputQueue.SendCommand "MDL LOAD CLIPBRD COPY"

       Set tec1 = Nothing

    End Sub


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
Reply
  • When I tried it, it certainly was left in the first file. However, here is a version that uses a transient element and eliminates the problem. I added the test for a selection set, added code so the last view used by the user is used for the copy. This can be critical if view 1 is rotated from top orientation but the user was working in a different view.

    Sub CopyClipboardWithBasePoint()

       Dim ele As LineElement

       Dim flags As MsdTransientFlags

       Dim activeView As View

    '   Exit the macro if there is no selection set and explain it to the user...

       If Not ActiveModelReference.AnyElementsSelected Then

           ShowError "The macro requires a selection set"

           Exit Sub

       End If

    '   Get the last view a user interacted with since we want to copy

    '    the selection set based upon that view.

       Set activeView = CommandState.LastView

    '   Use this pair of flags to make the elements in the container snappable and

    '   to make them display on top of other elements

       flags = msdTransientFlagsOverlay + msdTransientFlagsSnappable

       Set ele = CreateLineElement2(Nothing, Point3dFromXYZ(0#, 0#, 0#), Point3dFromXY(0#, 0#))

    '   Create a new container and put a copy of the element into it.  The container holds a copy;

    '   changes to the original element are not displayed.

    '

       Set tec1 = CreateTransientElementContainer1(ele, flags, msdViewAll, msdDrawingModeHilite)

    '   Send a tentative point

    '   Coordinates are in master units

       CadInputQueue.SendTentativePoint Point3dFromXYZ(0#, 0#, 0#), activeView.Index

    '   Start the command

       CadInputQueue.SendCommand "MDL LOAD CLIPBRD COPY"

       Set tec1 = Nothing

    End Sub


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
Children