Questions similar to this appear on the Be Communities. This question appeared in the MicroStation Programming Forum.

Q How can I implement partial delete using MicroStation Visual Basic for Applications (VBA)?

A A CAD tool, such as MicroStation, lets a user draw and modify lines and shapes. Sometimes we want to modify a shape by removing part of a line or curve. MicroStation terms that edit a partial delete.

VBA enables us to do something similar using the Element.PartialDelete method. You can find that method documented in MicroStation VBA help, along with some example code.

Element.PartialDelete

VBA provides the Element.PartialDelete method. You can find that method documented in MicroStation VBA help, along with some example code.

The VBA project described here, which you can download, is a working implementation of that example.

Complex Line String

Start the tool with MicroStation key-in: vba run [PartialDelete]modMain.Main

  1. Pick a point on an element, which marks the start of the partial delete operation
  2. Pick a second point on that element, which marks the end of the partial delete
  3. Datapoint to confirm your choice
In this example, the resulting fragments are created using a distinct symbology to show you the result of executing your code.

Result of Partial Delete

MicroStation Versions

The VBA project described here was tested using MicroStation CONNECT Update 14.2. Earlier versions of MicroStation CONNECT had bugs with this method: search the Programming Forum. for partial delete to investigate.

Download

Download the Partial Delete Tool

You can download the Partial Delete MVBA project. The project includes the MVBA project PartialDelete.mvba and an example DGN file with a few lines used to test the project.


Questions

Post questions about MicroStation programming to the MicroStation Programming Forum.