//----------------------------------------------------------------------------
// Preconditions:
// 1. Open a sheet metal part that contains two sketch profiles, Sketch1
and
// Sketch2, that reside on parallel planes.
// 2. Open the Immediate window.
//
// Postconditions:
// 1. A lofted bend is inserted in the FeatureManager design tree.
// 2. Inspect the Immediate window.
//
---------------------------------------------------------------------------
using
SolidWorks.Interop.sldworks;
using
SolidWorks.Interop.swconst;
using
System.Runtime.InteropServices;
using
System;
using
System.Diagnostics;
namespace
InsertedLoftedBend_CSharp.csproj
{
partial
class
SolidWorksMacro
{
ModelDoc2
Part;
Feature
feat;
LoftedBendsFeatureData
lbfd;
bool
boolstatus;
public
void
Main()
{
Part = (ModelDoc2)swApp.ActiveDoc;
boolstatus = Part.Extension.SelectByID2("Sketch1",
"SKETCH",
0, 0, 0, false,
1, null,
0);
boolstatus = Part.Extension.SelectByID2("Sketch2",
"SKETCH",
0, 0, 0, true,
1, null,
0);
// Insert a lofted bend
feature with two bends
feat = Part.FeatureManager.InsertSheetMetalLoftedBend2(0,
0.0007366, false,
0.0007366, true,
(int)swLoftedBendFacetOptions_e.swBendsPerTransitionSegment,
0, 2, 0, 0);
// Get lofted bend feature
data
lbfd = (LoftedBendsFeatureData)feat.GetDefinition();
Debug.Print("Number
of sketch profiles in this feature: " +
lbfd.GetProfileCount());
Debug.Print("Thickness:
" + lbfd.Thickness);
Debug.Print("Reverse
thickness direction? " + lbfd.Direction);
Debug.Print("Faceting
option as defined in swLoftedBendFacetOptions_e: "
+ lbfd.FacetingOption);
Debug.Print("Faceting
option value: " + lbfd.FacetValue);
Debug.Print("Formed?
" + lbfd.FormedMethod);
Debug.Print("Calculate
facet transitions using vertexes? " +
lbfd.ReferToEndPoint);
}
public
SldWorks
swApp;
}
}