C# Code
1 2 3 4 5 6 7 8 9 10 11 12 13
public void GetDistancePoint() { Shape shape = this.app.ActiveShape; Segments segments = shape.Curve.Segments; for (int i = 1; i <= segments.Count; i++) { if(segments[i ].Selected) { MessageBox.Show(segments[i ].StartNode.GetDistanceFrom(segments[i ].EndNode).ToString()); } } }
Sub Macro2() Dim OS As Shape, x#, y#, w#, h# Set OS = ActiveSelection.Shapes(1) For i = 1 To OS.Curve.Segments.Count If OS.Curve.Segments(i).Selected = True Then OS.Curve.Segments(i).GetBoundingBox x, y, w, h MsgBox ("Segment Index = " & i & vbCr & "Width = " & w & vbCr & "Height = " & h & vbCr & "Length = " & OS.Curve.Segments(i).Length) End If Next iEnd Sub
Thanks Mek, not quite there though. Segment width should be 3"
Simply try:
Sub Test()Dim OriUnit As LongOriUnit = ActiveDocument.UnitActiveDocument.Unit = cdrInch
' ....
ActiveDocument.Unit = OriUnitEnd Sub