/// <summary> /// 创建外形点 /// </summary> /// <returns></returns> private Point[] CreateMinAndMaxPt() { UFSession theUFSession = UFSession.GetUFSession(); Point[] pt = new Point[2]; Point3d centerPt = new Point3d(); Point3d disPt = new Point3d(); List <Body> bodys = new List <Body>(); foreach (Body body in this.workpiece.Bodies.ToArray()) { bodys.Add(AssmbliesUtils.GetNXObjectOfOcc(this.workpieceComp.Tag, body.Tag) as Body); } // Body[] bodys = this.workpiece.Bodies.ToArray(); Matrix4 invers = this.work.WorkMatr.GetInversMatrix(); CartesianCoordinateSystem csys = BoundingBoxUtils.CreateCoordinateSystem(this.work.WorkMatr, invers);//坐标 BoundingBoxUtils.GetBoundingBoxInLocal(bodys.ToArray(), csys, this.work.WorkMatr, ref centerPt, ref disPt); this.CenterPt = centerPt; this.DisPt = disPt; Point3d minPt = new Point3d(centerPt.X - disPt.X, centerPt.Y - disPt.Y, centerPt.Z - disPt.Z); Point3d maxPt = new Point3d(centerPt.X + disPt.X, centerPt.Y + disPt.Y, centerPt.Z + disPt.Z); invers.ApplyPos(ref maxPt); invers.ApplyPos(ref minPt); // PartUtils.SetPartWork(workpieceComp); pt[0] = PointUtils.CreatePoint(minPt); theUFSession.Obj.SetLayer(pt[0].Tag, 254); pt[1] = PointUtils.CreatePoint(maxPt); theUFSession.Obj.SetLayer(pt[1].Tag, 254); // PartUtils.SetPartWork(null); return(pt); }
/// <summary> /// 保存坐标 /// </summary> /// <param name="asm"></param> /// <returns></returns> public bool SaveCsys(Part asm) { UFSession theUFSession = UFSession.GetUFSession(); try { PartUtils.SetPartDisplay(asm); List <NXOpen.Assemblies.Component> ct = AssmbliesUtils.GetPartComp(asm, this.PartTag); CsysUtils.SetWcsOfCenteAndMatr(this.Info.Matr.GetCenter(), this.Info.Matr.GetMatrix3()); PartUtils.SetPartWork(ct[0]); CartesianCoordinateSystem csys = asm.WCS.Save(); string name = "WORK" + this.Info.WorkNumber.ToString(); Tag objTag = Tag.Null; theUFSession.Obj.CycleByName(name, ref objTag); if (objTag != Tag.Null) { theUFSession.Obj.DeleteObject(objTag); } csys.Name = name; csys.Layer = 200; csys.Color = 186; PartUtils.SetPartWork(null); CsysUtils.SetWcsToAbs(); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("创建坐标错误" + ex.Message); return(false); } }
public override bool CreateNewFile(string filePath, bool open) { UFSession theUFSession = UFSession.GetUFSession(); string name = pt.Name; string ptPath = pt.FullPath; string newPath = filePath + name + "\\"; string newPtPath = newPath + pt.Name + ".prt"; if (Directory.Exists(newPath)) { Directory.Delete(newPath, true); } Directory.CreateDirectory(newPath); this.pt.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.CloseModified, null); try { File.Move(ptPath, newPtPath); if (open) { Tag partTag; UFPart.LoadStatus err; theUFSession.Part.Open(newPtPath, out partTag, out err); } return(true); } catch { Tag partTag; UFPart.LoadStatus err; theUFSession.Part.Open(ptPath, out partTag, out err); return(false); } }
/// <summary> /// 创建加工操作 /// </summary> public List <string> CreateOperation() { List <string> err = new List <string>(); Session theSession = Session.GetSession(); UFSession theUFSession = UFSession.GetUFSession(); PartUtils.SetPartDisplay(pt); theSession.ApplicationSwitchImmediate("UG_APP_MODELING"); cam.CreateOffsetInter(); theSession.ApplicationSwitchImmediate("UG_APP_MANUFACTURING"); try { CreateCamSetup(); } catch (NXException ex) { err.Add("进入加工环境错误!请检查! " + ex.Message); return(err); } try { SetWorkpiece(); } catch (NXException ex) { err.Add("自动选择加工体错误!请检查加工体! " + ex.Message); } foreach (ProgramOperationName pm in this.template.Programs) { err.AddRange(pm.CreateOperation(cam)); } // theUFSession.UiOnt.ExpandView(); return(err); }
public EleStandardSeatCreateForm(string vec) { theUFSession = UFSession.GetUFSession(); workPart = Session.GetSession().Parts.Work; model = new EleConditionModel(); this.vecName = vec.ToUpper(); }
public Program() { theSession = Session.GetSession(); theUFSession = UFSession.GetUFSession(); isDisposeCalled = false; leafList = new List <Component>(); }
public void AddProgram(int cout) { UFSession theUFSession = UFSession.GetUFSession(); Part workPart = Session.GetSession().Parts.Work; int index = 0; if (program.Count != 0) { index = program.Count; if (cout > index) { cout = cout - index; } else { cout = 0; } } for (int i = 0; i < cout; i++) { NCGroup nCGroup = workPart.CAMSetup.CAMGroupCollection.CreateProgram(parent, "mill_planar", "PROGRAM", NXOpen.CAM.NCGroupCollection.UseDefaultName.False, "O000" + (index + i + 1).ToString()); } theUFSession.UiOnt.Refresh(); }
/// <summary> /// 替换电极图纸 /// </summary> /// <param name="oldParenInfo"></param> /// <param name="newParenInfo"></param> /// <returns></returns> public List <string> AlterEleDra(ParentAssmblieInfo oldParenInfo, ParentAssmblieInfo newParenInfo) { List <string> err = new List <string>(); UFSession theUFSession = UFSession.GetUFSession(); Part workPart = Session.GetSession().Parts.Work; string oldDra = directoryPath + oldNameInfo.EleName + "_dwg.prt"; if (!File.Exists(oldDra)) { return(err); } string newDra = directoryPath + newNameInfo.EleName + "_dwg.prt"; if (File.Exists(newDra)) { err.Add(newNameInfo.EleName + " 替换失败,替换后有同名工件! "); return(err); } else { foreach (Part pt in Session.GetSession().Parts) { if (pt.Name.Equals(oldNameInfo.EleName + "_dwg", StringComparison.CurrentCultureIgnoreCase)) { pt.Close(NXOpen.BasePart.CloseWholeTree.False, NXOpen.BasePart.CloseModified.UseResponses, null); } } File.Move(oldDra, newDra); Tag partTag; UFPart.LoadStatus error_status; theUFSession.Part.Open(newDra, out partTag, out error_status); Part newPart = NXObjectManager.Get(partTag) as Part; PartUtils.SetPartDisplay(newPart); NXOpen.Assemblies.Component comp = newPart.ComponentAssembly.RootComponent.GetChildren()[0]; string workName = comp.Name.Replace(oldParenInfo.MoldInfo.MoldNumber + "-" + oldParenInfo.MoldInfo.WorkpieceNumber, newParenInfo.MoldInfo.MoldNumber + "-" + newParenInfo.MoldInfo.WorkpieceNumber); try { Basic.AssmbliesUtils.ReplaceComp(comp, this.directoryPath + workName + ".prt", workName); } catch { } if (newPart != null) { newNameInfo.SetAttribute(newPart); ParentAssmblieInfo info = ParentAssmblieInfo.GetAttribute(newPart); info.MoldInfo = newParenInfo.MoldInfo; info.UserModel = newParenInfo.UserModel; info.SetAttribute(newPart); foreach (DrawingSheet st in newPart.DrawingSheets) { Basic.DrawingUtils.UpdateViews(st); } } PartUtils.SetPartDisplay(workPart); err.Add(newNameInfo.EleName + " 图纸替换成功! "); return(err); } }
/// <summary> /// 替换模号件号 /// </summary> /// <param name="model"></param> /// <param name="info"></param> /// <returns></returns> public static Part Replace(AbstractModel model, MoldInfoModel info) { Session theSession = Session.GetSession(); UFSession theUFSession = UFSession.GetUFSession(); Part workPart = theSession.Parts.Work; Component ct = model.GetPartComp(workPart); string OldName = model.MoldInfo.MoldNumber + "-" + model.MoldInfo.WorkpieceNumber; string newName = info.MoldNumber + "-" + info.WorkpieceNumber; string newPartPath = model.WorkpiecePath.Replace(OldName, newName); if (File.Exists(newPartPath)) { File.Delete(newPartPath); } File.Move(model.WorkpiecePath, newPartPath); if (ct != null) { model.PartTag.Close(NXOpen.BasePart.CloseWholeTree.False, NXOpen.BasePart.CloseModified.UseResponses, null); if (Basic.AssmbliesUtils.ReplaceComp(ct, newPartPath, ct.Name.Replace(OldName, newName))) { return(ct.Prototype as Part); } return(null); } else { model.PartTag.Close(NXOpen.BasePart.CloseWholeTree.False, NXOpen.BasePart.CloseModified.UseResponses, null); //NXOpen.PartLoadStatus partLoadStatus1; //BasePart part = theSession.Parts.OpenBaseDisplay(newPartPath, out partLoadStatus1); Tag partTag; UFPart.LoadStatus error_status; theUFSession.Part.Open(newPartPath, out partTag, out error_status); return(NXObjectManager.Get(partTag) as Part); } }
/// <summary> /// 修改电极名 /// </summary> /// <param name="model"></param> /// <param name="newName"></param> /// <returns></returns> public static Part ReplaceElectrode(ElectrodeModel model, string newName) { Session theSession = Session.GetSession(); Part workPart = theSession.Parts.Work; Component ct = model.GetPartComp(workPart); string OldName = model.EleInfo.EleName; string newPartPath = model.WorkpiecePath.Replace(OldName, newName); File.Move(model.WorkpiecePath, newPartPath); if (ct != null) { model.PartTag.Close(NXOpen.BasePart.CloseWholeTree.False, NXOpen.BasePart.CloseModified.UseResponses, null); if (Basic.AssmbliesUtils.ReplaceComp(ct, newPartPath, ct.Name.Replace(OldName, newName))) { Part elePart = ct.Prototype as Part; string dwgPath = model.WorkpieceDirectoryPath + model.AssembleName + "_dwg.prt"; AttributeUtils.AttributeOperation("EleName", newName, elePart); AttributeUtils.AttributeOperation("EleNumber", GetEleNumber(newName), elePart); if (File.Exists(dwgPath)) { UFSession theUFSession = UFSession.GetUFSession(); Tag partTag; UFPart.LoadStatus error_status; File.Move(dwgPath, dwgPath.Replace(OldName, newName)); theUFSession.Part.Open(dwgPath.Replace(OldName, newName), out partTag, out error_status); AttributeUtils.AttributeOperation("EleName", newName, NXObjectManager.Get(partTag) as Part); } return(elePart); } return(null); } return(null); }
private void button1_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: Screw s = screwSizes[screwDiams.SelectedIndex]; s.Length = screwLen[screwLength.SelectedIndex]; s.Draw(UFSession.GetUFSession(), path + "screw" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("screw")).ToList().Count); break; case 1: PushScrew ps = pScrewSizes[pScrewDiams.SelectedIndex]; ps.Length = pScrewLen[pScrewLength.SelectedIndex]; ps.Draw(UFSession.GetUFSession(), path + "p_screw" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("p_screw")).ToList().Count); break; case 2: Nut n = nutSizes[nutDiams.SelectedIndex]; n.Draw(UFSession.GetUFSession(), path + "nut" + System.IO.Directory.EnumerateFiles(path).Where(f => f.Contains("nut")).ToList().Count); break; default: break; } }
/// <summary> /// 设置表格注释 /// </summary> /// <param name="tablePath"></param> /// <param name="origin"></param> private void SetTable(string tablePath, double[] origin) { Tag rowTag = Tag.Null; Tag oldrowTag = Tag.Null; Tag[] columnsTags = new Tag[5]; Tag[] cellTag = new Tag[5]; Tag[] oldcellTag = new Tag[5]; UFSession theUFSession = UFSession.GetUFSession(); Point3d min = GetMinSetValue(); Tag tableTag = Basic.DrawingUtils.CreateTable(tablePath, origin, 1); theUFSession.Tabnot.AskNthRow(tableTag, 0, out oldrowTag); theUFSession.Tabnot.AskNthRow(tableTag, 1, out rowTag); for (int i = 0; i < 5; i++) { UFTabnot.CellPrefs cellPrefs = new UFTabnot.CellPrefs(); theUFSession.Tabnot.AskNthColumn(tableTag, i, out columnsTags[i]); theUFSession.Tabnot.AskCellAtRowCol(oldrowTag, columnsTags[i], out oldcellTag[i]); theUFSession.Tabnot.AskCellPrefs(oldcellTag[i], out cellPrefs); theUFSession.Tabnot.AskCellAtRowCol(rowTag, columnsTags[i], out cellTag[i]); theUFSession.Tabnot.SetCellPrefs(cellTag[i], ref cellPrefs); } theUFSession.Tabnot.SetCellText(cellTag[0], (1).ToString()); theUFSession.Tabnot.SetCellText(cellTag[1], drawModel.WorkpiecePart.Name); theUFSession.Tabnot.SetCellText(cellTag[2], Math.Round(-min.X, 3).ToString()); theUFSession.Tabnot.SetCellText(cellTag[3], Math.Round(-min.Y, 3).ToString()); theUFSession.Tabnot.SetCellText(cellTag[4], Math.Round(-min.Z, 3).ToString()); }
/// <summary> /// Initialize the SiemensNX session data /// </summary> private void Initialize() { this.TheSession = Session.GetSession(); this.TheUFSession = UFSession.GetUFSession(); this.TheWorkpart = Session.GetSession().Parts.Work; this.TheUI = UI.GetUI(); }
public MoveObjectBasic(List <NXObject> objs) { this.selectObj = objs; this.workPart = Session.GetSession().Parts.Work; this.theUFSession = UFSession.GetUFSession(); GetBoundingBox(); }
//------------------------------------------------------------------------------ //Constructor for NX Styler class //------------------------------------------------------------------------------ public PointManager() { try { theSession = Session.GetSession(); theUI = UI.GetUI(); theUFSession = UFSession.GetUFSession(); //theSession.ListingWindow.Open(); //theSession.ListingWindow.WriteLine(AppDomain.CurrentDomain.BaseDirectory); theDlxFileName = AppDomain.CurrentDomain.BaseDirectory + @"\PointManager.dlx"; theDialog = theUI.CreateDialog(theDlxFileName); theDialog.AddApplyHandler(new NXOpen.BlockStyler.BlockDialog.Apply(apply_cb)); theDialog.AddOkHandler(new NXOpen.BlockStyler.BlockDialog.Ok(ok_cb)); theDialog.AddUpdateHandler(new NXOpen.BlockStyler.BlockDialog.Update(update_cb)); theDialog.AddInitializeHandler(new NXOpen.BlockStyler.BlockDialog.Initialize(initialize_cb)); theDialog.AddDialogShownHandler(new NXOpen.BlockStyler.BlockDialog.DialogShown(dialogShown_cb)); } catch (Exception ex) { //---- Enter your exception handling code here ----- throw ex; } }
public Arc ArcCreation(Part workPart, Line line1, Line line2) { Tag[] tagg = new Tag[2]; tagg[0] = line1.Tag; tagg[1] = line2.Tag; double[] center = new Double[3] { 0, 0, 0 }; int[] trims = new int[3]; trims[0] = 0; trims[1] = 0; trims[2] = 0; int[] alm = new int[2] { 0, 0 }; Tag fillet; UFSession theUfSession = UFSession.GetUFSession(); theUfSession.Curve.CreateFillet(0, tagg, center, 3, trims, alm, out fillet); NXOpen.TaggedObject taggedObject = NXOpen.Utilities.NXObjectManager.Get(fillet); Arc arc = (Arc)taggedObject; return(arc); }
public AnalyzeFaceSlopeAndRadius(Face face) { theSession = Session.GetSession(); theUFSession = UFSession.GetUFSession(); this.workPart = theSession.Parts.Work; this.face = face; }
static FeatureCollectionEx() { theSession = Session.GetSession(); theUfSession = UFSession.GetUFSession(); _workPart = theSession.Parts.Work; theUfSession.UF.IsUgmanagerActive(out TCIntegrated); }
// Entry point in case of execution of the .dll by NX public static void Main(string[] args) { theSession = Session.GetSession(); UfSession = UFSession.GetUFSession(); lw = theSession.ListingWindow; workPart = theSession.Parts.Work; //HelloWorld(lw); //var pts = GetAllPoints(workPart); //var pts = AskPoints(); var pts = AskPointsBlockStyler(); if (pts.Length > 0) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "CSV-File (*.csv) | *.csv"; saveFileDialog.Title = "Export CSV"; var response = saveFileDialog.ShowDialog(); if (response == DialogResult.OK && !String.IsNullOrWhiteSpace(saveFileDialog.FileName)) { WriteCSV(pts, saveFileDialog.FileName); } } }
/// <summary> /// 过切检查 /// </summary> /// <returns></returns> public List <string> Gouged() { List <string> err = new List <string>(); UFSession theUFSession = UFSession.GetUFSession(); foreach (OperationData od in this.OperData) { if (od.Oper.GougeCheckStatus) { continue; } bool result = false; try { theUFSession.Oper.IsPathGouged(od.Oper.Tag, out result); // result = true; } catch { } if (result) { err.Add(od.OperName + " 过切!"); } } return(err); }
//-------------------------------------------------------------------------- // 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 void Main(string[] args) { string tmp_text = null; theSession = Session.GetSession(); theUfSession = UFSession.GetUFSession(); /* Open Listing Window */ theUfSession.Ui.OpenListingWindow(); theUfSession.Ui.WriteListingWindow("Log Entry : \r\n"); theUfSession.Ui.WriteListingWindow("--Log entry goes here--\n"); try { EX_Modl_FeatureType curveTest1 = new EX_Modl_FeatureType(); if (curveTest1.Execute() == 0) { theUfSession.Ui.WriteListingWindow("Successful\n"); } else { theUfSession.Ui.WriteListingWindow("Failed\n"); } } catch (NXException e) { tmp_text = "Exception is: " + e.Message + "\n"; theUfSession.Ui.WriteListingWindow(tmp_text); } theUfSession.Ui.WriteListingWindow("End of Log File\n"); //theUfSession.Ui.CloseListingWindow(); }
/// <summary> /// 设置连接体 /// </summary> public void WaveBodys() { Part workPart = Session.GetSession().Parts.Work; UFSession theUFSession = UFSession.GetUFSession(); if (workPart.Tag != this.PartTag.Tag) { NXOpen.Assemblies.Component ct = AssmbliesUtils.GetPartComp(workPart, this.PartTag); PartUtils.SetPartWork(ct); } foreach (Part part in Session.GetSession().Parts) { string type = AttributeUtils.GetAttrForString(part, "PartType"); if (type.Equals("Workpiece")) { Body[] bodys = part.Bodies.ToArray(); NXOpen.Features.Feature feat = AssmbliesUtils.WaveAssociativeBodys(bodys); Body[] waveBodys = ((NXOpen.Features.BodyFeature)feat).GetBodies(); foreach (Body body in waveBodys) { body.Layer = 2; theUFSession.Layer.SetStatus(2, 2); } break; } } PartUtils.SetPartWork(null); }
/// <summary> /// 创建程序组 /// </summary> /// <param name="program"></param> /// <returns></returns> public NCGroup CreateProgram(string program) { Part workPart = theSession.Parts.Work; NCGroup pm = workPart.CAMSetup.GetRoot(CAMSetup.View.ProgramOrder); NCGroup parent = null; foreach (NCGroup ng in pm.GetMembers()) { if (ng.Name.Equals("AAA")) { parent = ng; } } if (parent == null) { throw new Exception("无法找到AAA程序组!"); } try { UFSession theUFSession = UFSession.GetUFSession(); NCGroup nCGroup = workPart.CAMSetup.CAMGroupCollection.CreateProgram(parent, "mill_planar", "PROGRAM", NXOpen.CAM.NCGroupCollection.UseDefaultName.False, program); theUFSession.UiOnt.Refresh(); return(nCGroup); } catch (NXException ex) { throw ex; } }
/// <summary> /// 创建外形点 /// </summary> /// <param name="centerPt"></param> /// <param name="disPt"></param> /// <returns></returns> public List <NXObject> CreatePoint() { UFSession theUFSession = UFSession.GetUFSession(); if (UMathUtils.IsEqual(this.DisPt.X, 0) && UMathUtils.IsEqual(this.DisPt.Y, 0) && UMathUtils.IsEqual(this.DisPt.Z, 0)) { return(null); } double[] x = { CenterPt.X - DisPt.X, CenterPt.X, CenterPt.X + DisPt.X }; double[] y = { CenterPt.Y - DisPt.Y, CenterPt.Y, CenterPt.Y + DisPt.Y }; double[] z = { CenterPt.Z - DisPt.Z, CenterPt.Z, CenterPt.Z + DisPt.Z }; Matrix4 mat = new Matrix4(); List <NXObject> points = new List <NXObject>(); mat.Identity(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { Point3d temp = new Point3d(x[i], y[j], z[k]); mat.ApplyPos(ref temp); Tag pointTag = Tag.Null; theUFSession.Curve.CreatePoint(new double[] { temp.X, temp.Y, temp.Z }, out pointTag); theUFSession.Obj.SetColor(pointTag, 186); points.Add(NXObjectManager.Get(pointTag) as NXObject); } } } return(points); }
/// <summary> /// 面上任意一点做射线 /// </summary> /// <param name="face"></param> /// <param name="vec"></param> /// <returns></returns> public static int AskTraceARayForFaceData(Face face, Vector3d vec) { UFSession theUFSession = UFSession.GetUFSession(); Tag[] bodyTag = { face.GetBody().Tag }; UFModl.RayHitPointInfo[] info; Point3d originPt = GetFacePoint(face); double[] origin = { originPt.X, originPt.Y, originPt.Z }; double[] dir = { vec.X, vec.Y, vec.Z }; double[] mat = new double[16]; theUFSession.Mtx4.Identity(mat); int res = 0; int count = 0; theUFSession.Modl.TraceARay(1, bodyTag, origin, dir, mat, 0, out res, out info); foreach (UFModl.RayHitPointInfo ray in info) { Point3d temp = new Point3d(ray.hit_point[0], ray.hit_point[1], ray.hit_point[2]); double dis = UMathUtils.GetDis(originPt, temp); if (ray.hit_face != face.Tag && !UMathUtils.IsEqual(dis, 0)) { int statusPt = 0; theUFSession.Modl.AskPointContainment(ray.hit_point, face.Tag, out statusPt); if (statusPt != 3) { count++; } } } return(count); }
/// <summary> /// 创建倒角 /// </summary> /// <param name="body"></param> /// <returns></returns> private Tag CreateChamfer(Tag body) { UFSession theUFSession = UFSession.GetUFSession(); Tag[] edgesTag; Tag chamferTag = Tag.Null; double[] point1 = new double[3]; double[] point2 = new double[3]; int connt = 0; theUFSession.Modl.AskBodyEdges(body, out edgesTag); for (int i = 0; i < edgesTag.Length; i++) { theUFSession.Modl.AskEdgeVerts(edgesTag[i], point1, point2, out connt); if (point1[0] == point2[0] && point1[1] == point2[1] && point1[0] > 0 && point1[1] > 0) { Tag[] obj = new Tag[1]; obj[0] = edgesTag[i]; theUFSession.Modl.CreateChamfer(1, "1.0", "1.0", "45.0", obj, out chamferTag); break; } } return(chamferTag); }
/// <summary> /// 求曲率相同曲面u,v方向的法向(如圆锥,R面,球面) /// </summary> /// <param name="face"></param> /// <returns></returns> public static Vector3d[] AskFaceNormals(Face face) { UFSession theUFSession = UFSession.GetUFSession(); Vector3d[] vec = new Vector3d[5]; Tag faceTag = face.Tag; //输入面特征 double[] uvs = new double[4]; theUFSession.Modl.AskFaceUvMinmax(faceTag, uvs); //获得面u,v参数空间(u,v最小,最大值) double[,] param = new double[5, 2] { { uvs[0], uvs[2], }, { uvs[0], uvs[3], }, { uvs[1], uvs[2], }, { uvs[1], uvs[3], }, { (uvs[0] + uvs[1]) / 2, (uvs[2] + uvs[3]) / 2, } }; //输入U,V方向值 for (int i = 0; i < 5; i++) { double[] temp = new double[] { param[i, 0], param[i, 1] }; double[] point = new double[3]; //输出点坐标 double[] u1 = new double[3]; //输出 输出一阶导数在U位置 double[] v1 = new double[3]; //输出 输出一阶导数在V位置 double[] u2 = new double[3]; //输出 输出二阶导数在U位置 double[] v2 = new double[3]; //输出 输出二阶导数在V位置 double[] unit_norm = new double[3]; //输出面上该点的矢量方向 double[] radii = new double[2]; //输出,双半径,输出主曲率半径 theUFSession.Modl.AskFaceProps(face.Tag, temp, point, u1, v1, u2, v2, unit_norm, radii); vec[i] = new Vector3d(unit_norm[0], unit_norm[1], unit_norm[2]); } return(vec); }
public static int Subtype(this NXOpen.Tag tag) { int type; int subtype; UFSession.GetUFSession().Obj.AskTypeAndSubtype(tag, out type, out subtype); return(subtype); }
/// <summary> /// /// </summary> /// <param name="length">备料长度</param> /// <param name="wigth">备料宽度</param> /// <param name="z">z向高度</param> public ElectrodeSketchBuilder(double length, double wigth, double z) { workPart = Session.GetSession().Parts.Work; theUFSession = UFSession.GetUFSession(); this.preparationLength = length; this.preparationWigth = wigth; this.zSetValue = z; }