I create a c# api to create screw flight with pipe, now the problem is till 2 Mtr length this is working fine but if i give input more than 2 Mtr one pipe is extrude and not helix and sweep command.

I create a c# api to create screw flight with pipe, now the problem is till 2 Mtr length this is working fine but if i give input more than 2  Mtr one pipe is extrude and not helix and sweep command.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;

namespace Roller
{
public class PartModel
{
public string PartName { get; set; }

public double PipeOD { get; set; }
public double PipeThk { get; set; }
public double PipeLength { get; set; }
public double ScrewPitch { get; set; }
public double ScrewOD { get; set; }
public double ScrewThk { get; set; }


SldWorks swApp;
ModelDoc2 swModel;
private FeatureManager swFeatureManager;
Feature swFeature;
bool status;
private FeatureManager swFeatureMgr;
string defaultPartTemplate;
private SketchSegment swSketchSegment;
private object boolstatus;
private SketchManager swSketchManager;
private object swModelDocExt;

public void CreatePart()
{
string guid = Guid.NewGuid().ToString();
string root = @"C:\\" + guid;
if (!Directory.Exists(root))
{
Directory.CreateDirectory(root);
}
else
{
MessageBox.Show("a file with the same name exists...");
}

swApp = GetSolidworks.GetApplication();

defaultPartTemplate = swApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
swApp.NewDocument(defaultPartTemplate, 0, 0, 0);

swModel = (ModelDoc2)swApp.ActiveDoc;
swFeature = swModel.FeatureByPositionReverse(2);
swFeature.Name = "Front Plane";

status = swModel.Extension.SelectByID2("Top Plane", "Plane", 0, 0, 0, false, 0, null, 0);

swModel.InsertSketch2(true);

swModel.CreateCircleByRadius2(0, 0, 0, PipeOD / 2);
swModel.CreateCircleByRadius2(0, 0, 0, (PipeOD - (PipeThk * 2)) / 2);

swModel.InsertSketch2(true);

swFeature = swModel.FeatureByPositionReverse(0);
swFeature.Name = "sketch1";

status = swModel.Extension.SelectByID2("sketch1", "SKETCH", 0, 0, 0, false, 0, null, 0);

swModel.FeatureManager.FeatureExtrusion3(true, false, false, 0, 0, PipeLength, 0, false, false, false, false, 0, 0, false, false, false, false, false, false, false, 0, 0, false);

status = swModel.Extension.SelectByID2("", "Face", PipeOD/2, PipeOD/2, 0, false, 0, null, 0);

swModel.InsertSketch2(true);

swModel.CreateCircleByRadius2(0, 0, 0, ScrewOD/2);
swModel.InsertHelix(false,true,false,false,(int)swHelixDefinedBy_e.swHelixDefinedByPitchAndRevolution,0,ScrewPitch,(PipeLength/ScrewPitch),0,0);

swModel.InsertSketch2(true);

swFeature = swModel.FeatureByPositionReverse(0);
swFeature.Name = "sketch2";

status = swModel.Extension.SelectByID2("sketch2", "SKETCH", 0, 0, 0, false, 0, null, 0);

status = swModel.Extension.SelectByID2("", "Face", PipeOD / 2, PipeOD / 2, 0, false, 0, null, 0);

swModel.InsertSketch2(true);

swModel.CreateCircleByRadius2(0, 0, 0, 0);
swModel.CreateLine2(PipeOD / 2, 0, 0, ScrewOD / 2, 0, 0);
swModel.CreateLine2(ScrewOD / 2, 0, 0, ScrewOD / 2, ScrewThk, 0);
swModel.CreateLine2(ScrewOD / 2, ScrewThk, 0, PipeOD / 2, ScrewThk, 0);
swModel.CreateLine2(PipeOD / 2, ScrewThk, 0, PipeOD / 2, 0, 0);

swModel.InsertSketch2(true);

swFeature = swModel.FeatureByPositionReverse(0);
swFeature.Name = "sketch3";

status = swModel.Extension.SelectByID2("sketch3", "SKETCH", 0, 0, 0, false, 0, null, 0);


swModel.ViewZoomtofit2();

status = swModel.Extension.SelectByID2("Sketch3", "SKETCH", 0, 0, 0, true, 0, null, 0);
status = swModel.Extension.SelectByID2("Helix/Spiral1", "REFERENCECURVES", 0, 0, 0, true, 0, null, 0);
swModel.ClearSelection2(true);
status = swModel.Extension.SelectByID2("Sketch3", "SKETCH", 0, 0, 0, false, 1, null, 0);
status = swModel.Extension.SelectByID2("Helix/Spiral1", "REFERENCECURVES", 0, 0, 0, true, 4, null, 0);

swFeatureMgr = swModel.FeatureManager;
swFeature = swFeatureMgr.InsertProtrusionSwept4(false, false, (int)swTwistControlType_e.swTwistControlFollowPath, false, false, (int)swTangencyType_e.swTangencyNone, (int)swTangencyType_e.swTangencyNone, false, 0, 0, (int)swThinWallType_e.swThinWallOneDirection, 0, true, true, true, 0, true, false, 0, 0);

swModel.ShowNamedView2("*Isometric", 7);

swModel.ViewZoomtofit2();

swModel.ForceRebuild3(true);

swModel.SaveAs3(root.ToString() + "\\" + PartName + ".sldprt", (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_CopyAndOpen);


}


}
}

SolidworksApi/macros