This example shows how to create a loft using profiles, guide
curves, and a centerline.
//--------------------------------------------------------------------------
// Preconditions:
// 1. Open a part document that contains sketches for the profiles,
// guide curves, and centerline for a loft.
// 2. Rename the namespace of this macro to match the name of your C#
project.
//
// Postconditions: A loft is created using the selected sketches.
//--------------------------------------------------------------------------
using
SolidWorks.Interop.sldworks;
using
SolidWorks.Interop.swconst;
using
System;
namespace
InsertProtrusionBlend_CSharp.csproj
{
partial
class
SolidWorksMacro
{
ModelDoc2
Part;
ModelDocExtension
ModelDocExtension;
FeatureManager
FeatMgr;
bool
boolstatus;
public
void Main()
{
Part = (ModelDoc2)swApp.ActiveDoc;
ModelDocExtension = Part.Extension;
FeatMgr = Part.FeatureManager;
Part.ClearSelection2(true);
boolstatus = ModelDocExtension.SelectByID2("Profile",
"SKETCH",
-0.05366906226387, 0.02779202405622, -0.01645511042619,
false, 1,
null, 0);
boolstatus = ModelDocExtension.SelectByID2("Profile2",
"SKETCH",
-0.03807490972985, 0.09779202405622, -0.01314312451485,
true, 1,
null, 0);
boolstatus = ModelDocExtension.SelectByID2("Guide",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("Guide2",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("Guide3",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("Guide4",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("Path",
"SKETCH",
0, 0, 0, true,
4, null,
0);
FeatMgr.InsertProtrusionBlend2(false,
true,
false, 1,
0, 0, 1, 1, true,
true,
false, 0,
0, 0, true,
true,
true, (int)swGuideCurveInfluence_e.swGuideCurveInfluenceNextGlobal);
}
public
SldWorks
swApp;
}
}