/// <summary> /// 创建草绘 /// </summary> /// <param name="waiLine"></param> /// <param name="leiLine"></param> private void CreateEleSketch() { Tag sketchTag = SketchUtils.CreateShetch(zSetValue); this.WaiLine = CreateRectangle(this.preparationLength, this.preparationWigth, this.zSetValue); this.LeiLine = CreateRectangle(this.preparationLength - 2, this.preparationWigth - 2, this.zSetValue); Line[] centerLine = CreateCenterLine(this.zSetValue); Line[] centerLine2 = CreateCenterLine(0); this.Center = CreateCenter(zSetValue); SetLineObj(254, centerLine); SetLineObj(1, centerLine2); SetLineName("XCenterLine", centerLine2[0]); SetLineName("YCenterLine", centerLine2[1]); SketchUtils.AddShetch(sketchTag, this.WaiLine); SketchUtils.AddShetch(sketchTag, this.LeiLine); SketchUtils.AddShetch(sketchTag, centerLine); SketchUtils.AddShetch(sketchTag, Center); SetSketchConstraint(centerLine); SetSketch(this.WaiLine, centerLine, "0"); SetSketch(this.LeiLine, centerLine, "DatumWidth"); theUFSession.Sket.UpdateSketch(sketchTag); theUFSession.Sket.TerminateSketch(); // SetCenterPoint(); theUFSession.Obj.SetLayer(sketchTag, 254); theUFSession.Obj.SetLayer(Center.Tag, 254); DisplayableObject[] disp = workPart.Datums.ToArray(); for (int i = 0; i < disp.Length; i++) { theUFSession.Obj.SetLayer(disp[i].Tag, 254); } }