1 Reply Latest reply on Apr 12, 2017 7:43 AM by Moon Wang

    puzzle with get curve parameters of Sketch3DIntersections

    Moon Wang

      Hi,

      I'm having problems making my .Net addin create Intersection Curve between a plane and a solid body.I have already get the Intersection Curve, Furthermore,I want to get the curve parameters of Sketch3DIntersections.my kernel code is below:

      RefPlane myRefPlane = null;

                      myRefPlane = ((RefPlane)(swDoc.FeatureManager.InsertRefPlane(8, 0.005, 0, 0, 0, 0)));

                      swDoc.ClearSelection2(true);

                      swDoc.Sketch3DIntersections();

                      boolstatus = swDoc.Extension.SelectByID2("", "FACE", 0.015, 0, 0.01, true, 0, null, 0);

                      boolstatus = swDoc.Extension.SelectByID2(''datum plane'', "PLANE", 0, 0, 0.05, true, 0, null, 0);

       

                      swDoc.Sketch3DIntersections();

                      swDoc.ClearSelection2(true);

                      swDoc.SketchManager.InsertSketch(true);//I can get a 3d sketch successfully here

                     

                      SketchSegment skSegment2 = null;

                      SelectionMgr swSelectMgr = null;

                      swSelectMgr = (SelectionMgr)swDoc.SelectionManager;

                      skSegment2 = (SketchSegment)swSelectMgr.GetSelectedObject6(1, -1); //step1

                      swCurve = (Curve)skSegment2.IGetCurve();

                     SplineParamData swSplineParaData = default(SplineParamData);

                     swSplineParaData = (SplineParamData)swCurve.GetBCurveParams5(false, false, true, true);

       

      when I go to the step1,It warns me that I can't transform com object“System.__ComObject” to interface “SolidWorks.Interop.sldworks.SketchSegment”,I have seen similiar use in  the API help.so what should I do to get the parameter of the curve?

      Best Regards,thanks

      Moon