AnsweredAssumed Answered

How to calculate CreatePoint in drawing file via midpoint ?

Question asked by Nishihama Sayuri on Aug 7, 2017
Latest reply on Aug 8, 2017 by Nishihama Sayuri

I can't create point at the MidPoint position.

How can I draw Point at the correct position ?

 

I got EdgePoint datum and got xyz by using EdgePoint.GetPointCoordinates method.

I run CreatePoint method, but its position is wrong.

 

    ' Select MidPoint
    swModel.SelectMidpoint

 

    ' Get selected EDGE
    Dim edgep As SldWorks.EdgePoint
    Set edgep = swSelMgr.GetSelectedObject6(2, -1)  ' first:Edge, second:EdgePoint(PointRef)
    Dim swEdgePt As EdgePoint
    Set swEdgePt = edgep
   
   ' Get MidPoint Coordinates
    Dim mx As Double
    Dim my As Double
    Dim mz As Double
    Call swEdgePt.GetPointCoordinates(mx, my, mz)
   
    Dim mPt(0 To 2) As Double
    mPt(0) = mx
    mPt(1) = my
    mPt(2) = mz
   
   ' Create Point at the midpoint position
    ' But its position is wrong.
    Dim skPt As SketchPoint
    Set skPt = swModel.SketchManager.CreatePoint(mPt(0), mPt(1), mPt(2))
  

 

Thanks.

Outcomes