Cancel
Showing results for 
Search instead for 
Did you mean: 

Edge Blend

Pioneer
Pioneer

Hello Guys,

Below code is selecting back side of edge of cylinder and applying blend.

I want to select front edge of cylinder in the code itself and not by user.

and second thing is that If possible, you could make sub method(Ex:CreateEdgeBlend) and call(invoke) it in the main method.

please suggest any solution.

Thank You

 

using System;
using NXOpen;
using NXOpen.Features;

namespace EDGEBlendAndChamfer
{
public class CreateEdge
{

public static Session theSession;
public static Part workPart;
public static Part Displaypart;

public static void Main()
{
theSession = Session.GetSession();
workPart = theSession.Parts.Work;
Displaypart = theSession.Parts.Display;

NXOpen.Features.CylinderBuilder cylinderbuilder;
cylinderbuilder = workPart.Features.CreateCylinderBuilder(null);

// Specify the cylinder definition type(AxisDiameterAndHeight)
cylinderbuilder.Type = NXOpen.Features.CylinderBuilder.Types.AxisDiameterAndHeight;

// Define the Cylinder Axis
Point3d origin = new Point3d(0, 0, 0);
Vector3d vector = new Vector3d(1, 0, 0);
Direction direction;
direction = workPart.Directions.CreateDirection(origin, vector, SmartObject.UpdateOption.WithinModeling);
Axis axis;
axis = cylinderbuilder.Axis;
axis.Direction = direction;

// Define Cylinder Diameter
string diamString = "100";
cylinderbuilder.Diameter.RightHandSide = diamString;

// Define Cylinder Height
string heightString = "20";
cylinderbuilder.Height.RightHandSide = heightString;

// Define the boolean option (Create, unite, etc.)
cylinderbuilder.BooleanOption.Type = NXOpen.GeometricUtilities.BooleanOperation.BooleanType.Create;

// Destroy the builder to free memory
NXObject cylinder = cylinderbuilder.Commit();
cylinderbuilder.Destroy();


NXOpen.Features.Feature nullNXOpen_Features_Feature = null;
NXOpen.Features.EdgeBlendBuilder edgeBlendBuilder1;
edgeBlendBuilder1 = workPart.Features.CreateEdgeBlendBuilder(nullNXOpen_Features_Feature);

NXOpen.ScCollector scCollector1;
scCollector1 = workPart.ScCollectors.CreateCollector();

NXOpen.Edge[] seedEdges1 = new NXOpen.Edge[1];
NXOpen.Features.Cylinder cylinder1 = (NXOpen.Features.Cylinder)cylinder;
NXOpen.Edge edge1 = (NXOpen.Edge)cylinder1.GetEdges()[0];
seedEdges1[0] = edge1;

NXOpen.EdgeMultipleSeedTangentRule edgeMultipleSeedTangentRule1;
edgeMultipleSeedTangentRule1 = workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(seedEdges1, 0.5, true);

NXOpen.SelectionIntentRule[] rules1 = new NXOpen.SelectionIntentRule[1];
rules1[0] = edgeMultipleSeedTangentRule1;
scCollector1.ReplaceRules(rules1, false);

edgeBlendBuilder1.Tolerance = 0.01;

edgeBlendBuilder1.AllInstancesOption = false;

edgeBlendBuilder1.RemoveSelfIntersection = true;

edgeBlendBuilder1.PatchComplexGeometryAreas = true;

edgeBlendBuilder1.LimitFailingAreas = true;

edgeBlendBuilder1.ConvexConcaveY = false;

edgeBlendBuilder1.RollOverSmoothEdge = true;

edgeBlendBuilder1.RollOntoEdge = true;

edgeBlendBuilder1.MoveSharpEdge = true;

edgeBlendBuilder1.TrimmingOption = false;

edgeBlendBuilder1.OverlapOption = NXOpen.Features.EdgeBlendBuilder.Overlap.AnyConvexityRollOver;

edgeBlendBuilder1.BlendOrder = NXOpen.Features.EdgeBlendBuilder.OrderOfBlending.ConvexFirst;

edgeBlendBuilder1.SetbackOption = NXOpen.Features.EdgeBlendBuilder.Setback.SeparateFromCorner;

edgeBlendBuilder1.BlendFaceContinuity = NXOpen.Features.EdgeBlendBuilder.FaceContinuity.Tangent;

int csIndex1;
csIndex1 = edgeBlendBuilder1.AddChainset(scCollector1, "5");

NXOpen.Features.Feature feature1;
feature1 = edgeBlendBuilder1.CommitFeature();
edgeBlendBuilder1.Destroy();
}
public static int GetUnloadOption(string dummy) { return (int)NXOpen.Session.LibraryUnloadOption.Immediately; }
}

}