public bool CreatePart(string directoryPath, string partPath) { this.WorkpieceDirectoryPath = directoryPath; this.WorkpiecePath = directoryPath + AssembleName + ".prt"; if (Info != null) { try { if (File.Exists(this.WorkpiecePath)) { File.Delete(this.WorkpiecePath); } foreach (Part pt in Session.GetSession().Parts) { if (pt.FullPath.Equals(partPath, StringComparison.CurrentCultureIgnoreCase)) { pt.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.UseResponses, null); break; } } File.Move(partPath, this.WorkpiecePath); this.PartTag = PartUtils.OpenPartFile(this.WorkpiecePath); return(SetAttribute(this.PartTag)); } catch (Exception ex) { ClassItem.WriteLogFile("移动工件错误" + ex.Message); } } return(false); }
/// <summary> /// 移动 /// </summary> /// <param name="vec"></param> /// <returns></returns> public bool MovePositionBuilder(Vector3d vec) { try { Matrix4 inv = this.work.Info.Matr.GetInversMatrix(); CartesianCoordinateSystem csys = BoundingBoxUtils.CreateCoordinateSystem(this.work.Info.Matr, inv); ElectrodeSetValueInfo setValue = ElectrodeSetValueInfo.GetAttribute(eleComp); ElectrodeSetValueInfo newSetValue = setValue.Clone() as ElectrodeSetValueInfo; AssmbliesUtils.MoveCompPart(eleComp, vec, work.Info.Matr); NXObject instance = AssmbliesUtils.GetOccOfInstance(eleComp.Tag); BodyInfo info = GetDischargeFace(csys, eleComp); newSetValue.EleSetValue[0] = setValue.EleSetValue[0] + vec.X; newSetValue.EleSetValue[1] = setValue.EleSetValue[1] + vec.Y; newSetValue.EleSetValue[2] = setValue.EleSetValue[2] + vec.Z; newSetValue.Positioning = GetPositionName(); newSetValue.PositioningRemark = "设定值改变"; if (info != null) { newSetValue.ContactArea = info.ContactArea; newSetValue.ProjectedArea = info.GetProjectedArea(csys, this.work.Info.Matr); } newSetValue.SetAttribute(instance); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("电极跑位错误!" + ex.Message); return(false); } }
/// <summary> /// 给齿上颜色 /// </summary> private void SetHeadColour() { Matrix4 matr = new Matrix4(); matr.Identity(); Matrix4 inv = matr.GetInversMatrix(); CartesianCoordinateSystem csys = BoundingBoxUtils.CreateCoordinateSystem(matr, inv); List <Body> bodys = Session.GetSession().Parts.Work.Bodies.ToArray().ToList(); var toolhList = bodys.GroupBy(a => AttributeUtils.GetAttrForString(a, "ToolhName")); List <ElectrodeToolhInfo[, ]> toolhInfos = new List <ElectrodeToolhInfo[, ]>(); try { foreach (var toolh in toolhList) { ElectrodeToolhInfo[,] toolhInfo = pitch.GetToolhInfosForAttribute(toolh.ToList(), matr, csys); toolhInfos.Add(toolhInfo); } if (toolhInfos.Count != 0) { gapValue.SetERToolh(toolhInfos); } } catch (Exception ex) { ClassItem.WriteLogFile("设置颜色错误!" + ex.Message); } }
public List <NXOpen.Features.TrimBody2> CreateBuilder() { List <NXOpen.Features.TrimBody2> trims = new List <NXOpen.Features.TrimBody2>(); foreach (Face face in faces) { bool isok; NXOpen.Features.TrimBody2 trim = null; try { trim = TrimBodyUtils.CreateTrimBodyFeature(face, true, out isok, body); } catch (NXException ex) { ClassItem.WriteLogFile(ex.Message); continue; } if (trim != null) { trims.Add(trim); Body temp = trim.GetBodies()[0]; if (isok) { body = temp; } } } return(trims); }
/// <summary> /// 电极竖直标注 /// </summary> /// <param name="topView"></param> /// <param name="originPt"></param> /// <param name="scale"></param> private void EleProViewDimension(DraftingView topView, double scale, Point3d originPt) { string err = ""; int[] pre = model.Info.AllInfo.Preparetion.Preparation; List <Edge> xEdge = new List <Edge>(); Point centerPt; model.GetEdge(out xEdge, out centerPt); // Point3d originPt = topView.GetDrawingReferencePoint(); Point3d dimPt = new Point3d(originPt.X - (pre[1] * scale / 2 + 10), originPt.Y, 0); if (xEdge.Count == 0 || centerPt == null) { return; } try { NXOpen.Annotations.Dimension dim = Basic.DrawingUtils.DimensionVertical(topView, dimPt, xEdge[0], centerPt, ref err); if (dim != null) { Basic.DrawingUtils.SetDimensionPrecision(dim, 3); } } catch (NXException ex) { ClassItem.WriteLogFile(model.AssembleName + "电极视图竖直标注错误!" + ex.Message); } }
/// <summary> /// 创建视图 /// </summary> /// <param name="scale"></param> /// <param name="originPt"></param> /// <param name="tablePath"></param> public void CreateView(double scale, Point3d originPt, string tablePath) { Point3d projectedPt = new Point3d(); projectedPt.X = originPt.X; projectedPt.Y = originPt.Y - this.drawModel.DisPt.Y * scale - this.drawModel.DisPt.Z * scale - 30; double[] tableOrigin = new double[3] { originPt.X - 35, projectedPt.Y - this.drawModel.DisPt.Z * scale - 15, 0 }; List <NXOpen.Assemblies.Component> allComp = new List <NXOpen.Assemblies.Component>(); allComp.AddRange(workDra.HostComp); allComp.AddRange(workDra.OtherComp); List <NXOpen.Assemblies.Component> hiddenComd = this.drawModel.GetHiddenObjects(allComp); hiddenComd.AddRange(workDra.GetEleComp()); try { DraftingView topView = Basic.DrawingUtils.CreateView("top", originPt, scale, this.workModel.Info.Matr, hiddenComd.ToArray()); DraftingView proView = Basic.DrawingUtils.CreateProjectedView(topView, projectedPt, scale); SetViewVisibleLayer(topView); SetViewVisibleLayer(proView); TopDimension(topView, originPt, scale); ProjectedDimension(proView, projectedPt, scale); } catch (NXException ex) { ClassItem.WriteLogFile(this.drawModel.WorkpiecePart.Name + "创建视图! " + ex.Message); } SetTable(tablePath, tableOrigin); }
/// <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); } }
/// <summary> /// 主工件图 /// </summary> /// <param name="workpiecePart"></param> private void HostWorkpieceDrawing(double scale) { Part workPart = Session.GetSession().Parts.Work; DrawingSheet[] st = workPart.DrawingSheets.ToArray(); if (st.Length > 0) { DeleteObject.Delete(st); } this.originPoint = PointUtils.CreatePointFeature(this.work.Info.Matr.GetCenter()); WorkpieceDrawing dra = new WorkpieceDrawing(hostDraw, work, workDra, this.originPoint); try { NXOpen.Drawings.DrawingSheet sheet = Basic.DrawingUtils.DrawingSheet(workpieceDrawTemplate, 297, 420, workDra.HostComp[0].Name); dra.CreateView(scale, GetFirstPoint(hostDraw, scale), this.workpieceTablePath); double[] plistOrigin = { 180, 120, 0 }; Basic.DrawingUtils.CreatePlist(plistPath, plistOrigin); Basic.DrawingUtils.UpdateViews(sheet); } catch (NXException ex) { ClassItem.WriteLogFile(hostDraw.WorkpiecePart.Name + "创建图纸错误! " + ex.Message); return; } }
/// <summary> /// 创建part档 /// </summary> /// <param name="directoryPath">文件夹地址加\\</param> /// <returns></returns> public override bool CreatePart(string directoryPath) { this.WorkpieceDirectoryPath = directoryPath; this.WorkpiecePath = directoryPath + AssembleName + ".prt"; if (Info != null) { try { if (File.Exists(this.WorkpiecePath)) { File.Delete(this.WorkpiecePath); } if (PartTag != null) { string oldPath = this.PartTag.FullPath; PartTag.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.UseResponses, null); File.Move(oldPath, this.WorkpiecePath); this.PartTag = PartUtils.OpenPartFile(this.WorkpiecePath); return(SetAttribute(this.PartTag)); } } catch (Exception ex) { ClassItem.WriteLogFile("移动工件错误" + ex.Message); } } return(false); }
public override bool CreateExp(bool zDatum, int[] pre = null) { bool isok = base.CreateDefault(); try { ExpressionUtils.CreateExp("xNCopies=PitchYNum", "Number"); ExpressionUtils.CreateExp("xPitchDistance=Pitchx", "Number"); if (zDatum) { ExpressionUtils.CreateExp("moveX=-(xNCopies-2)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxX=-(xNCopies)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxY=0", "Number"); ExpressionUtils.CreateExp("moveBoxZ=0", "Number"); } else { ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number"); } return(isok); } catch (NXException ex) { ClassItem.WriteLogFile("创建表达式错误!" + ex.Message); return(false); } }
/// <summary> /// 创建表达式 /// </summary> /// <param name="zDatum"></param> /// <param name="pre"></param> /// <returns></returns> public bool CreateExp(bool zDatum, int[] pre) { try { ExpressionUtils.SetAttrExp("PitchX", "PitchX", NXObject.AttributeType.Real); ExpressionUtils.SetAttrExp("PitchXNum", "PitchXNum", NXObject.AttributeType.Integer); ExpressionUtils.SetAttrExp("PitchY", "PitchY", NXObject.AttributeType.Real); ExpressionUtils.SetAttrExp("PitchYNum", "PitchYNum", NXObject.AttributeType.Integer); ExpressionUtils.SetAttrExp("PreparationX", "Preparation", NXObject.AttributeType.Integer, 0); ExpressionUtils.SetAttrExp("PreparationY", "Preparation", NXObject.AttributeType.Integer, 1); ExpressionUtils.SetAttrExp("PreparationZ", "Preparation", NXObject.AttributeType.Integer, 2); ExpressionUtils.SetAttrExp("DatumWidth", "DatumWidth", NXObject.AttributeType.Real); ExpressionUtils.SetAttrExp("DatumHeigth", "DatumHeigth", NXObject.AttributeType.Real); ExpressionUtils.SetAttrExp("EleHeight", "EleHeight", NXObject.AttributeType.Real); ExpressionUtils.CreateExp("moveZ=0", "Number"); ExpressionUtils.CreateExp("xNCopies=PitchXNum", "Number"); ExpressionUtils.CreateExp("yNCopies=PitchYNum", "Number"); ExpressionUtils.CreateExp("xPitchDistance=PitchX", "Number"); ExpressionUtils.CreateExp("yPitchDistance=-PitchY", "Number"); ExpressionUtils.CreateExp("extrudePreparation=ceiling(PreparationZ-EleHeight-2)", "Number"); if (zDatum) { ExpressionUtils.CreateExp("moveBoxZ=0", "Number"); if (pre[0] >= pre[1]) { ExpressionUtils.CreateExp("moveY=-(yNCopies-1)*yPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveX=-(xNCopies-2)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxX=-(xNCopies)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxY=0", "Number"); } else { ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveY=-(yNCopies-2)*yPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxY=-(yNCopies)*yPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveBoxX=0", "Number"); } } else { ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number"); ExpressionUtils.CreateExp("moveY=-(yNCopies-1)*yPitchDistance/2", "Number"); } return(true); } catch (NXException ex) { ClassItem.WriteLogFile("创建表达式错误!" + ex.Message); return(false); } }
/// <summary> /// 创建电极视图 /// </summary> public void CreateEleView() { double eleScale = model.GetEleScale(90, 150.0); int[] pre = model.Info.AllInfo.Preparetion.Preparation; Point3d eleOrigin = GetEleOrigin(eleScale); Point3d projectedElePt1 = new Point3d(eleOrigin.X, eleOrigin.Y + (pre[1] * eleScale / 2 + pre[2] * eleScale / 2 + 30), 0); Point3d projectedElePt2 = new Point3d(projectedElePt1.X - (pre[0] * eleScale / 2 + pre[1] * eleScale / 2 + 30), projectedElePt1.Y, 0); Point3d projectedElePt3 = new Point3d(projectedElePt2.X - pre[1] - 10, projectedElePt2.Y, 0); DraftingView topEleView = null; try { topEleView = Basic.DrawingUtils.CreateView("TOP", eleOrigin, eleScale, model.GetEleMatr(), eleHidden.ToArray()); } catch (NXException ex) { ClassItem.WriteLogFile(model.AssembleName + "电极视图创建错误!" + ex.Message); return; } Basic.DrawingUtils.SetWireframeColorSource(NXOpen.Preferences.GeneralWireframeColorSourceOption.FromFace, topEleView); DraftingView proEleView1; DraftingView proEleView2; try { proEleView1 = Basic.DrawingUtils.CreateProjectedView(topEleView, projectedElePt1, eleScale); proEleView2 = Basic.DrawingUtils.CreateProjectedView(proEleView1, projectedElePt2, eleScale); } catch (NXException ex) { ClassItem.WriteLogFile(model.AssembleName + "电极视图创建错误!" + ex.Message); return; } EleProViewDimension(proEleView2, eleScale, projectedElePt2); Matrix4 mat = model.GetEleMatr(); mat.RolateWithX(-2 * Math.PI / 5); mat.RolateWithY(Math.PI / 10); DraftingView topEleView2; try { topEleView2 = Basic.DrawingUtils.CreateView("Trimetric", new Point3d(240, 120, 0), eleScale, mat, eleHidden.ToArray()); } catch (NXException ex) { ClassItem.WriteLogFile(model.AssembleName + "电极视图创建错误!" + ex.Message); return; } SetViewVisible(new DraftingView[] { topEleView, proEleView1, proEleView2, topEleView2 }); }
/// <summary> /// 以属性得到实体 /// </summary> /// <param name="obj"></param> /// <returns></returns> public new static EDMInfo GetAttribute(NXObject obj) { try { return(new EDMInfo(MoldInfo.GetAttribute(obj), UserModel.GetAttribute(obj))); } catch (NXException ex) { ClassItem.WriteLogFile("未获取到EdmNumber 属性" + ex.Message); return(null); } }
/// <summary> /// 以属性得到实体 /// </summary> /// <param name="obj"></param> /// <returns></returns> public new static ElectrodeInfo GetAttribute(NXObject obj) { try { return(new ElectrodeInfo(MoldInfo.GetAttribute(obj), UserModel.GetAttribute(obj), ElectrodeAllInfo.GetAttribute(obj), Matrix4Info.GetAttribute(obj))); } catch (NXException ex) { ClassItem.WriteLogFile("未获取到属性" + ex.Message); return(null); } }
/// <summary> /// 获取EDM /// </summary> /// <param name="partCt"></param> /// <returns></returns> private EDMModel GetEdm(NXOpen.Assemblies.Component partCt) { try { Part edmPart = (partCt.Parent.Prototype) as Part; return(new EDMModel(edmPart)); } catch (NXException ex) { ClassItem.WriteLogFile("获取EDM错误" + ex.Message); return(null); } }
private WorkModel GetWork(NXOpen.Assemblies.Component partCt) { try { Part workPart = (partCt.Parent.Parent.Prototype) as Part; return(new WorkModel(workPart)); } catch (NXException ex) { ClassItem.WriteLogFile("获取work错误" + ex.Message); return(null); } }
/// <summary> /// 设置属性 /// </summary> public bool SetAttribute(CartesianCoordinateSystem csys, Matrix4 matr) { try { AttributeUtils.AttributeOperation("ContactArea", this.ContactArea, this.Body); SetDischargeFaceAttr(); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 更新Pitch /// </summary> private bool UpdatePitch() { Part workPart = Session.GetSession().Parts.Work; NXOpen.Features.ExtractFace ext; NXOpen.Features.MoveObject move; NXOpen.Features.PatternGeometry patt; List <Body> bodys = new List <Body>(); Body boolBody; List <NXOpen.Features.BooleanFeature> extBools; GetExtrudeBooleanBody(out boolBody, out extBools); GetFeature(out ext, out move, out patt); if (ext == null || move == null || patt == null || boolBody == null) { return(false); } if (extBools.Count > 0) { DeleteObject.Delete(extBools.ToArray()); } bodys.AddRange(ext.GetBodies()); bodys.AddRange(patt.GetAssociatedBodies()); try { MoveObject.CreateMoveObjToXYZ("moveX", "moveY", "moveZ", move as NXOpen.Features.MoveObject, bodys.ToArray()); } catch (NXException ex) { ClassItem.WriteLogFile("更新移动错误!" + ex.Message); return(false); } List <Body> bys = eleModel.PartTag.Bodies.ToArray().ToList(); bys.Remove(boolBody); SetHeadColour(newAllInfo.Pitch, newAllInfo.GapValue, bys); try { PartUtils.SetPartWork(AssmbliesUtils.GetPartComp(asm, eleModel.PartTag)[0]); Body elebody = BooleanUtils.CreateBooleanFeature(boolBody, false, false, NXOpen.Features.Feature.BooleanType.Unite, bys.ToArray()).GetBodies()[0]; SetEleColor(elebody); PartUtils.SetPartWork(null); } catch (NXException ex) { ClassItem.WriteLogFile("更新求和错误!" + ex.Message); return(false); } return(true); }
public bool SetAttribute(params NXObject[] objs) { try { AttributeUtils.AttributeOperation("ToolhName", this.ToolhName, objs); AttributeUtils.AttributeOperation("GapValue", this.GapValue, objs); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 删除特征 /// </summary> public bool DeleToolingBoxFeatures() { try { DeleteObject.Delete(ToolingBoxFeature); this.ToolingBoxFeature = null; return(true); } catch (NXException ex) { ClassItem.WriteLogFile(ex.Message); return(false); } }
/// <summary> /// 获得电极组件 /// </summary> /// <returns></returns> private List <NXOpen.Assemblies.Component> GetEleAllComponent() { ASMModel asm = ASMCollection.GetAsmModel(this.elePart); try { return(AssmbliesUtils.GetPartComp(asm.PartTag, elePart)); } catch (NXException ex) { ClassItem.WriteLogFile("获取电极组件错误!" + ex.Message); return(null); } }
public bool SetAttribute(params NXObject[] objs) { try { AttributeUtils.AttributeOperation("Matrx4", Matrx4ToString(this.Matr), objs); AttributeUtils.AttributeOperation("CsysCenter", new double[] { Math.Round(this.CenterPt.X, 4), Math.Round(this.CenterPt.Y, 4), Math.Round(this.CenterPt.Z, 4) }, objs); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
private void SetCenterPoint() { try { Point pt = PointUtils.CreatePointFeature(new Point3d(0, 0, 0)); pt.Color = 186; pt.Layer = 254; theUFSession.Obj.SetName(pt.Tag, "SetValuePoint"); } catch (NXException ex) { ClassItem.WriteLogFile("创建中心点错误!" + ex.Message); } }
/// <summary> /// 设置属性 /// </summary> public bool SetAttribute(Part obj) { try { AttributeUtils.AttributeOperation("EleName", this.EleName, obj); AttributeUtils.AttributeOperation("BorrowName", this.BorrowName, obj); AttributeUtils.AttributeOperation("EleNumber", this.EleNumber, obj); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 写入属性 /// </summary> /// <param name="objs"></param> /// <returns></returns> public bool SetAttribute(params NXObject[] objs) { try { AttributeUtils.AttributeOperation("IsPreparation", this.IsPreparation, objs); AttributeUtils.AttributeOperation("Material1", this.Material, objs); AttributeUtils.AttributeOperation("Preparation", this.Preparation, objs); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 写入属性 /// </summary> /// <param name="objs"></param> /// <returns></returns> public bool SetAttribute(params NXObject[] objs) { try { AttributeUtils.AttributeOperation("EleHeadDis", this.EleHeadDis, objs); AttributeUtils.AttributeOperation("EleMinDim", this.EleMinDim, objs); AttributeUtils.AttributeOperation("CamTemplate", this.CamTemplate, objs); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 写入属性 /// </summary> /// <param name="objs"></param> /// <returns></returns> public bool SetAttribute(params NXObject[] objs) { try { AttributeUtils.AttributeOperation("EleName", this.EleName, objs); AttributeUtils.AttributeOperation("BorrowName", this.BorrowName, objs); AttributeUtils.AttributeOperation("PitchX", this.PitchX, objs); AttributeUtils.AttributeOperation("PitchXNum", this.PitchXNum, objs); AttributeUtils.AttributeOperation("PitchY", this.PitchY, objs); AttributeUtils.AttributeOperation("PitchYNum", this.PitchYNum, objs); AttributeUtils.AttributeOperation("CrudeInter", this.CrudeInter, objs); AttributeUtils.AttributeOperation("CrudeNum", this.CrudeNum, objs); AttributeUtils.AttributeOperation("DuringInter", this.DuringInter, objs); AttributeUtils.AttributeOperation("DuringNum", this.DuringNum, objs); AttributeUtils.AttributeOperation("FineInter", this.FineInter, objs); AttributeUtils.AttributeOperation("FineNum", this.FineNum, objs); AttributeUtils.AttributeOperation("Material1", this.Material, objs); AttributeUtils.AttributeOperation("EleType", this.EleType, objs); AttributeUtils.AttributeOperation("Condition", this.Condition, objs); AttributeUtils.AttributeOperation("Extrudewith", this.Extrudewith, objs); AttributeUtils.AttributeOperation("CH", this.Ch, objs); AttributeUtils.AttributeOperation("IsPreparation", this.IsPreparation, objs); AttributeUtils.AttributeOperation("Remarks", this.Remarks, objs); AttributeUtils.AttributeOperation("Technology", this.Technology, objs); AttributeUtils.AttributeOperation("CamTemplate", this.CamTemplate, objs); AttributeUtils.AttributeOperation("EleSetValue", this.EleSetValue, objs); AttributeUtils.AttributeOperation("Preparation", this.Preparation, objs); AttributeUtils.AttributeOperation("ElePresentation", this.ElePresentation, objs); AttributeUtils.AttributeOperation("Area", this.Area, objs); AttributeUtils.AttributeOperation("EleNumber", this.EleNumber, objs); AttributeUtils.AttributeOperation("Positioning", this.Positioning, objs); AttributeUtils.AttributeOperation("DatumWidth", this.DatumWidth, objs); AttributeUtils.AttributeOperation("EleHeadDis", this.EleHeadDis, objs); AttributeUtils.AttributeOperation("EleMinDim", this.EleMinDim, objs); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 设置属性 /// </summary> public bool SetAttribute(Part obj) { try { AttributeUtils.AttributeOperation("PitchX", this.PitchX, obj); AttributeUtils.AttributeOperation("PitchXNum", this.PitchXNum, obj); AttributeUtils.AttributeOperation("PitchY", this.PitchY, obj); AttributeUtils.AttributeOperation("PitchYNum", this.PitchYNum, obj); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 设置属性 /// </summary> public bool SetAttribute(Part obj) { try { AttributeUtils.AttributeOperation("EleSetValue", this.EleSetValue, obj); AttributeUtils.AttributeOperation("ContactArea", this.ContactArea, obj); AttributeUtils.AttributeOperation("ProjectedArea", this.ProjectedArea, obj); AttributeUtils.AttributeOperation("Positioning", this.Positioning, obj); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("写入属性错误!" + ex.Message); return(false); } }
/// <summary> /// 加载到ASM /// </summary> /// <param name="asm"></param> /// <returns></returns> public bool LoadAsm(Part asm) { Matrix4 matr = new Matrix4(); matr.Identity(); try { Component ct = Basic.AssmbliesUtils.PartLoad(asm, Work.WorkpiecePath, Work.AssembleName, matr, new Point3d(0, 0, 0)); return(true); } catch (NXException ex) { ClassItem.WriteLogFile("装配到ASM错误!" + ex.Message); return(false); } }