2 Replies Latest reply on Jan 14, 2016 12:45 AM by Viktor Bovzdarenko

    VB Having trouble selecting individual points on a edge. Start and End points come back same after ModeltoViewTransform.

    Brian Greenwood

      When converting Model Edge Start and End points, how come I am getting the same point in the view after converting using the View.ModeltoViewTransform.

       

      The basic premise of this is to select one of these points to dimension off of the point itself not the edge. For some reason after the "swModelViewPoint.MultiplyTransform(swViewXform)" it returns the exact same point even when "vPtData1" and "vPtData2" have different numbers (I usually find this happening when X1 = (negative double) and X2 = (positive same double)). This will be used for auto dimension of a virtual sharp to an edge point, and ordinate dimensions.

       

      Any help at all would be very much appreciated! This issue is pressing so quick feedback would especially be welcome! Thank you!

       

      Below the code is trying to select the start and end point of an edge, but returns the same point.

       

      Here is the example code.


       

      'xxxxxxxxx START xxxxxxxxx

              Dim myModel As ModelDoc2

       

              Dim myEdge as Edge

              Dim nPtData(2) As Double

              Dim swModelViewPoint As MathPoint

              Dim swViewXform As MathTransform

       

              ' THE MULTIPLIER

              swViewXform = myView.ModelToViewTransform

       

              ' GATHERING THE EDGE DATA

              Dim myEdgeStartVertex As Vertex = myEdge.IGetStartVertex

              Dim myEdgeEndVertex As Vertex = myEdge.IGetEndVertex

              Dim myEdgeStartPoints As Double() = myEdgeStartVertex.GetPoint()

              Dim myEdgeEndPoints As Double() =myEdgeEndVertex.GetPoint()

       

              ' BUILDING THE NEW VERTEX (this is actually redundant it is laid out different in my program)

              ' START POINTS

              nPtData(0) = myEdgeStartPoints(0)

              nPtData(1) = myEdgeStartPoints(1)

              nPtData(2) = myEdgeStartPoints(2)

              vPtData1 = nPtData

       

              ' END POINTS

              nPtData(0) = myEdgeEndPoints(0)

              nPtData(1) = myEdgeEndPoints(1)

              nPtData(2) = myEdgeEndPoints(2)

              vPtData2 = nPtData

       

              'CONVERTING AND  SELECTING POINT 1

       

              swModelViewPoint = swMathUtil.CreatePoint(vPtData1)

              swModelViewPoint = swModelViewPoint.MultiplyTransform(swViewXform)

              nPtData = swModelViewPoint.ArrayData

              boolstatus = myModel.Extension.SelectByID2("", "VERTEX", nPtData(0), nPtData(1), nPtData(2), True, 0, Nothing, 0)

             

              ' CONVERTING AND SELECTING POINT 2

              swModelViewPoint = swMathUtil.CreatePoint(vPtData2)

              swModelViewPoint = swModelViewPoint.MultiplyTransform(swViewXform)

              nPtData = swModelViewPoint.ArrayData

              boolstatus = myModel.Extension.SelectByID2("", "VERTEX", nPtData(0), nPtData(1), nPtData(2), True, 0, Nothing, 0)

       

      'xxxxxxxxx END xxxxxxxxx