This example shows how to create a loft using profiles, paths, and guide
curves.
//--------------------------------------------------------------------------
// Preconditions:
// 1. Ensure that the specified part exists.
// 2. Rename the namespace of this macro to match the name of your C#
project.
//
// Postconditions: The FeatureManager design tree contains Loft1.
//
// NOTE: Because this part is used in other demonstrations, do not
// save any changes to the part.
//--------------------------------------------------------------------------
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;
int
longstatus;
int
longwarnings;
public
void Main()
{
swApp.OpenDoc6("c:\Program Files\SolidWorks
Corp\SolidWorks\samples\tutorials\api\LoftUsingGuideCurves.SLDPRT",
1, 0, "", longstatus, longwarnings)
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("MajGuide",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("MinGuide",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("MajGuide2",
"SKETCH",
0, 0, 0, true,
2, null,
0);
boolstatus = ModelDocExtension.SelectByID2("MinGuide2",
"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;
}
}