Cancel
Showing results for 
Search instead for 
Did you mean: 

How to Jog Dimension Manually with Jog Destination Set through api

Experimenter
Experimenter

Dear all,

 

My purpose is to jog the dimension manually when it is overlapping with each other through Solid Edge api.

Basically, I can jog the dimension with jogged command set to True. Nevertheless, the pitch of the jog seems fixed.

May I know how to set the jog pitch or set the coordinate of the jog destination? As I would like to control the direction of jog too.

I've tried to use SetJogPoint2 command. However, as you can see from picture below, the dimensions are still overlapping with each other.

 

Code Snippet

For j = 1 To ObjCircles2d.Count
   ObjCircle2d = ObjCircles2d.Item(j)
   ObjCircle2d.GetCenterPoint(X1, Y1)

   X1 = Math.Round(X1, 7)
   Y1 = Math.Round(Y1, 7)

   For n = 0 To SortedXValues.GetUpperBound(1)
       If X1 = SortedXValues(0, n) And Y1 = SortedXValues(1, n) Then
           nSameCircleCount = SameCircleCount(n)
           objDimen1 = Dimensions.AddCoordinateEx(objDimen1, ObjCircles2d.Item(j).Reference, X1, Y1, 0, True, X1, 0.26, 0)
           objDimen1.Style.CoordinateTextOrientation = SolidEdgeFrameworkSupport.DimTextOrientationConstants.igDimStyleTextPerpendicular
           objDimen1.Style.AutoCenterProjectionLine = False
           objDimen1.Style.LineConnect = False


           'To determine if this dimension is overlap with others, jog the dimension if neccessary
           index = objDimen1.Index
           objDimen1 = Dimensions.Item(index)
           DimData = objDimen1.GetDisplayData()

           DimData.GetTextAtIndex(0, TextString, xDimenCurrent, yDimenCurrent, z, xx, yx, zx, xz, yz, zz)

           xDimenCurrent = Math.Round(xDimenCurrent, 7)
           yDimenCurrent = Math.Round(yDimenCurrent, 7)

           For p = 1 To Dimensions.Count - 1
                objDimen3 = Dimensions.Item(p)
                DimData = objDimen3.GetDisplayData()
                DimData.GetTextAtIndex(0, TextString, xDimenNew, yDimenNew, z, xx, yx, zx, xz, yz, zz)

                xDimenNew = Math.Round(xDimenNew, 7)
                yDimenNew = Math.Round(yDimenNew, 7)

                If yDimenNew = yDimenCurrent Then
                     'If the gap between dimension is less than 5mm
                      If Math.Abs(xDimenCurrent - xDimenNew) < 0.005 Then
                          objDimen1.Jogged = True
                          objDimen1.SetJogPoint2(0.01, 0.01)
                       End If
                End If
            Next
        End If
    Next
Next

aa.png