public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; String currentPath = ""; if (workPart != null) { try { String dirName = new FileInfo(displayPart.FullPath).Directory.FullName; Process myApp = new Process(); myApp.StartInfo.FileName = @"EXPLORER.exe"; myApp.StartInfo.Arguments = String.Format("{0}", dirName); myApp.Start(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error...", MessageBoxButtons.OK); } } else { MessageBox.Show("No parts are open."); } }
//-------------------------------------------------------------------------- // The main interface by which NX will start and stop the application //-------------------------------------------------------------------------- // The main entry point. Called when this library is loaded public static void Main() { theSession = Session.GetSession(); theUFSession = UFSession.GetUFSession(); theViewer = new AssemblyViewer(); theViewer.Show(); }
public static CartesianCoordinateSystem CreateCoordinateSystem(Point3d ori, Vector3d xVec, Vector3d yVec, Vector3d zVec) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; Matrix3x3 mat = new Matrix3x3(); mat.Xx = xVec.X; mat.Xy = xVec.Y; mat.Xz = xVec.Z; mat.Yx = yVec.X; mat.Yy = yVec.Y; mat.Yz = yVec.Z; //Vector3d zVec = UMathUtils.VectorCross(xVec, yVec); mat.Zx = zVec.X; mat.Zy = zVec.Y; mat.Zz = zVec.Z; try { return(workPart.CoordinateSystems.CreateCoordinateSystem(ori, mat, true)); } catch (Exception ex) { LogMgr.WriteLog("BoundingBoxUtils.CreateCoordinateSystem 矩阵不是正交!" + ex.Message); CartesianCoordinateSystem cas = workPart.CoordinateSystems.CreateCoordinateSystem(ori, xVec, yVec); cas.Blank(); return(cas); } }
/// <summary> /// 计算面的面积 /// </summary> /// <param name="face"></param> /// <returns></returns> public static double GetFaceArea(Face face) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; try { Unit unit1 = workPart.UnitCollection.FindObject("SquareMilliMeter"); Unit unit2 = workPart.UnitCollection.FindObject("MilliMeter"); double accuracy = workPart.Preferences.Modeling.AngleToleranceData; IParameterizedSurface[] objects1 = new IParameterizedSurface[1]; objects1[0] = face as IParameterizedSurface; MeasureFaces measureface = workPart.MeasureManager.NewFaceProperties(unit1, unit2, accuracy, objects1); return(measureface.Area); } catch (Exception ex) { LogMgr.WriteLog("FaceUtils:GetFaceArea:" + ex.Message); } finally { } return(0); }
/// <summary> /// 设置视图线框颜色源 /// </summary> /// <param name="option"></param> /// <param name="views"></param> public static void SetWireframeColorSource(NXOpen.Preferences.GeneralWireframeColorSourceOption option, params View[] views) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Drawings.EditViewSettingsBuilder editViewSettingsBuilder1; editViewSettingsBuilder1 = workPart.SettingsManager.CreateDrawingEditViewSettingsBuilder(views); NXOpen.Drafting.BaseEditSettingsBuilder[] editsettingsbuilders1 = new NXOpen.Drafting.BaseEditSettingsBuilder[1]; editsettingsbuilders1[0] = editViewSettingsBuilder1; workPart.SettingsManager.ProcessForMultipleObjectsSettings(editsettingsbuilders1); editViewSettingsBuilder1.ViewStyle.ViewStyleGeneral.WireframeColorSource = option; editViewSettingsBuilder1.ViewStyle.ViewStyleVisibleLines.VisibleColor = workPart.Colors.Find("Background"); try { NXOpen.NXObject nXObject1; nXObject1 = editViewSettingsBuilder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("DrawingUtils:SetWireframeColorSource" + ex.Message); throw ex; } finally { editViewSettingsBuilder1.Destroy(); } }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; String currentPath = ""; try { String dirName = new FileInfo(displayPart.FullPath).Directory.FullName; String fileName = Path.GetFileNameWithoutExtension(displayPart.FullPath); String sourceFile = @"L:\IevgenZ\template\PM_validation_template.docx"; String destFile = dirName + "\\" + fileName + ".docx"; //MessageBox.Show(destFile + " - exists: " + System.IO.Directory.Exists(destFile).ToString()); //Boolean DirectoryExists = new DirectoryInfo(destFile).Exists; Boolean DirectoryExists = System.IO.File.Exists(destFile); //MessageBox.Show(destFile + " - exists: " + DirectoryExists.ToString()); if (!DirectoryExists) { System.IO.File.Copy(sourceFile, destFile, false); // Copy, do not overwrite } System.Diagnostics.Process.Start(String.Format(@"{0}", destFile)); // Open file } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error...", MessageBoxButtons.OK); } }
public static CartesianCoordinateSystem CreateCoordinateSystem(Point3d ori, Vector3d xVec, Vector3d yVec, Vector3d zVec) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; Matrix3x3 mat = new Matrix3x3(); mat.Xx = xVec.X; mat.Xy = xVec.Y; mat.Xz = xVec.Z; mat.Yx = yVec.X; mat.Yy = yVec.Y; mat.Yz = yVec.Z; //Vector3d zVec = UMathUtils.VectorCross(xVec, yVec); mat.Zx = zVec.X; mat.Zy = zVec.Y; mat.Zz = zVec.Z; try { return(workPart.CoordinateSystems.CreateCoordinateSystem(ori, mat, true)); } catch (Exception ex) { return(workPart.CoordinateSystems.CreateCoordinateSystem(ori, xVec, yVec)); } }
/// <summary> /// 打开 部件 /// </summary> /// <param name="path">地址</param> /// <returns></returns> public static Part OpenPartFile(string path) { if (!File.Exists(path)) { return(null); } NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.BasePart basePart1; NXOpen.PartLoadStatus partLoadStatus1; basePart1 = theSession.Parts.OpenBaseDisplay(path, out partLoadStatus1); partLoadStatus1.Dispose(); return(basePart1 as Part); }
// private static TransCAD.Application tApp; static void Main(string[] args) { System.Console.WriteLine("parameter count = {0}", args.Length); var AssemManager = new Assembly(); //Instance of Assembly Class var fileDir = new NewNXfile(); //Contains File Directory Infromation fileDir.initiatefl(args[0]); AssemManager.InitializeTransCAD(); AssemManager.loadAssemblyInfo(); nxSession = Session.GetSession(); AssemManager.FromTransCAD(nxSession); // AssemManager.FindtheEdgeName(nxSession); AssemManager.NXRootFile(nxSession, fileDir); AssemManager.ToNXFile(nxSession); }
/// <summary> /// 打开 部件 /// </summary> /// <param name="path">地址</param> /// <returns></returns> public static Part OpenPartFile(string path) { if (!File.Exists(path)) { return(null); } NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.BasePart basePart1; NXOpen.PartLoadStatus partLoadStatus1; try { basePart1 = theSession.Parts.OpenBaseDisplay(path, out partLoadStatus1); partLoadStatus1.Dispose(); return(basePart1 as Part); } catch (NXException ex) { LogMgr.WriteLog("PartUtils.OpenPartFile" + ex.Message); throw ex; } }
public static void Main(string[] args) { Console.WriteLine("Starting NX Golden Cantilever Journal"); //Declare Part Variables //Convert Strings to doubles from the args double heightA = System.Convert.ToDouble(args[0]); double length = System.Convert.ToDouble(args[1]); double thickness = System.Convert.ToDouble(args[2]); //Declare part name for the part file and the IGES file string part_name = args[3]; string part_name_prt = part_name + ".prt"; string part_name_igs = part_name + ".igs"; //Measurements need to be converted from m to mm //length = 1000 * length; //thickness = 1000 * thickness; //heightA = 1000 * heightA; double heightB = 1.618 * heightA; //Convert necessary values back to strings because I already //converted them to doubles and I'm too lazy to go back and change //this since it works. string length_string = System.Convert.ToString(length); string thickness_string = System.Convert.ToString(thickness); string heightA_string = System.Convert.ToString(heightA); string heightB_string = System.Convert.ToString(heightB); NXOpen.Session theSession = NXOpen.Session.GetSession(); // ---------------------------------------------- // Menu: File->New... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId1; markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start"); NXOpen.FileNew fileNew1; fileNew1 = theSession.Parts.FileNew(); theSession.SetUndoMarkName(markId1, "New Dialog"); NXOpen.Session.UndoMarkId markId2; markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "New"); theSession.DeleteUndoMark(markId2, null); NXOpen.Session.UndoMarkId markId3; markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "New"); fileNew1.TemplateFileName = "model-plain-1-mm-template.prt"; fileNew1.UseBlankTemplate = false; fileNew1.ApplicationName = "ModelTemplate"; fileNew1.Units = NXOpen.Part.Units.Millimeters; fileNew1.RelationType = ""; fileNew1.UsesMasterModel = "No"; fileNew1.TemplateType = NXOpen.FileNewTemplateType.Item; fileNew1.TemplatePresentationName = "Model"; fileNew1.ItemType = ""; fileNew1.Specialization = ""; fileNew1.SetCanCreateAltrep(false); fileNew1.NewFileName = part_name_prt; fileNew1.MasterFileName = ""; fileNew1.MakeDisplayedPart = true; NXOpen.NXObject nXObject1; nXObject1 = fileNew1.Commit(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; theSession.DeleteUndoMark(markId3, null); fileNew1.Destroy(); theSession.ApplicationSwitchImmediate("UG_APP_MODELING"); NXOpen.Session.UndoMarkId markId4; markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Enter Gateway"); NXOpen.Session.UndoMarkId markId5; markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Enter Modeling"); // ---------------------------------------------- // Menu: Insert->Sketch... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId6; markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start"); NXOpen.Sketch nullNXOpen_Sketch = null; NXOpen.SketchInPlaceBuilder sketchInPlaceBuilder1; sketchInPlaceBuilder1 = workPart.Sketches.CreateNewSketchInPlaceBuilder(nullNXOpen_Sketch); NXOpen.Unit unit1 = (NXOpen.Unit)workPart.UnitCollection.FindObject("MilliMeter"); NXOpen.Expression expression1; expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1); NXOpen.Expression expression2; expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1); NXOpen.SketchAlongPathBuilder sketchAlongPathBuilder1; sketchAlongPathBuilder1 = workPart.Sketches.CreateSketchAlongPathBuilder(nullNXOpen_Sketch); sketchAlongPathBuilder1.PlaneLocation.Expression.RightHandSide = "0"; theSession.SetUndoMarkName(markId6, "Create Sketch Dialog"); NXOpen.DatumPlane datumPlane1 = (NXOpen.DatumPlane)workPart.Datums.FindObject("DATUM_CSYS(0) YZ plane"); NXOpen.Point3d point1 = new NXOpen.Point3d(11.1863449593062, 6.4875984180345, 0.0); sketchInPlaceBuilder1.PlaneOrFace.SetValue(datumPlane1, workPart.ModelingViews.WorkView, point1); NXOpen.Features.DatumCsys datumCsys1 = (NXOpen.Features.DatumCsys)workPart.Features.FindObject("DATUM_CSYS(0)"); NXOpen.Point point2 = (NXOpen.Point)datumCsys1.FindObject("POINT 1"); sketchInPlaceBuilder1.SketchOrigin = point2; sketchInPlaceBuilder1.PlaneOrFace.Value = null; sketchInPlaceBuilder1.PlaneOrFace.Value = datumPlane1; NXOpen.DatumAxis datumAxis1 = (NXOpen.DatumAxis)workPart.Datums.FindObject("DATUM_CSYS(0) X axis"); sketchInPlaceBuilder1.Axis.Value = datumAxis1; NXOpen.Session.UndoMarkId markId7; markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Create Sketch"); theSession.DeleteUndoMark(markId7, null); NXOpen.Session.UndoMarkId markId8; markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Create Sketch"); theSession.Preferences.Sketch.CreateInferredConstraints = true; theSession.Preferences.Sketch.ContinuousAutoDimensioning = true; theSession.Preferences.Sketch.DimensionLabel = NXOpen.Preferences.SketchPreferences.DimensionLabelType.Expression; theSession.Preferences.Sketch.TextSizeFixed = true; theSession.Preferences.Sketch.FixedTextSize = 3.0; theSession.Preferences.Sketch.ConstraintSymbolSize = 3.0; theSession.Preferences.Sketch.DisplayObjectColor = false; theSession.Preferences.Sketch.DisplayObjectName = true; NXOpen.NXObject nXObject2; nXObject2 = sketchInPlaceBuilder1.Commit(); NXOpen.Sketch sketch1 = (NXOpen.Sketch)nXObject2; NXOpen.Features.Feature feature1; feature1 = sketch1.Feature; NXOpen.Session.UndoMarkId markId9; markId9 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "update"); int nErrs1; nErrs1 = theSession.UpdateManager.DoUpdate(markId9); sketch1.Activate(NXOpen.Sketch.ViewReorient.True); theSession.DeleteUndoMark(markId8, null); theSession.SetUndoMarkName(markId6, "Create Sketch"); sketchInPlaceBuilder1.Destroy(); sketchAlongPathBuilder1.Destroy(); try { // Expression is still in use. workPart.Expressions.Delete(expression2); } catch (NXException ex) { ex.AssertErrorCode(1050029); } try { // Expression is still in use. workPart.Expressions.Delete(expression1); } catch (NXException ex) { ex.AssertErrorCode(1050029); } // ---------------------------------------------- // Menu: Insert->Sketch Curve->Line... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId10; markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Profile short list"); NXOpen.Session.UndoMarkId markId11; markId11 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Curve"); NXOpen.Expression expression3; expression3 = workPart.Expressions.CreateSystemExpression(length_string); theSession.SetUndoMarkVisibility(markId11, "Curve", NXOpen.Session.MarkVisibility.Visible); NXOpen.Point3d startPoint1 = new NXOpen.Point3d(0.0, 0.0, 0.0); NXOpen.Point3d endPoint1 = new NXOpen.Point3d(length, 0.0, 0.0); NXOpen.Line line1; line1 = workPart.Curves.CreateLine(startPoint1, endPoint1); theSession.ActiveSketch.AddGeometry(line1, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); NXOpen.Sketch.ConstraintGeometry geom1_1 = new NXOpen.Sketch.ConstraintGeometry(); geom1_1.Geometry = line1; geom1_1.PointType = NXOpen.Sketch.ConstraintPointType.StartVertex; geom1_1.SplineDefiningPointIndex = 0; NXOpen.Sketch.ConstraintGeometry geom2_1 = new NXOpen.Sketch.ConstraintGeometry(); NXOpen.Features.DatumCsys datumCsys2 = (NXOpen.Features.DatumCsys)workPart.Features.FindObject("SKETCH(1:1B)"); NXOpen.Point point3 = (NXOpen.Point)datumCsys2.FindObject("POINT 1"); geom2_1.Geometry = point3; geom2_1.PointType = NXOpen.Sketch.ConstraintPointType.None; geom2_1.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint1; sketchGeometricConstraint1 = theSession.ActiveSketch.CreateCoincidentConstraint(geom1_1, geom2_1); NXOpen.Sketch.ConstraintGeometry geom1 = new NXOpen.Sketch.ConstraintGeometry(); geom1.Geometry = line1; geom1.PointType = NXOpen.Sketch.ConstraintPointType.None; geom1.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint2; sketchGeometricConstraint2 = theSession.ActiveSketch.CreateHorizontalConstraint(geom1); NXOpen.Sketch.DimensionGeometry dimObject1_1 = new NXOpen.Sketch.DimensionGeometry(); dimObject1_1.Geometry = line1; dimObject1_1.AssocType = NXOpen.Sketch.AssocType.StartPoint; dimObject1_1.AssocValue = 0; dimObject1_1.HelpPoint.X = 0.0; dimObject1_1.HelpPoint.Y = 0.0; dimObject1_1.HelpPoint.Z = 0.0; NXOpen.NXObject nullNXOpen_NXObject = null; dimObject1_1.View = nullNXOpen_NXObject; NXOpen.Sketch.DimensionGeometry dimObject2_1 = new NXOpen.Sketch.DimensionGeometry(); dimObject2_1.Geometry = line1; dimObject2_1.AssocType = NXOpen.Sketch.AssocType.EndPoint; dimObject2_1.AssocValue = 0; dimObject2_1.HelpPoint.X = 0.0; dimObject2_1.HelpPoint.Y = 0.0; dimObject2_1.HelpPoint.Z = 0.0; dimObject2_1.View = nullNXOpen_NXObject; NXOpen.Point3d dimOrigin1 = new NXOpen.Point3d(45.0, -9.0598069411704, 0.0); NXOpen.SketchDimensionalConstraint sketchDimensionalConstraint1; sketchDimensionalConstraint1 = theSession.ActiveSketch.CreateDimension(NXOpen.Sketch.ConstraintType.ParallelDim, dimObject1_1, dimObject2_1, dimOrigin1, expression3, NXOpen.Sketch.DimensionOption.CreateAsDriving); NXOpen.SketchHelpedDimensionalConstraint sketchHelpedDimensionalConstraint1 = (NXOpen.SketchHelpedDimensionalConstraint)sketchDimensionalConstraint1; NXOpen.Annotations.Dimension dimension1; dimension1 = sketchHelpedDimensionalConstraint1.AssociatedDimension; theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- NXOpen.Session.UndoMarkId markId12; markId12 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Curve"); NXOpen.Expression expression4; expression4 = workPart.Expressions.CreateSystemExpression(heightA_string); NXOpen.Expression expression5; expression5 = workPart.Expressions.CreateSystemExpression(length_string); workPart.Expressions.Edit(expression4, heightA_string); theSession.SetUndoMarkVisibility(markId12, "Curve", NXOpen.Session.MarkVisibility.Visible); NXOpen.Point3d startPoint2 = new NXOpen.Point3d(length, 0.0, 0.0); NXOpen.Point3d endPoint2 = new NXOpen.Point3d(length, heightA, 0.0); NXOpen.Line line2; line2 = workPart.Curves.CreateLine(startPoint2, endPoint2); theSession.ActiveSketch.AddGeometry(line2, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); NXOpen.Sketch.ConstraintGeometry geom1_2 = new NXOpen.Sketch.ConstraintGeometry(); geom1_2.Geometry = line2; geom1_2.PointType = NXOpen.Sketch.ConstraintPointType.StartVertex; geom1_2.SplineDefiningPointIndex = 0; NXOpen.Sketch.ConstraintGeometry geom2_2 = new NXOpen.Sketch.ConstraintGeometry(); geom2_2.Geometry = line1; geom2_2.PointType = NXOpen.Sketch.ConstraintPointType.EndVertex; geom2_2.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint3; sketchGeometricConstraint3 = theSession.ActiveSketch.CreateCoincidentConstraint(geom1_2, geom2_2); NXOpen.Sketch.ConstraintGeometry geom2 = new NXOpen.Sketch.ConstraintGeometry(); geom2.Geometry = line2; geom2.PointType = NXOpen.Sketch.ConstraintPointType.None; geom2.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint4; sketchGeometricConstraint4 = theSession.ActiveSketch.CreateVerticalConstraint(geom2); workPart.Expressions.Delete(expression5); NXOpen.Sketch.DimensionGeometry dimObject1_2 = new NXOpen.Sketch.DimensionGeometry(); dimObject1_2.Geometry = line2; dimObject1_2.AssocType = NXOpen.Sketch.AssocType.StartPoint; dimObject1_2.AssocValue = 0; dimObject1_2.HelpPoint.X = 0.0; dimObject1_2.HelpPoint.Y = 0.0; dimObject1_2.HelpPoint.Z = 0.0; dimObject1_2.View = nullNXOpen_NXObject; NXOpen.Sketch.DimensionGeometry dimObject2_2 = new NXOpen.Sketch.DimensionGeometry(); dimObject2_2.Geometry = line2; dimObject2_2.AssocType = NXOpen.Sketch.AssocType.EndPoint; dimObject2_2.AssocValue = 0; dimObject2_2.HelpPoint.X = 0.0; dimObject2_2.HelpPoint.Y = 0.0; dimObject2_2.HelpPoint.Z = 0.0; dimObject2_2.View = nullNXOpen_NXObject; NXOpen.Point3d dimOrigin2 = new NXOpen.Point3d(99.0598069411704, 15.0, 0.0); NXOpen.SketchDimensionalConstraint sketchDimensionalConstraint2; sketchDimensionalConstraint2 = theSession.ActiveSketch.CreateDimension(NXOpen.Sketch.ConstraintType.ParallelDim, dimObject1_2, dimObject2_2, dimOrigin2, expression4, NXOpen.Sketch.DimensionOption.CreateAsDriving); NXOpen.SketchHelpedDimensionalConstraint sketchHelpedDimensionalConstraint2 = (NXOpen.SketchHelpedDimensionalConstraint)sketchDimensionalConstraint2; NXOpen.Annotations.Dimension dimension2; dimension2 = sketchHelpedDimensionalConstraint2.AssociatedDimension; theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- NXOpen.Session.UndoMarkId markId13; markId13 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Curve"); NXOpen.Expression expression6; expression6 = workPart.Expressions.CreateSystemExpression(heightB_string); NXOpen.Expression expression7; expression7 = workPart.Expressions.CreateSystemExpression(length_string); theSession.SetUndoMarkVisibility(markId13, "Curve", NXOpen.Session.MarkVisibility.Visible); NXOpen.Point3d startPoint3 = new NXOpen.Point3d(0.0, 0.0, 0.0); NXOpen.Point3d endPoint3 = new NXOpen.Point3d(7.02873218749514e-014, heightB, 0.0); NXOpen.Line line3; line3 = workPart.Curves.CreateLine(startPoint3, endPoint3); theSession.ActiveSketch.AddGeometry(line3, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); NXOpen.Sketch.ConstraintGeometry geom1_3 = new NXOpen.Sketch.ConstraintGeometry(); geom1_3.Geometry = line3; geom1_3.PointType = NXOpen.Sketch.ConstraintPointType.StartVertex; geom1_3.SplineDefiningPointIndex = 0; NXOpen.Sketch.ConstraintGeometry geom2_3 = new NXOpen.Sketch.ConstraintGeometry(); geom2_3.Geometry = line1; geom2_3.PointType = NXOpen.Sketch.ConstraintPointType.StartVertex; geom2_3.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint5; sketchGeometricConstraint5 = theSession.ActiveSketch.CreateCoincidentConstraint(geom1_3, geom2_3); NXOpen.Sketch.ConstraintGeometry geom3 = new NXOpen.Sketch.ConstraintGeometry(); geom3.Geometry = line3; geom3.PointType = NXOpen.Sketch.ConstraintPointType.None; geom3.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint6; sketchGeometricConstraint6 = theSession.ActiveSketch.CreateVerticalConstraint(geom3); workPart.Expressions.Delete(expression7); NXOpen.Sketch.DimensionGeometry dimObject1_3 = new NXOpen.Sketch.DimensionGeometry(); dimObject1_3.Geometry = line3; dimObject1_3.AssocType = NXOpen.Sketch.AssocType.StartPoint; dimObject1_3.AssocValue = 0; dimObject1_3.HelpPoint.X = 0.0; dimObject1_3.HelpPoint.Y = 0.0; dimObject1_3.HelpPoint.Z = 0.0; dimObject1_3.View = nullNXOpen_NXObject; NXOpen.Sketch.DimensionGeometry dimObject2_3 = new NXOpen.Sketch.DimensionGeometry(); dimObject2_3.Geometry = line3; dimObject2_3.AssocType = NXOpen.Sketch.AssocType.EndPoint; dimObject2_3.AssocValue = 0; dimObject2_3.HelpPoint.X = 0.0; dimObject2_3.HelpPoint.Y = 0.0; dimObject2_3.HelpPoint.Z = 0.0; dimObject2_3.View = nullNXOpen_NXObject; NXOpen.Point3d dimOrigin3 = new NXOpen.Point3d(9.05980694117043, heightA, 0.0); NXOpen.SketchDimensionalConstraint sketchDimensionalConstraint3; sketchDimensionalConstraint3 = theSession.ActiveSketch.CreateDimension(NXOpen.Sketch.ConstraintType.ParallelDim, dimObject1_3, dimObject2_3, dimOrigin3, expression6, NXOpen.Sketch.DimensionOption.CreateAsDriving); NXOpen.SketchHelpedDimensionalConstraint sketchHelpedDimensionalConstraint3 = (NXOpen.SketchHelpedDimensionalConstraint)sketchDimensionalConstraint3; NXOpen.Annotations.Dimension dimension3; dimension3 = sketchHelpedDimensionalConstraint3.AssociatedDimension; theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- NXOpen.Session.UndoMarkId markId14; markId14 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Curve"); theSession.SetUndoMarkVisibility(markId14, "Curve", NXOpen.Session.MarkVisibility.Visible); NXOpen.Point3d startPoint4 = new NXOpen.Point3d(0.0, heightB, 0.0); NXOpen.Point3d endPoint4 = new NXOpen.Point3d(length, heightA, 0.0); //NXOpen.Point3d endPoint4 = new NXOpen.Point3d(90.0, 29.9999999999998, 0.0); NXOpen.Line line4; line4 = workPart.Curves.CreateLine(startPoint4, endPoint4); theSession.ActiveSketch.AddGeometry(line4, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); NXOpen.Sketch.ConstraintGeometry geom1_4 = new NXOpen.Sketch.ConstraintGeometry(); geom1_4.Geometry = line4; geom1_4.PointType = NXOpen.Sketch.ConstraintPointType.StartVertex; geom1_4.SplineDefiningPointIndex = 0; NXOpen.Sketch.ConstraintGeometry geom2_4 = new NXOpen.Sketch.ConstraintGeometry(); geom2_4.Geometry = line3; geom2_4.PointType = NXOpen.Sketch.ConstraintPointType.EndVertex; geom2_4.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint7; sketchGeometricConstraint7 = theSession.ActiveSketch.CreateCoincidentConstraint(geom1_4, geom2_4); NXOpen.Sketch.ConstraintGeometry geom1_5 = new NXOpen.Sketch.ConstraintGeometry(); geom1_5.Geometry = line4; geom1_5.PointType = NXOpen.Sketch.ConstraintPointType.EndVertex; geom1_5.SplineDefiningPointIndex = 0; NXOpen.Sketch.ConstraintGeometry geom2_5 = new NXOpen.Sketch.ConstraintGeometry(); geom2_5.Geometry = line2; geom2_5.PointType = NXOpen.Sketch.ConstraintPointType.EndVertex; geom2_5.SplineDefiningPointIndex = 0; NXOpen.SketchGeometricConstraint sketchGeometricConstraint8; sketchGeometricConstraint8 = theSession.ActiveSketch.CreateCoincidentConstraint(geom1_5, geom2_5); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- // ---------------------------------------------- // Menu: File->Finish Sketch // ---------------------------------------------- NXOpen.Session.UndoMarkId markId15; markId15 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Deactivate Sketch"); theSession.ActiveSketch.Deactivate(NXOpen.Sketch.ViewReorient.False, NXOpen.Sketch.UpdateLevel.Model); // ---------------------------------------------- // Menu: Insert->Design Feature->Extrude... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId16; markId16 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start"); NXOpen.Features.Feature nullNXOpen_Features_Feature = null; if (!workPart.Preferences.Modeling.GetHistoryMode()) { throw new Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."); } NXOpen.Features.ExtrudeBuilder extrudeBuilder1; extrudeBuilder1 = workPart.Features.CreateExtrudeBuilder(nullNXOpen_Features_Feature); NXOpen.Section section1; section1 = workPart.Sections.CreateSection(0.0095, 0.01, 0.5); extrudeBuilder1.Section = section1; extrudeBuilder1.AllowSelfIntersectingSection(true); NXOpen.Unit unit2; unit2 = extrudeBuilder1.Draft.FrontDraftAngle.Units; NXOpen.Expression expression8; expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("2.00", unit2); extrudeBuilder1.DistanceTolerance = 0.01; extrudeBuilder1.BooleanOperation.Type = NXOpen.GeometricUtilities.BooleanOperation.BooleanType.Create; NXOpen.Body[] targetBodies1 = new NXOpen.Body[1]; NXOpen.Body nullNXOpen_Body = null; targetBodies1[0] = nullNXOpen_Body; extrudeBuilder1.BooleanOperation.SetTargetBodies(targetBodies1); extrudeBuilder1.Limits.StartExtend.Value.RightHandSide = "0"; extrudeBuilder1.Limits.EndExtend.Value.RightHandSide = "25"; extrudeBuilder1.Offset.StartOffset.RightHandSide = "0"; extrudeBuilder1.Offset.EndOffset.RightHandSide = "5"; extrudeBuilder1.Limits.StartExtend.Value.RightHandSide = "0"; extrudeBuilder1.Limits.EndExtend.Value.RightHandSide = thickness_string; extrudeBuilder1.Draft.FrontDraftAngle.RightHandSide = "2"; extrudeBuilder1.Draft.BackDraftAngle.RightHandSide = "2"; extrudeBuilder1.Offset.StartOffset.RightHandSide = "0"; extrudeBuilder1.Offset.EndOffset.RightHandSide = "5"; NXOpen.GeometricUtilities.SmartVolumeProfileBuilder smartVolumeProfileBuilder1; smartVolumeProfileBuilder1 = extrudeBuilder1.SmartVolumeProfile; smartVolumeProfileBuilder1.OpenProfileSmartVolumeOption = false; smartVolumeProfileBuilder1.CloseProfileRule = NXOpen.GeometricUtilities.SmartVolumeProfileBuilder.CloseProfileRuleType.Fci; theSession.SetUndoMarkName(markId16, "Extrude Dialog"); section1.DistanceTolerance = 0.01; section1.ChainingTolerance = 0.0095; section1.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves); NXOpen.Session.UndoMarkId markId17; markId17 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "section mark"); NXOpen.Session.UndoMarkId markId18; markId18 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, null); NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1]; NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)feature1; features1[0] = sketchFeature1; NXOpen.CurveFeatureRule curveFeatureRule1; curveFeatureRule1 = workPart.ScRuleFactory.CreateRuleCurveFeature(features1); section1.AllowSelfIntersection(true); NXOpen.SelectionIntentRule[] rules1 = new NXOpen.SelectionIntentRule[1]; rules1[0] = curveFeatureRule1; NXOpen.Point3d helpPoint1 = new NXOpen.Point3d(53.8762063337749, 42.0412645554082, 0.0); section1.AddToSection(rules1, line4, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint1, NXOpen.Section.Mode.Create, false); theSession.DeleteUndoMark(markId18, null); NXOpen.Direction direction1; direction1 = workPart.Directions.CreateDirection(sketch1, NXOpen.Sense.Forward, NXOpen.SmartObject.UpdateOption.WithinModeling); extrudeBuilder1.Direction = direction1; theSession.DeleteUndoMark(markId17, null); NXOpen.Session.UndoMarkId markId19; markId19 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Extrude"); theSession.DeleteUndoMark(markId19, null); NXOpen.Session.UndoMarkId markId20; markId20 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Extrude"); extrudeBuilder1.ParentFeatureInternal = false; NXOpen.Features.Feature feature2; feature2 = extrudeBuilder1.CommitFeature(); theSession.DeleteUndoMark(markId20, null); theSession.SetUndoMarkName(markId16, "Extrude"); NXOpen.Expression expression9 = extrudeBuilder1.Limits.StartExtend.Value; NXOpen.Expression expression10 = extrudeBuilder1.Limits.EndExtend.Value; extrudeBuilder1.Destroy(); workPart.Expressions.Delete(expression8); // ---------------------------------------------- // Menu: File->Save // ---------------------------------------------- NXOpen.PartSaveStatus partSaveStatus1; partSaveStatus1 = workPart.Save(NXOpen.BasePart.SaveComponents.True, NXOpen.BasePart.CloseAfterSave.False); partSaveStatus1.Dispose(); // ---------------------------------------------- // Menu: File->Export->IGES... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId21; markId21 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start"); NXOpen.IgesCreator igesCreator1; igesCreator1 = theSession.DexManager.CreateIgesCreator(); igesCreator1.ExportModelData = true; igesCreator1.ExportDrawings = true; igesCreator1.MapTabCylToBSurf = true; igesCreator1.BcurveTol = 0.0508; igesCreator1.IdenticalPointResolution = 0.001; igesCreator1.MaxThreeDMdlSpace = 10000.0; igesCreator1.ObjectTypes.Curves = true; igesCreator1.ObjectTypes.Surfaces = true; igesCreator1.ObjectTypes.Annotations = true; igesCreator1.ObjectTypes.Structures = true; igesCreator1.ObjectTypes.Solids = true; igesCreator1.OutputFile = part_name_igs; igesCreator1.SettingsFile = "C:\\Program Files\\Siemens\\NX 10.0\\iges\\igesexport.def"; igesCreator1.MaxLineThickness = 2.0; igesCreator1.SysDefmaxThreeDMdlSpace = true; igesCreator1.SysDefidenticalPointResolution = true; igesCreator1.InputFile = part_name_prt; igesCreator1.OutputFile = part_name_igs; theSession.SetUndoMarkName(markId21, "Export to IGES Options Dialog"); igesCreator1.OutputFile = part_name_igs; NXOpen.Session.UndoMarkId markId22; markId22 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Export to IGES Options"); theSession.DeleteUndoMark(markId22, null); NXOpen.Session.UndoMarkId markId23; markId23 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Export to IGES Options"); igesCreator1.FileSaveFlag = false; igesCreator1.LayerMask = "1-256"; igesCreator1.DrawingList = ""; igesCreator1.ViewList = "Top,Front,Right,Back,Bottom,Left,Isometric,Trimetric,User Defined"; NXOpen.NXObject nXObject3; nXObject3 = igesCreator1.Commit(); theSession.DeleteUndoMark(markId23, null); theSession.SetUndoMarkName(markId21, "Export to IGES Options"); igesCreator1.Destroy(); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- Console.WriteLine("Finishing NX Golden Cantilever Journal"); }
static void Main(string[] args) { nxSession = Session.GetSession(); ufSession = UFSession.GetUFSession(); PartLoadStatus partLoadStatus1; //ArrayList tcad_PartList = new ArrayList(); string fileName = args[0]; //"D:\\UG_MACRO\\TEST MODEL\\Amodels\\A1\\Pre\\A1.prt"; NXOpen.Part assemblyFilePart = nxSession.Parts.OpenDisplay(fileName, out partLoadStatus1); ASSEMBLY assemManager = new ASSEMBLY(); assemManager.InitializeTransCAD(); assemManager.loadAssemblyInfo(assemblyFilePart); int numConstraints = assemManager.nxConstraints.Length; List <CONSTRAINT> preConstraints = new List <CONSTRAINT>(); //for each constraint for (int i = 0; i < numConstraints; i++) { NXOpen.Positioning.Constraint nxConstraint = assemManager.nxConstraints[i]; Constraint.Type constraintType = nxConstraint.ConstraintType; System.Console.WriteLine(constraintType.ToString()); ConstraintReference[] nxConstraintRefGeoms = nxConstraint.GetReferences(); if (constraintType == Constraint.Type.Touch) { //validation if (nxConstraintRefGeoms.Length != 2) { System.Console.WriteLine("Touch Align Constraint should have only 2 reference geometries!"); continue; } //Coaxial /* * if (nxConstraintRefGeoms[0].GetUsesGeometryAxis() && nxConstraintRefGeoms[1].GetUsesGeometryAxis()) * { * preConstraints.Add(new CONSTRAINTCoaxial(nxConstraint, assemManager)); * } */ //Incidence?? else { preConstraints.Add(new CONSTRAINTIncidence(nxConstraint, assemManager)); } } //coaxial-edge-based-fit-Constraint in NX else if (constraintType == Constraint.Type.Fit) { preConstraints.Add(new CONSTRAINTCoaxial(nxConstraint, assemManager)); } else if (constraintType == Constraint.Type.Fix) { } else if (constraintType == Constraint.Type.Distance) { } else if (constraintType == Constraint.Type.Angle) { } } //for each constraint for (int i = 0; i < preConstraints.Count(); i++) { preConstraints[i].getNXInfo(); } //for each constraint for (int i = 0; i < preConstraints.Count(); i++) { preConstraints[i].toTransCAD(); } assemManager.UninitializeTransCAD(); }
static PartEx() { theSession = NXOpen.Session.GetSession(); workPart = theSession.Parts.Work; theUI = UI.GetUI(); }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; NXOpen.CAM.PlanarMilling planarMilling1 = (NXOpen.CAM.PlanarMilling)workPart.CAMSetup.CAMOperationCollection.FindObject("PLANAR_MILL"); theSession.CAMSession.PathDisplay.ShowToolPath(planarMilling1); theSession.CAMSession.PathDisplay.HideToolPath(planarMilling1); NXOpen.Session.UndoMarkId markId1; markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit MILLR_D16_Z5_12_37_120_S16_"); NXOpen.Session.UndoMarkId markId2; markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool1 = (NXOpen.CAM.Tool)workPart.CAMSetup.CAMGroupCollection.FindObject("MILLR_D16_Z5_12_37_120_S16_"); NXOpen.CAM.MillToolBuilder millToolBuilder1; millToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool1); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters Dialog"); millToolBuilder1.HolderLibraryReference = "69871DIN_300480_SK40A70_ER25"; NXOpen.Point3d scaleAboutPoint1 = new NXOpen.Point3d(-63.376899373644299, 102.03231317600999, 0.0); NXOpen.Point3d viewCenter1 = new NXOpen.Point3d(63.376899373645401, -102.03231317600964, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint1, viewCenter1); NXOpen.Point3d scaleAboutPoint2 = new NXOpen.Point3d(-81.468531996262811, 132.03520702842695, 0.0); NXOpen.Point3d viewCenter2 = new NXOpen.Point3d(81.468531996263877, -132.03520702842664, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint2, viewCenter2); NXOpen.Point3d scaleAboutPoint3 = new NXOpen.Point3d(-103.24029485733317, 167.85326850954266, 0.0); NXOpen.Point3d viewCenter3 = new NXOpen.Point3d(103.24029485733431, -167.85326850954237, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint3, viewCenter3); NXOpen.Point3d scaleAboutPoint4 = new NXOpen.Point3d(-151.8756038292405, 225.61867158447942, 0.0); NXOpen.Point3d viewCenter4 = new NXOpen.Point3d(151.87560382924121, -225.61867158447919, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint4, viewCenter4); NXOpen.Point3d scaleAboutPoint5 = new NXOpen.Point3d(-115.88196361537399, 180.49493726758354, 0.0); NXOpen.Point3d viewCenter5 = new NXOpen.Point3d(115.88196361537494, -180.49493726758325, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint5, viewCenter5); NXOpen.Point3d scaleAboutPoint6 = new NXOpen.Point3d(-89.334459223488324, 144.39594981406682, 0.0); NXOpen.Point3d viewCenter6 = new NXOpen.Point3d(89.334459223489233, -144.39594981406657, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint6, viewCenter6); NXOpen.Point3d scaleAboutPoint7 = new NXOpen.Point3d(-67.871714932058936, 115.51675985125351, 0.0); NXOpen.Point3d viewCenter7 = new NXOpen.Point3d(67.871714932059788, -115.51675985125327, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint7, viewCenter7); NXOpen.NXObject nXObject1; nXObject1 = millToolBuilder1.Commit(); NXOpen.Session.UndoMarkId markId3; markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId3, null); NXOpen.Session.UndoMarkId markId4; markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId4, null); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters"); millToolBuilder1.Destroy(); theSession.DeleteUndoMark(markId2, null); NXOpen.Session.UndoMarkId markId5; markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool2 = (NXOpen.CAM.Tool)nXObject1; NXOpen.CAM.MillToolBuilder millToolBuilder2; millToolBuilder2 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool2); theSession.SetUndoMarkName(markId5, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- millToolBuilder2.HolderLibraryReference = "69871DIN_300480_SK40A70_ER32"; NXOpen.NXObject nXObject2; nXObject2 = millToolBuilder2.Commit(); NXOpen.Session.UndoMarkId markId6; markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId6, null); NXOpen.Session.UndoMarkId markId7; markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId7, null); theSession.SetUndoMarkName(markId5, "Milling Tool-5 Parameters"); millToolBuilder2.Destroy(); theSession.DeleteUndoMark(markId5, null); NXOpen.Session.UndoMarkId markId8; markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool3 = (NXOpen.CAM.Tool)nXObject2; NXOpen.CAM.MillToolBuilder millToolBuilder3; millToolBuilder3 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool3); theSession.SetUndoMarkName(markId8, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- NXOpen.Point3d scaleAboutPoint8 = new NXOpen.Point3d(-5.3937786700969621, 106.07764717858296, 0.0); NXOpen.Point3d viewCenter8 = new NXOpen.Point3d(5.3937786700978423, -106.07764717858277, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint8, viewCenter8); NXOpen.Point3d scaleAboutPoint9 = new NXOpen.Point3d(-7.6411864493042421, 132.59705897322871, 0.0); NXOpen.Point3d viewCenter9 = new NXOpen.Point3d(7.6411864493050974, -132.59705897322849, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint9, viewCenter9); NXOpen.Point3d scaleAboutPoint10 = new NXOpen.Point3d(-9.5514830616303783, 164.62261982693221, 0.0); NXOpen.Point3d viewCenter10 = new NXOpen.Point3d(9.5514830616312949, -164.62261982693198, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint10, viewCenter10); NXOpen.Point3d scaleAboutPoint11 = new NXOpen.Point3d(-69.529178169224238, 209.99216436967887, 0.0); NXOpen.Point3d viewCenter11 = new NXOpen.Point3d(69.529178169225105, -209.99216436967876, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint11, viewCenter11); NXOpen.Point3d scaleAboutPoint12 = new NXOpen.Point3d(-55.623342535379315, 167.99373149574299, 0.0); NXOpen.Point3d viewCenter12 = new NXOpen.Point3d(55.623342535380232, -167.99373149574294, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint12, viewCenter12); NXOpen.Point3d scaleAboutPoint13 = new NXOpen.Point3d(-44.498674028303391, 134.3949851965944, 0.0); NXOpen.Point3d viewCenter13 = new NXOpen.Point3d(44.498674028304244, -134.3949851965944, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint13, viewCenter13); NXOpen.Session.UndoMarkId markId9; markId9 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId9, null); NXOpen.Session.UndoMarkId markId10; markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); NXOpen.NXObject nXObject3; nXObject3 = millToolBuilder3.Commit(); theSession.DeleteUndoMark(markId10, null); theSession.SetUndoMarkName(markId8, "Milling Tool-5 Parameters"); millToolBuilder3.Destroy(); theSession.DeleteUndoMark(markId8, null); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; NXOpen.CAM.PlanarMilling planarMilling1 = (NXOpen.CAM.PlanarMilling)workPart.CAMSetup.CAMOperationCollection.FindObject("PLANAR_MILL"); theSession.CAMSession.PathDisplay.ShowToolPath(planarMilling1); theSession.CAMSession.PathDisplay.HideToolPath(planarMilling1); NXOpen.Session.UndoMarkId markId1; markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit MILLR_D16_Z5_12_37_120_S16_"); NXOpen.Session.UndoMarkId markId2; markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool1 = (NXOpen.CAM.Tool)workPart.CAMSetup.CAMGroupCollection.FindObject("MILLR_D16_Z5_12_37_120_S16_"); NXOpen.CAM.MillToolBuilder millToolBuilder1; millToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool1); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- NXOpen.Session.UndoMarkId markId3; markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); millToolBuilder1.HolderSectionBuilder.TlHolderOffsetBuilder.Value = 777.0; theSession.DeleteUndoMark(markId3, null); NXOpen.Session.UndoMarkId markId4; markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); NXOpen.NXObject nXObject1; nXObject1 = millToolBuilder1.Commit(); theSession.DeleteUndoMark(markId4, null); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters"); millToolBuilder1.Destroy(); theSession.DeleteUndoMark(markId2, null); NXOpen.Session.UndoMarkId markId5; markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit MILLR_D16_Z5_12_37_120_S16_"); NXOpen.Session.UndoMarkId markId6; markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool2 = (NXOpen.CAM.Tool)nXObject1; NXOpen.CAM.MillToolBuilder millToolBuilder2; millToolBuilder2 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool2); theSession.SetUndoMarkName(markId6, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- NXOpen.Point3d scaleAboutPoint1 = new NXOpen.Point3d(-286.70516201357901, 27.560920692940968, 0.0); NXOpen.Point3d viewCenter1 = new NXOpen.Point3d(286.7051620135797, -27.560920692940627, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1); NXOpen.Point3d scaleAboutPoint2 = new NXOpen.Point3d(-229.36412961086322, 22.048736554352818, 0.0); NXOpen.Point3d viewCenter2 = new NXOpen.Point3d(229.36412961086378, -22.048736554352505, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2); NXOpen.Point3d scaleAboutPoint3 = new NXOpen.Point3d(-183.49130368869046, 17.638989243482285, 0.0); NXOpen.Point3d viewCenter3 = new NXOpen.Point3d(183.49130368869115, -17.638989243481941, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3); NXOpen.Point3d scaleAboutPoint4 = new NXOpen.Point3d(-146.7930429509523, 14.477715846598475, 0.0); NXOpen.Point3d viewCenter4 = new NXOpen.Point3d(146.79304295095295, -14.47771584659815, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint4, viewCenter4); NXOpen.Point3d scaleAboutPoint5 = new NXOpen.Point3d(-117.43443436076178, 11.582172677278839, 0.0); NXOpen.Point3d viewCenter5 = new NXOpen.Point3d(117.43443436076245, -11.582172677278479, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint5, viewCenter5); NXOpen.Point3d scaleAboutPoint6 = new NXOpen.Point3d(-93.947547488609331, 9.2657381418231157, 0.0); NXOpen.Point3d viewCenter6 = new NXOpen.Point3d(93.94754748861007, -9.265738141822764, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint6, viewCenter6); NXOpen.Point3d scaleAboutPoint7 = new NXOpen.Point3d(-75.158037990887379, 7.4125905134584906, 0.0); NXOpen.Point3d viewCenter7 = new NXOpen.Point3d(75.158037990888076, -7.4125905134581593, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint7, viewCenter7); NXOpen.Point3d scaleAboutPoint8 = new NXOpen.Point3d(-60.12643039270985, 5.9300724107668339, 0.0); NXOpen.Point3d viewCenter8 = new NXOpen.Point3d(60.126430392710503, -5.9300724107665177, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint8, viewCenter8); NXOpen.Point3d scaleAboutPoint9 = new NXOpen.Point3d(-49.061966173127487, 2.9425169430641356, 0.0); NXOpen.Point3d viewCenter9 = new NXOpen.Point3d(49.061966173128155, -2.9425169430638092, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint9, viewCenter9); NXOpen.Point3d scaleAboutPoint10 = new NXOpen.Point3d(-39.24957293850192, 2.3540135544513348, 0.0); NXOpen.Point3d viewCenter10 = new NXOpen.Point3d(39.249572938502602, -2.3540135544510212, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint10, viewCenter10); NXOpen.Point3d scaleAboutPoint11 = new NXOpen.Point3d(-31.399658350801484, 1.8832108435610995, 0.0); NXOpen.Point3d viewCenter11 = new NXOpen.Point3d(31.399658350802142, -1.883210843560791, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint11, viewCenter11); NXOpen.Point3d origin1 = new NXOpen.Point3d(164.84120942379855, -231.96225566314746, 93.442374791060715); workPart.ModelingViews.WorkView.SetOrigin(origin1); NXOpen.Point3d origin2 = new NXOpen.Point3d(164.84120942379855, -231.96225566314746, 93.442374791060715); workPart.ModelingViews.WorkView.SetOrigin(origin2); NXOpen.Matrix3x3 rotMatrix1 = new NXOpen.Matrix3x3(); rotMatrix1.Xx = -0.92455190915842644; rotMatrix1.Xy = 0.36837264888254806; rotMatrix1.Xz = -0.09749542977373428; rotMatrix1.Yx = -0.12480670128190648; rotMatrix1.Yy = -0.050994564468317953; rotMatrix1.Yz = 0.99086974003136052; rotMatrix1.Zx = 0.36003757385395102; rotMatrix1.Zy = 0.9282785928534294; rotMatrix1.Zz = 0.093122497085394787; NXOpen.Point3d translation1 = new NXOpen.Point3d(246.96300992949458, -83.844748234257665, 147.27497989586558); workPart.ModelingViews.WorkView.SetRotationTranslationScale(rotMatrix1, translation1, 4.3026858150475196); NXOpen.Point3d scaleAboutPoint12 = new NXOpen.Point3d(-27.88689363444497, 0.95313528408813641, 0.0); NXOpen.Point3d viewCenter12 = new NXOpen.Point3d(27.886893634445624, -0.9531352840878311, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint12, viewCenter12); NXOpen.Point3d scaleAboutPoint13 = new NXOpen.Point3d(-22.260320828377161, 0.81170230644928132, 0.0); NXOpen.Point3d viewCenter13 = new NXOpen.Point3d(22.260320828377843, -0.8117023064489669, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint13, viewCenter13); NXOpen.Point3d scaleAboutPoint14 = new NXOpen.Point3d(-17.729546136015692, 0.9248486885603705, 0.0); NXOpen.Point3d viewCenter14 = new NXOpen.Point3d(17.729546136016374, -0.92484868856005742, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint14, viewCenter14); NXOpen.Point3d scaleAboutPoint15 = new NXOpen.Point3d(-14.183636908812508, 1.2436263216385735, 0.0); NXOpen.Point3d viewCenter15 = new NXOpen.Point3d(14.183636908813163, -1.2436263216382608, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint15, viewCenter15); // ---------------------------------------------- // Menu: View->Operation->Fit // ---------------------------------------------- workPart.ModelingViews.WorkView.Fit(); NXOpen.Point3d scaleAboutPoint16 = new NXOpen.Point3d(15.504435415295911, 219.79817265213524, 0.0); NXOpen.Point3d viewCenter16 = new NXOpen.Point3d(-15.504435415295911, -219.79817265213524, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint16, viewCenter16); NXOpen.Point3d scaleAboutPoint17 = new NXOpen.Point3d(12.403548332236728, 175.83853812170818, 0.0); NXOpen.Point3d viewCenter17 = new NXOpen.Point3d(-12.403548332236529, -175.83853812170818, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint17, viewCenter17); NXOpen.Point3d scaleAboutPoint18 = new NXOpen.Point3d(9.9228386657894614, 140.67083049736655, 0.0); NXOpen.Point3d viewCenter18 = new NXOpen.Point3d(-9.9228386657891434, -140.67083049736655, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint18, viewCenter18); NXOpen.Point3d scaleAboutPoint19 = new NXOpen.Point3d(7.0043567052632767, 114.40449285263009, 0.0); NXOpen.Point3d viewCenter19 = new NXOpen.Point3d(-7.0043567052630227, -114.40449285263009, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint19, viewCenter19); NXOpen.Point3d scaleAboutPoint20 = new NXOpen.Point3d(2.6149598366315758, 93.764988427788197, 0.0); NXOpen.Point3d viewCenter20 = new NXOpen.Point3d(-2.6149598366314741, -93.764988427788239, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint20, viewCenter20); NXOpen.Point3d scaleAboutPoint21 = new NXOpen.Point3d(3.2686997957895967, 117.20623553473519, 0.0); NXOpen.Point3d viewCenter21 = new NXOpen.Point3d(-3.2686997957893427, -117.20623553473537, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint21, viewCenter21); NXOpen.Point3d scaleAboutPoint22 = new NXOpen.Point3d(4.0858747447369961, 146.507794418419, 0.0); NXOpen.Point3d viewCenter22 = new NXOpen.Point3d(-4.085874744736679, -146.50779441841922, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint22, viewCenter22); NXOpen.Point3d scaleAboutPoint23 = new NXOpen.Point3d(5.1073434309211461, 183.13474302302382, 0.0); NXOpen.Point3d viewCenter23 = new NXOpen.Point3d(-5.1073434309210466, -183.13474302302401, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint23, viewCenter23); NXOpen.Point3d scaleAboutPoint24 = new NXOpen.Point3d(-4.5601280633219918, 230.7424800041087, 0.0); NXOpen.Point3d viewCenter24 = new NXOpen.Point3d(4.5601280633224883, -230.74248000410896, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint24, viewCenter24); NXOpen.Point3d scaleAboutPoint25 = new NXOpen.Point3d(-5.7001600791526439, 288.42810000513583, 0.0); NXOpen.Point3d viewCenter25 = new NXOpen.Point3d(5.7001600791529539, -288.428100005136, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint25, viewCenter25); NXOpen.Point3d scaleAboutPoint26 = new NXOpen.Point3d(-7.125200098940998, 360.53512500641995, 0.0); NXOpen.Point3d viewCenter26 = new NXOpen.Point3d(7.1252000989413853, -360.53512500641995, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint26, viewCenter26); NXOpen.Point3d scaleAboutPoint27 = new NXOpen.Point3d(-8.9065001236762491, 450.668906258025, 0.0); NXOpen.Point3d viewCenter27 = new NXOpen.Point3d(8.9065001236762491, -450.668906258025, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint27, viewCenter27); NXOpen.Point3d scaleAboutPoint28 = new NXOpen.Point3d(-69.025375958491892, 469.81788152392915, 0.0); NXOpen.Point3d viewCenter28 = new NXOpen.Point3d(69.025375958491892, -469.81788152392915, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint28, viewCenter28); NXOpen.Matrix3x3 rotMatrix2 = new NXOpen.Matrix3x3(); rotMatrix2.Xx = -0.32570673521222537; rotMatrix2.Xy = 0.93619419322519726; rotMatrix2.Xz = 0.13211947323849185; rotMatrix2.Yx = -0.46660733165419815; rotMatrix2.Yy = -0.28070137983368343; rotMatrix2.Yz = 0.83873972924025531; rotMatrix2.Zx = 0.82230938258294473; rotMatrix2.Zy = 0.21153526403625911; rotMatrix2.Zz = 0.52826140440615954; NXOpen.Point3d translation2 = new NXOpen.Point3d(160.31288587598124, 658.78312117697226, 212.07365751642178); workPart.ModelingViews.WorkView.SetRotationTranslationScale(rotMatrix2, translation2, 0.074266920131170408); NXOpen.Point3d scaleAboutPoint29 = new NXOpen.Point3d(194.16170269614508, 475.60710660431897, 0.0); NXOpen.Point3d viewCenter29 = new NXOpen.Point3d(-194.16170269614508, -475.60710660431897, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint29, viewCenter29); NXOpen.Point3d scaleAboutPoint30 = new NXOpen.Point3d(242.70212837018136, 594.5088832553987, 0.0); NXOpen.Point3d viewCenter30 = new NXOpen.Point3d(-242.70212837018136, -594.5088832553987, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint30, viewCenter30); NXOpen.Point3d scaleAboutPoint31 = new NXOpen.Point3d(303.37766046272668, 743.13610406924829, 0.0); NXOpen.Point3d viewCenter31 = new NXOpen.Point3d(-303.37766046272668, -743.13610406924829, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint31, viewCenter31); NXOpen.Point3d scaleAboutPoint32 = new NXOpen.Point3d(379.22207557840835, 901.08731720007154, 0.0); NXOpen.Point3d viewCenter32 = new NXOpen.Point3d(-379.22207557840835, -901.08731720007154, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint32, viewCenter32); NXOpen.Point3d scaleAboutPoint33 = new NXOpen.Point3d(465.32984044598311, -152.21069547298509, 0.0); NXOpen.Point3d viewCenter33 = new NXOpen.Point3d(-465.32984044598311, 152.21069547298509, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint33, viewCenter33); NXOpen.Point3d scaleAboutPoint34 = new NXOpen.Point3d(570.79010802369487, -201.13556187501464, 0.0); NXOpen.Point3d viewCenter34 = new NXOpen.Point3d(-570.79010802369487, 201.13556187501686, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint34, viewCenter34); NXOpen.Point3d scaleAboutPoint35 = new NXOpen.Point3d(482.45354368669388, 699.89739436238756, 0.0); NXOpen.Point3d viewCenter35 = new NXOpen.Point3d(-482.45354368669388, -699.89739436238574, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint35, viewCenter35); NXOpen.Point3d scaleAboutPoint36 = new NXOpen.Point3d(385.96283494935358, 559.91791548991068, 0.0); NXOpen.Point3d viewCenter36 = new NXOpen.Point3d(-385.96283494935653, -559.91791548990852, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint36, viewCenter36); NXOpen.Point3d scaleAboutPoint37 = new NXOpen.Point3d(317.46802198651068, 465.32984044598362, 0.0); NXOpen.Point3d viewCenter37 = new NXOpen.Point3d(-317.46802198651307, -465.32984044598186, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint37, viewCenter37); NXOpen.Point3d scaleAboutPoint38 = new NXOpen.Point3d(253.97441758920854, 407.05488846489862, 0.0); NXOpen.Point3d viewCenter38 = new NXOpen.Point3d(-253.97441758921042, -407.05488846489578, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint38, viewCenter38); NXOpen.Point3d scaleAboutPoint39 = new NXOpen.Point3d(203.17953407136687, 381.30953654489662, 0.0); NXOpen.Point3d viewCenter39 = new NXOpen.Point3d(-203.17953407136915, -381.309536544894, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint39, viewCenter39); millToolBuilder2.HolderSectionBuilder.TlHolderOffsetBuilder.Value = 5.0; NXOpen.Point3d scaleAboutPoint40 = new NXOpen.Point3d(-362.93988003981349, 723.6531350487071, 0.0); NXOpen.Point3d viewCenter40 = new NXOpen.Point3d(362.93988003981076, -723.65313504870437, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint40, viewCenter40); NXOpen.Point3d scaleAboutPoint41 = new NXOpen.Point3d(-347.35350482338032, 610.98590848420099, 0.0); NXOpen.Point3d viewCenter41 = new NXOpen.Point3d(347.35350482337736, -610.98590848419792, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint41, viewCenter41); NXOpen.Point3d scaleAboutPoint42 = new NXOpen.Point3d(-277.88280385870468, 491.63880682693821, 0.0); NXOpen.Point3d viewCenter42 = new NXOpen.Point3d(277.88280385870161, -491.63880682693451, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint42, viewCenter42); NXOpen.Point3d scaleAboutPoint43 = new NXOpen.Point3d(-222.30624308696406, 393.3110454615508, 0.0); NXOpen.Point3d viewCenter43 = new NXOpen.Point3d(222.30624308696093, -393.31104546154711, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint43, viewCenter43); NXOpen.Point3d scaleAboutPoint44 = new NXOpen.Point3d(382.1387317064079, 413.1476025370028, 0.0); NXOpen.Point3d viewCenter44 = new NXOpen.Point3d(-382.13873170641091, -413.1476025369991, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint44, viewCenter44); NXOpen.Point3d scaleAboutPoint45 = new NXOpen.Point3d(466.27309447470458, 516.43450317125303, 0.0); NXOpen.Point3d viewCenter45 = new NXOpen.Point3d(-466.27309447470719, -516.43450317124928, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint45, viewCenter45); NXOpen.Point3d scaleAboutPoint46 = new NXOpen.Point3d(579.99128805380462, 645.54312896406589, 0.0); NXOpen.Point3d viewCenter46 = new NXOpen.Point3d(-579.99128805380735, -645.54312896406225, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint46, viewCenter46); NXOpen.Point3d origin3 = new NXOpen.Point3d(-456.82871085494554, 659.5905676803327, 45.534677646621525); workPart.ModelingViews.WorkView.SetOrigin(origin3); NXOpen.Point3d origin4 = new NXOpen.Point3d(-456.82871085494554, 659.5905676803327, 45.534677646621525); workPart.ModelingViews.WorkView.SetOrigin(origin4); NXOpen.Point3d scaleAboutPoint47 = new NXOpen.Point3d(379.41690526861242, 439.98110610961515, 0.0); NXOpen.Point3d viewCenter47 = new NXOpen.Point3d(-379.41690526861532, -439.98110610961106, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint47, viewCenter47); NXOpen.Point3d scaleAboutPoint48 = new NXOpen.Point3d(465.36463146208962, 549.97638263701833, 0.0); NXOpen.Point3d viewCenter48 = new NXOpen.Point3d(-465.36463146209201, -549.97638263701413, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint48, viewCenter48); NXOpen.Point3d scaleAboutPoint49 = new NXOpen.Point3d(548.30641386382592, 681.90391571897487, 0.0); NXOpen.Point3d viewCenter49 = new NXOpen.Point3d(-548.30641386382933, -681.90391571897032, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint49, viewCenter49); NXOpen.Point3d scaleAboutPoint50 = new NXOpen.Point3d(615.8009851135597, 831.50528498385142, 0.0); NXOpen.Point3d viewCenter50 = new NXOpen.Point3d(-615.80098511356357, -831.50528498384665, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint50, viewCenter50); // ---------------------------------------------- // Menu: View->Operation->Fit // ---------------------------------------------- workPart.ModelingViews.WorkView.Fit(); NXOpen.Matrix3x3 rotMatrix3 = new NXOpen.Matrix3x3(); rotMatrix3.Xx = -0.074067505804252642; rotMatrix3.Xy = 0.99277609926014787; rotMatrix3.Xz = 0.094390790449827497; rotMatrix3.Yx = -0.0020149135722141304; rotMatrix3.Yy = -0.094799559997341881; rotMatrix3.Yz = 0.99549434129361458; rotMatrix3.Zx = 0.99725119438746967; rotMatrix3.Zy = 0.073543593617096698; rotMatrix3.Zz = 0.0090219249969129348; NXOpen.Point3d translation3 = new NXOpen.Point3d(3.1589136400735374, -105.14889998754266, 33.616845100090721); workPart.ModelingViews.WorkView.SetRotationTranslationScale(rotMatrix3, translation3, 0.70100925726828234); // ---------------------------------------------- // Menu: Snap View // ---------------------------------------------- workPart.ModelingViews.WorkView.SnapToClosestCannedOrientation(); NXOpen.Point3d scaleAboutPoint51 = new NXOpen.Point3d(-16.795724466199619, 122.4766873995907, 0.0); NXOpen.Point3d viewCenter51 = new NXOpen.Point3d(16.795724466199619, -122.4766873995907, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint51, viewCenter51); NXOpen.Point3d scaleAboutPoint52 = new NXOpen.Point3d(-20.994655582749555, 152.15227922329743, 0.0); NXOpen.Point3d viewCenter52 = new NXOpen.Point3d(20.994655582749555, -152.15227922329734, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint52, viewCenter52); NXOpen.Point3d scaleAboutPoint53 = new NXOpen.Point3d(-26.243319478436941, 188.42113648001362, 0.0); NXOpen.Point3d viewCenter53 = new NXOpen.Point3d(26.243319478436941, -188.42113648001362, 0.0); workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint53, viewCenter53); NXOpen.Session.UndoMarkId markId7; markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId7, null); NXOpen.Session.UndoMarkId markId8; markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); NXOpen.NXObject nXObject2; nXObject2 = millToolBuilder2.Commit(); theSession.DeleteUndoMark(markId8, null); theSession.SetUndoMarkName(markId6, "Milling Tool-5 Parameters"); millToolBuilder2.Destroy(); theSession.DeleteUndoMark(markId6, null); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; NXOpen.Session.UndoMarkId markId1; markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Edit MILLR_D16_Z5_12_37_120_S16_"); NXOpen.Session.UndoMarkId markId2; markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool1 = (NXOpen.CAM.Tool)workPart.CAMSetup.CAMGroupCollection.FindObject("MILLR_D16_Z5_12_37_120_S16_"); NXOpen.CAM.MillToolBuilder millToolBuilder1; millToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool1); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- NXOpen.NXObject nXObject1; nXObject1 = millToolBuilder1.Commit(); millToolBuilder1.CutterExportBuilder.HolderSaveFlag = NXOpen.CAM.CutterExport.SaveFlags.CreateNew; millToolBuilder1.CutterExportBuilder.ExportHolder(); NXOpen.Session.UndoMarkId markId3; markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId3, null); NXOpen.Session.UndoMarkId markId4; markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId4, null); theSession.SetUndoMarkName(markId2, "Milling Tool-5 Parameters"); millToolBuilder1.Destroy(); theSession.DeleteUndoMark(markId2, null); NXOpen.Session.UndoMarkId markId5; markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.Tool tool2 = (NXOpen.CAM.Tool)nXObject1; NXOpen.CAM.MillToolBuilder millToolBuilder2; millToolBuilder2 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool2); theSession.SetUndoMarkName(markId5, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- NXOpen.NXObject nXObject2; nXObject2 = millToolBuilder2.Commit(); // ---------------------------------------------- // Dialog Begin Library Class Selection // ---------------------------------------------- // ---------------------------------------------- // Dialog Begin Search Criteria // ---------------------------------------------- // ---------------------------------------------- // Dialog Begin Search Result // ---------------------------------------------- NXOpen.CAM.Tool tool3 = (NXOpen.CAM.Tool)nXObject2; bool success1; success1 = tool3.RetrieveHolder("69871DIN_300480_SK40A70_ER32"); NXOpen.Session.UndoMarkId markId6; markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId6, null); NXOpen.Session.UndoMarkId markId7; markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId7, null); theSession.SetUndoMarkName(markId5, "Milling Tool-5 Parameters"); millToolBuilder2.Destroy(); theSession.DeleteUndoMark(markId5, null); NXOpen.Session.UndoMarkId markId8; markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start"); NXOpen.CAM.MillToolBuilder millToolBuilder3; millToolBuilder3 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool3); theSession.SetUndoMarkName(markId8, "Milling Tool-5 Parameters Dialog"); // ---------------------------------------------- // Dialog Begin Milling Tool-5 Parameters // ---------------------------------------------- millToolBuilder3.HolderLibraryReference = "69871DIN_300480_SK40A70_ER32_get"; NXOpen.Session.UndoMarkId markId9; markId9 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); theSession.DeleteUndoMark(markId9, null); NXOpen.Session.UndoMarkId markId10; markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Milling Tool-5 Parameters"); NXOpen.NXObject nXObject3; nXObject3 = millToolBuilder3.Commit(); theSession.DeleteUndoMark(markId10, null); theSession.SetUndoMarkName(markId8, "Milling Tool-5 Parameters"); millToolBuilder3.Destroy(); theSession.DeleteUndoMark(markId8, null); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); // ---------------------------------------------- // Menu: File->New... // ---------------------------------------------- //Variable Declaration double a = double.Parse(args[0]); double G = 1.618; double b = G * a; double L = 10; double t = double.Parse(args[1]); NXOpen.FileNew fileNew1; fileNew1 = theSession.Parts.FileNew(); fileNew1.TemplateFileName = "model-plain-1-mm-template.prt"; fileNew1.UseBlankTemplate = false; fileNew1.ApplicationName = "ModelTemplate"; fileNew1.Units = NXOpen.Part.Units.Millimeters; fileNew1.RelationType = ""; fileNew1.UsesMasterModel = "No"; fileNew1.TemplateType = NXOpen.FileNewTemplateType.Item; fileNew1.TemplatePresentationName = "Model"; fileNew1.ItemType = ""; fileNew1.Specialization = ""; fileNew1.SetCanCreateAltrep(false); fileNew1.NewFileName = "J:\\ME 578 Systems\\Midterm\\MidtermProject\\GoldBeam.prt"; fileNew1.MasterFileName = ""; fileNew1.MakeDisplayedPart = true; NXOpen.NXObject nXObject1; nXObject1 = fileNew1.Commit(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; fileNew1.Destroy(); theSession.ApplicationSwitchImmediate("UG_APP_MODELING"); // ---------------------------------------------- // Menu: Insert->Sketch... // ---------------------------------------------- NXOpen.Sketch nullNXOpen_Sketch = null; NXOpen.SketchInPlaceBuilder sketchInPlaceBuilder1; sketchInPlaceBuilder1 = workPart.Sketches.CreateNewSketchInPlaceBuilder(nullNXOpen_Sketch); NXOpen.Unit unit1 = (NXOpen.Unit)workPart.UnitCollection.FindObject("MilliMeter"); NXOpen.Expression expression1; expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1); NXOpen.Expression expression2; expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1); NXOpen.SketchAlongPathBuilder sketchAlongPathBuilder1; sketchAlongPathBuilder1 = workPart.Sketches.CreateSketchAlongPathBuilder(nullNXOpen_Sketch); sketchAlongPathBuilder1.PlaneLocation.Expression.RightHandSide = "0"; NXOpen.DatumPlane datumPlane1 = (NXOpen.DatumPlane)workPart.Datums.FindObject("DATUM_CSYS(0) YZ plane"); NXOpen.Point3d point1 = new NXOpen.Point3d(0, 0, 0); sketchInPlaceBuilder1.PlaneOrFace.SetValue(datumPlane1, workPart.ModelingViews.WorkView, point1); NXOpen.Features.DatumCsys datumCsys1 = (NXOpen.Features.DatumCsys)workPart.Features.FindObject("DATUM_CSYS(0)"); NXOpen.Point point2 = (NXOpen.Point)datumCsys1.FindObject("POINT 1"); sketchInPlaceBuilder1.SketchOrigin = point2; sketchInPlaceBuilder1.PlaneOrFace.Value = null; sketchInPlaceBuilder1.PlaneOrFace.Value = datumPlane1; NXOpen.DatumAxis datumAxis1 = (NXOpen.DatumAxis)workPart.Datums.FindObject("DATUM_CSYS(0) X axis"); sketchInPlaceBuilder1.Axis.Value = datumAxis1; theSession.Preferences.Sketch.CreateInferredConstraints = true; theSession.Preferences.Sketch.ContinuousAutoDimensioning = true; theSession.Preferences.Sketch.DimensionLabel = NXOpen.Preferences.SketchPreferences.DimensionLabelType.Expression; theSession.Preferences.Sketch.TextSizeFixed = true; theSession.Preferences.Sketch.FixedTextSize = 3.0; theSession.Preferences.Sketch.ConstraintSymbolSize = 3.0; theSession.Preferences.Sketch.DisplayObjectColor = false; theSession.Preferences.Sketch.DisplayObjectName = true; NXOpen.NXObject nXObject2; nXObject2 = sketchInPlaceBuilder1.Commit(); NXOpen.Sketch sketch1 = (NXOpen.Sketch)nXObject2; NXOpen.Features.Feature feature1; feature1 = sketch1.Feature; sketch1.Activate(NXOpen.Sketch.ViewReorient.True); sketchInPlaceBuilder1.Destroy(); sketchAlongPathBuilder1.Destroy(); try { // Expression is still in use. workPart.Expressions.Delete(expression2); } catch (NXException ex) { ex.AssertErrorCode(1050029); } try { // Expression is still in use. workPart.Expressions.Delete(expression1); } catch (NXException ex) { ex.AssertErrorCode(1050029); } // ---------------------------------------------- // Menu: Insert->Sketch Curve->Line... // ---------------------------------------------- NXOpen.Point3d startPoint1 = new NXOpen.Point3d(0.0, 0.0, 0.0); NXOpen.Point3d endPoint1 = new NXOpen.Point3d(0, b, 0.0); NXOpen.Line line1; line1 = workPart.Curves.CreateLine(startPoint1, endPoint1); theSession.ActiveSketch.AddGeometry(line1, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // NXOpen.Point3d startPoint2 = new NXOpen.Point3d(0.0, b, 0.0); NXOpen.Point3d endPoint2 = new NXOpen.Point3d(L, a, 0.0); NXOpen.Line line2; line2 = workPart.Curves.CreateLine(startPoint2, endPoint2); theSession.ActiveSketch.AddGeometry(line2, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- NXOpen.Point3d startPoint3 = new NXOpen.Point3d(L, a, 0.0); NXOpen.Point3d endPoint3 = new NXOpen.Point3d(L, 0.0, 0.0); NXOpen.Line line3; line3 = workPart.Curves.CreateLine(startPoint3, endPoint3); theSession.ActiveSketch.AddGeometry(line3, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- NXOpen.Point3d startPoint4 = new NXOpen.Point3d(L, 0.0, 0.0); NXOpen.Point3d endPoint4 = new NXOpen.Point3d(0.0, 0.0, 0.0); NXOpen.Line line4; line4 = workPart.Curves.CreateLine(startPoint4, endPoint4); theSession.ActiveSketch.AddGeometry(line4, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = false; theSession.ActiveSketch.Update(); theSession.Preferences.Sketch.AutoDimensionsToArcCenter = true; // ---------------------------------------------- // Dialog Begin Line // ---------------------------------------------- // ---------------------------------------------- // Menu: File->Finish Sketch // ---------------------------------------------- theSession.ActiveSketch.Deactivate(NXOpen.Sketch.ViewReorient.False, NXOpen.Sketch.UpdateLevel.Model); // ---------------------------------------------- // Menu: Insert->Design Feature->Extrude... // ---------------------------------------------- NXOpen.Features.Feature nullNXOpen_Features_Feature = null; if (!workPart.Preferences.Modeling.GetHistoryMode()) { throw new Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."); } NXOpen.Features.ExtrudeBuilder extrudeBuilder1; extrudeBuilder1 = workPart.Features.CreateExtrudeBuilder(nullNXOpen_Features_Feature); NXOpen.Section section1; section1 = workPart.Sections.CreateSection(0.0095, 0.01, 0.5); extrudeBuilder1.Section = section1; extrudeBuilder1.AllowSelfIntersectingSection(true); NXOpen.Unit unit2; unit2 = extrudeBuilder1.Draft.FrontDraftAngle.Units; NXOpen.Expression expression7; expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("2.00", unit2); extrudeBuilder1.DistanceTolerance = 0.01; extrudeBuilder1.BooleanOperation.Type = NXOpen.GeometricUtilities.BooleanOperation.BooleanType.Create; NXOpen.Body[] targetBodies1 = new NXOpen.Body[1]; NXOpen.Body nullNXOpen_Body = null; targetBodies1[0] = nullNXOpen_Body; extrudeBuilder1.BooleanOperation.SetTargetBodies(targetBodies1); extrudeBuilder1.Limits.StartExtend.Value.RightHandSide = "0"; extrudeBuilder1.Limits.EndExtend.Value.RightHandSide = t.ToString(); extrudeBuilder1.Offset.StartOffset.RightHandSide = "0"; extrudeBuilder1.Offset.EndOffset.RightHandSide = "5"; NXOpen.GeometricUtilities.SmartVolumeProfileBuilder smartVolumeProfileBuilder1; smartVolumeProfileBuilder1 = extrudeBuilder1.SmartVolumeProfile; smartVolumeProfileBuilder1.OpenProfileSmartVolumeOption = false; smartVolumeProfileBuilder1.CloseProfileRule = NXOpen.GeometricUtilities.SmartVolumeProfileBuilder.CloseProfileRuleType.Fci; section1.DistanceTolerance = 0.01; section1.ChainingTolerance = 0.0095; section1.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves); NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1]; NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)feature1; features1[0] = sketchFeature1; NXOpen.CurveFeatureRule curveFeatureRule1; curveFeatureRule1 = workPart.ScRuleFactory.CreateRuleCurveFeature(features1); section1.AllowSelfIntersection(true); NXOpen.SelectionIntentRule[] rules1 = new NXOpen.SelectionIntentRule[1]; rules1[0] = curveFeatureRule1; NXOpen.Point3d helpPoint1 = new NXOpen.Point3d(0.0, 0.0, 0.0); section1.AddToSection(rules1, null, null, null, helpPoint1, NXOpen.Section.Mode.Create, false); NXOpen.Direction direction1; direction1 = workPart.Directions.CreateDirection(sketch1, NXOpen.Sense.Forward, NXOpen.SmartObject.UpdateOption.WithinModeling); extrudeBuilder1.Direction = direction1; extrudeBuilder1.ParentFeatureInternal = false; NXOpen.Features.Feature feature2; feature2 = extrudeBuilder1.CommitFeature(); NXOpen.Expression expression8 = extrudeBuilder1.Limits.StartExtend.Value; NXOpen.Expression expression9 = extrudeBuilder1.Limits.EndExtend.Value; extrudeBuilder1.Destroy(); workPart.Expressions.Delete(expression7); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- // ---------------------------------------------- // Menu: File->Export->IGES... // ---------------------------------------------- NXOpen.IgesCreator igesCreator1; igesCreator1 = theSession.DexManager.CreateIgesCreator(); igesCreator1.ExportModelData = true; igesCreator1.ExportDrawings = true; igesCreator1.MapTabCylToBSurf = true; igesCreator1.BcurveTol = 0.0508; igesCreator1.IdenticalPointResolution = 0.001; igesCreator1.MaxThreeDMdlSpace = 10000.0; igesCreator1.ObjectTypes.Curves = true; igesCreator1.ObjectTypes.Surfaces = true; igesCreator1.ObjectTypes.Annotations = true; igesCreator1.ObjectTypes.Structures = true; igesCreator1.ObjectTypes.Solids = true; igesCreator1.SettingsFile = "C:\\Program Files\\Siemens\\NX 10.0\\iges\\igesexport.def"; igesCreator1.MaxLineThickness = 2.0; igesCreator1.SysDefmaxThreeDMdlSpace = true; igesCreator1.SysDefidenticalPointResolution = true; igesCreator1.InputFile = "J:\\ME 578 Systems\\Midterm\\MidtermProject\\GoldBeam.igs"; igesCreator1.OutputFile = "J:\\ME 578 Systems\\Midterm\\MidtermProject\\GoldBeam.igs"; igesCreator1.FileSaveFlag = false; igesCreator1.LayerMask = "1-256"; igesCreator1.DrawingList = ""; NXOpen.TaggedObject[] objects1 = new NXOpen.TaggedObject[0]; igesCreator1.SetDrawingArray(objects1); NXOpen.NXObject nXObject20; nXObject20 = igesCreator1.Commit(); igesCreator1.Destroy(); while (!System.IO.File.Exists("J:\\ME 578 Systems\\Midterm\\MidtermProject\\GoldBeam.igs")) { System.Threading.Thread.Sleep(10); } }
public static void Main(string[] args) { NXOpen.Session theSession = NXOpen.Session.GetSession(); NXOpen.Part workPart = theSession.Parts.Work; NXOpen.Part displayPart = theSession.Parts.Display; // ---------------------------------------------- // Menu: File->Export->IGES... // ---------------------------------------------- NXOpen.Session.UndoMarkId markId1; markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start"); NXOpen.IgesCreator igesCreator1; igesCreator1 = theSession.DexManager.CreateIgesCreator(); igesCreator1.ExportModelData = true; igesCreator1.ExportDrawings = true; igesCreator1.MapTabCylToBSurf = true; igesCreator1.BcurveTol = 0.0508; igesCreator1.IdenticalPointResolution = 0.001; igesCreator1.MaxThreeDMdlSpace = 10000.0; igesCreator1.ObjectTypes.Curves = true; igesCreator1.ObjectTypes.Surfaces = true; igesCreator1.ObjectTypes.Annotations = true; igesCreator1.ObjectTypes.Structures = true; igesCreator1.ObjectTypes.Solids = true; igesCreator1.SettingsFile = "C:\\Program Files\\Siemens\\NX 10.0\\iges\\igesexport.def"; igesCreator1.MaxLineThickness = 2.0; igesCreator1.SysDefmaxThreeDMdlSpace = true; igesCreator1.SysDefidenticalPointResolution = true; igesCreator1.InputFile = "J:\\ME 578 Systems\\Midterm\\GoldBeam.prt"; igesCreator1.OutputFile = "C:\\Users\\tyguy147\\AppData\\Local\\Temp\\GoldBeam.igs"; theSession.SetUndoMarkName(markId1, "Export to IGES Options Dialog"); igesCreator1.OutputFile = "J:\\ME 578 Systems\\Midterm\\Tests\\GoldBeam.igs"; NXOpen.Session.UndoMarkId markId2; markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Export to IGES Options"); theSession.DeleteUndoMark(markId2, null); NXOpen.Session.UndoMarkId markId3; markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Export to IGES Options"); igesCreator1.FileSaveFlag = false; igesCreator1.LayerMask = "1-256"; igesCreator1.DrawingList = ""; NXOpen.TaggedObject[] objects1 = new NXOpen.TaggedObject[0]; igesCreator1.SetDrawingArray(objects1); igesCreator1.ViewList = "Top,Front,Right,Back,Bottom,Left,Isometric,Trimetric,User Defined"; NXOpen.NXObject nXObject1; nXObject1 = igesCreator1.Commit(); theSession.DeleteUndoMark(markId3, null); theSession.SetUndoMarkName(markId1, "Export to IGES Options"); igesCreator1.Destroy(); // ---------------------------------------------- // Menu: Tools->Journal->Stop Recording // ---------------------------------------------- }