/// <summary> /// 创建基准座 /// </summary> private void CreateSeat(double zHeigth, bool zDatum) { List <Body> bodys = new List <Body>(); bodys.AddRange(elePart.Model.PartTag.Bodies.ToArray()); ElectrodeSketchBuilder builder = new ElectrodeSketchBuilder(eleInfo.Preparation[0], eleInfo.Preparation[1], -zHeigth); builder.CreateEleSketch(); NXOpen.Features.Feature ext1 = ExtrudedUtils.CreateExtruded(new Vector3d(0, 0, -1), "0", "2", null, builder.LeiLine); NXOpen.Features.Feature ext2 = ExtrudedUtils.CreateExtruded(new Vector3d(0, 0, -1), "2", "20", null, builder.WaiLine); if (zDatum) { NXOpen.Features.Feature ext3 = ExtrudedUtils.CreateExtruded(new Vector3d(0, 0, 1), "0", zHeigth.ToString(), null, builder.Center); Body extBody3 = (ext3 as NXOpen.Features.BodyFeature).GetBodies()[0]; MoveObject.CreateMoveObjToXYZ("moveBoxX", "moveBoxY", "moveBoxZ", null, extBody3); bodys.Add(extBody3); } Body extBody1 = (ext1 as NXOpen.Features.BodyFeature).GetBodies()[0]; Body extBody2 = (ext2 as NXOpen.Features.BodyFeature).GetBodies()[0]; CreateChamfer(extBody1.Tag); CreateUnite(bodys.ToArray(), extBody1.Tag, extBody2.Tag); }
public ElectrodeDatumBuilder(ElectrodeSketchBuilder sketch) { this.sketch = sketch; }
public List <string> CreateBuider() { List <string> err = new List <string>(); ElectrodePartBuilder part = new ElectrodePartBuilder(GetEleInfo(), condition.Work.WorkpieceDirectoryPath); bool ptOk = part.CreatPart(); if (ptOk) { List <Body> bodys = new List <Body>(); List <Body> headBodys = new List <Body>(); bool isok = false; ElectrodeDatumBuilder datum = null; try { headBodys = part.WaveEleHeadBody(condition.HeadBodys); } catch (NXException ex) { err.Add("连接体错! " + ex.Message); return(err); } try { isok = condition.ExpAndMatr.Exp.CreateExp(zDatum, allInfo.Preparetion.Preparation); } catch (NXException ex) { err.Add("创建表达式错误! " + ex.Message); return(err); } try { ElectrodeSketchBuilder sketch = new ElectrodeSketchBuilder(allInfo.Preparetion.Preparation[0], allInfo.Preparetion.Preparation[1], -allInfo.Datum.EleHeight); datum = new ElectrodeDatumBuilder(sketch); ElectrodeMoveBuilder move = new ElectrodeMoveBuilder(headBodys, allInfo.Datum, allInfo.GapValue, allInfo.Pitch); datum.SetParentBuilder(sketch); sketch.SetParentBuilder(move); sketch.CreateBuilder(); move.CreateBuilder(); datum.CreateBuilder(); bodys.AddRange(move.AllBodys); if (zDatum) { ElectrodeFeelerBuilder feeler = new ElectrodeFeelerBuilder(sketch, this.allInfo.Datum); feeler.CreateBuilder(); bodys.Add(feeler.FeelerBody); } } catch (NXException ex) { err.Add("创建电极特征错误! " + ex.Message); return(err); } try { string errs; Body by = CreateUnite(datum.DatumBody, bodys, out errs); SetEleColor(by); if (errs != "") { err.Add(errs); } } catch (NXException ex) { err.Add("电极求和错误! " + ex.Message); } CreateCenterPoint(part, zDatum); PartUtils.SetPartWork(null); part.MoveEleComp(condition.Work.Info.Matr, part.GetMove(zDatum)); MoveHeadTolayer(); MoveEleComp(part.EleComp); } else { err.Add("创建电极档错误!"); } return(err); }
public ElectrodeFeelerBuilder(ElectrodeSketchBuilder sketch, ElectrodeDatumInfo datum) { this.datum = datum; this.sketch = sketch; }