3 Replies Latest reply on May 26, 2014 6:23 AM by Luigi Ottoboni

    How can I project a 3d ref point in a drawing view ?

    Luigi Ottoboni


      I have a 3d reference point in a part and I would like to create a 2d sketch point in a drawing view in the same position of the ref point

      Below the code I tried. Unfortunatelly the created sketch point is in a wrong position.

      I think that, what it is wrong, is the missig coord translation from the drawing view space to the sketch space, but I did not find any way to do this translation.


      Thank you


      (run this code in a drawing with one or more views )


      selection = mDoc.Extension.SelectByID2("Point2@asm-2@Drawing View1/Part1-1@asm", "DATUMPOINT", 0, 0, 0, false, 0, null, 0);

      if (!selection) return false;
      DrawingDoc drwDoc = mDoc as DrawingDoc;

      SelectionMgr selMgr = mDoc.ISelectionManager;
      Feature feat1 = (SolidWorks.Interop.sldworks.Feature)selMgr.GetSelectedObject6(1,0);
      IDrawingComponent selComp = selMgr.GetSelectedObjectsComponent4(1, 0) as IDrawingComponent;

      View view = selComp.View;

      RefPoint rPt1 = feat1.IGetSpecificFeature();
      MathPoint mPt1 = rPt1.GetRefPoint();

      MathPoint tPt1 = mPt1.MultiplyTransform(view.ModelToViewTransform);

      double[] sktPt1 = (double[])tPt1.ArrayData;

      SketchPoint sktPt = mDoc.SketchManager.CreatePoint(sktPt1[0], sktPt1[1], 0);