How to change the profile locate point for a structural member

Hi All,

Usually, a structural member is located at the center point of its profile. I am tring to move it to another point on the profile. What I coded is listed in the following, but it doesn't work. Can anyone let me know the solution?


Thanks

Tony

            //Structural feature is created, and by default located at the center point of the profile

            myFeature = ((Feature)(swDoc.FeatureManager.InsertStructuralWeldment4("O:\\Solidworks\\Stealth Templates\\Weldment Profiles\\ansi inch\\W Section\\W16x40.sldl"                                   + "fp", 1, true, vGroups)));

            swDoc.ClearSelection2(true);

            //Get Structural member feature data

            StructuralMemberFeatureData swWeldFeatData = (StructuralMemberFeatureData)myFeature.GetDefinition();

            swWeldFeatData.AccessSelections(swDoc, null);

            //Get the points that the structural member will be relocated

            boolstatus = swDoc.Extension.SelectByID2("Point27@Sketch11", "EXTSKETCHPOINT", 0, 0.20332700000000004, 0, true, 0, null, 0);

            boolstatus = swDoc.Extension.SelectByID2("Point27@Sketch11", "EXTSKETCHPOINT", 0, 0.20332700000000004, 0, true, 0, null, 0);

            SketchPoint swSketchPt1 = (SketchPoint)swDoc.ISelectionManager.GetSelectedObject(1);

            SketchPoint swSketchPt2 = (SketchPoint)swDoc.ISelectionManager.GetSelectedObject(2);

            //SketchPoint swSketchPt2 = (SketchPoint)swDoc.ISelectionManager.GetSelectionPoint(2);

            //Set the property of LocatProfilePoint to the specified points

            object[] wGroups = (object[])swWeldFeatData.Groups;

            StructuralMemberGroup wGroup1 = (StructuralMemberGroup)wGroups[0];

            wGroup1.LocateProfilePoint = swSketchPt1;

            StructuralMemberGroup wGroup2 = (StructuralMemberGroup)wGroups[1];

            wGroup2.LocateProfilePoint = swSketchPt2;

            swWeldFeatData.ReleaseSelectionAccess();

            //Implment the modification

            myFeature.ModifyDefinition(swWeldFeatData, swDoc, null);

            swDoc.ClearSelection2(true);

SolidworksApi macros