ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
FGFeng Guan26/08/2009

Dear All,

We want to move a sketch along a face as follow:

1.bmp

Figure 1: orignal sketch

2.bmp

Figure 2: sketch position after movement

The macro shows that the API "moveorcopy" is used. We use this API function in our application. But Solidworks does not move the sketch. The following is our code

----------------------------------------------

swModel.SketchManager.Insert3DSketch(true);
swModel.SketchManager.CreateLine(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z);
swModel.SketchManager.InsertSketch(true);
Feature swFeatSketch = swModel.Extension.GetLastFeatureAdded();
swFeatSketch.Name = string.Concat("path", i.ToString());
swModel.Extension.SelectByID2(swFeatSketch.Name, "SKETCH", 0, 0, 0, false, 0, null, 0);
swModel.SketchManager.Insert3DSketch(true);
swModel.Extension.MoveOrCopy(false, 1, false, p2.x, p2.y, p2.z, p2.x + 0.05, p2.y + 0.05, p2.z + 0.05);
swModel.SketchManager.InsertSketch(true);

----------------------------------------------

Can anyone help us on this? Many thanks