Hello all,
how could I edit each ordinate dimension to basic or add for the selected dimension a tolerance? Is it possible to edit each ordinate dimension individually? How could I get the value of the selected dimension?
Thank you
Georg
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
Same problem and no solution
Hi Georg,
This could be a way to find the last OrdinateDimension in the set:
Function GetLastDimensionInSet(ByVal ordDimSet As OrdinateDimensionSet) As OrdinateDimension Dim ordDim As OrdinateDimension Dim max As Double For Each ordDim In ordDimSet.Members If ordDim.ModelValue > max Then max = ordDim.ModelValue Set GetLastDimensionInSet = ordDim End If Next End Function
In order to get more information about the selection you could subscribe to the OnSelect event of UserInputEvents. This way you could get the model position of the selection which would help you identify the selected dimension:
Function GetClosestDimensionInSet(ByVal ordDimSet As OrdinateDimensionSet, ByVal pt As Point2d) As OrdinateDimension Dim tr As TransientGeometry Set tr = ThisApplication.TransientGeometry Dim ordDim As OrdinateDimension Dim min As Double min = 1000000 For Each ordDim In ordDimSet.Members Dim poly As Polyline2d Set poly = ordDim.DimensionLine Dim i As Integer For i = 1 To poly.PointCount - 1 Dim line As LineSegment2d Set line = tr.CreateLineSegment2d(poly.PointAtIndex(i), poly.PointAtIndex(i + 1)) If line.DistanceTo(pt) < min Then min = line.DistanceTo(pt) Set GetClosestDimensionInSet = ordDim End If Next Next End Function
Inside OnSelect you could use it like this:
Private Sub uiEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, MoreSelectedEntities As ObjectCollection, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View) Dim tr As TransientGeometry Set tr = ThisApplication.TransientGeometry Dim ordDim As OrdinateDimension Set ordDim = GetClosestDimensionInSet(JustSelectedEntities(1).OrdinateDimensionSet, tr.CreatePoint2d(ModelPosition.X, ModelPosition.Y)) ordDim.Text.FormattedText = ordDim.Text.FormattedText + "+" End Sub
Cheers,
Hello Adam,
after a long time I found the time to try your code. The event of UserInputEvents works. But it works only with a "try catch".
Thank you Georg
Hi Georg,
Have a look at this: http://modthemachine.typepad.com/my_weblog/2012/03/customizing-marking-menus.html
You can add your own custom items and they can do whatever you want.
Concernig try/catch. The code is only working if you select the specific type of objects.
If you select something else, it would throw an error.
Cheers,