private static bool CheckConnection(double tolerance, IODBObject selObj, PointD lineStart, List <IObject> relevantObjects, bool setColor) { foreach (IODBObject relObject in relevantObjects) { if (relObject == selObj) { continue; } if (relObject.Type == IObjectType.Line) { ILineSpecificsD lineRel = (ILineSpecificsD)relObject.GetSpecificsD(); if (IMath.DistancePointToPoint(lineRel.End, lineStart) < tolerance || IMath.DistancePointToPoint(lineRel.Start, lineStart) < tolerance) { setColor = false; break; } } else if (relObject.Type == IObjectType.Arc) { IArcSpecificsD arcRel = (IArcSpecificsD)relObject.GetSpecificsD(); if (IMath.DistancePointToPoint(arcRel.End, lineStart) < tolerance || IMath.DistancePointToPoint(arcRel.Start, lineStart) < tolerance) { setColor = false; break; } } } return(setColor); }
public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); IFilter filter = new IFilter(parent); IODBLayer layerPolygons = filter.CreateEmptyODBLayer("polygons_n", step.Name); bool polyStart = true; List <IODBObject> listOfSelection = step.GetSelectedElements(); PCBI.MathUtils.IPolyClass poly = new PCBI.MathUtils.IPolyClass(); foreach (IODBObject obj in listOfSelection) { IObjectSpecificsD os = obj.GetSpecificsD(); if (os.GetType() == typeof(IArcSpecificsD)) { IArcSpecificsD aEdge = (IArcSpecificsD)os; if (polyStart) { polyStart = false; } poly.AddEdge(aEdge.Start, aEdge.End, aEdge.Center, aEdge.ClockWise); } else if (os.GetType() == typeof(ILineSpecificsD)) { ILineSpecificsD aEdge = (ILineSpecificsD)os; if (polyStart) { polyStart = false; } poly.AddEdge(aEdge.Start, aEdge.End); } } if (poly.GetSubPolygons().Count > 0) { foreach (PCBI.MathUtils.IPolyClass polyC in poly.GetSubPolygons()) { if (polyC.GetBounds().Width > 0.001 && polyC.GetBounds().Height > 0.001) { IODBObject surfaceFromPoly = polyC.GetSurfaceFromPolygon(layerPolygons); } } layerPolygons.EnableLayer(true); } else { IODBObject suf = poly.GetSurfaceFromPolygon(layerPolygons); layerPolygons.EnableLayer(true); } parent.UpdateView(); IMatrix matrix = parent.GetMatrix(); matrix.UpdateDataAndList(); }
public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } double tolerance = 1; List <IODBObject> selection = step.GetSelectedElements(); foreach (IODBObject selObj in selection) { IODBLayer layer = (IODBLayer)step.GetLayer(selObj.GetParentLayerName()); if (selObj.Type == IObjectType.Line) { ILineSpecificsD line = (ILineSpecificsD)selObj.GetSpecificsD(); List <IObject> startPos = layer.GetAllObjectsOnPosition(line.Start.ToPointF()); bool setColor = true; setColor = CheckConnection(tolerance, selObj, line.Start, startPos, setColor); if (setColor) { List <IObject> endPos = layer.GetAllObjectsOnPosition(line.End.ToPointF()); setColor = CheckConnection(tolerance, selObj, line.End, endPos, setColor); } if (setColor) { selObj.ObjectColorTemporary(Color.Aquamarine); } } else if (selObj.Type == IObjectType.Arc) { IArcSpecificsD arc = (IArcSpecificsD)selObj.GetSpecificsD(); List <IObject> startPos = layer.GetAllObjectsOnPosition(arc.Start.ToPointF()); bool setColor = true; setColor = CheckConnection(tolerance, selObj, arc.Start, startPos, setColor); if (setColor) { List <IObject> endPos = layer.GetAllObjectsOnPosition(arc.End.ToPointF()); setColor = CheckConnection(tolerance, selObj, arc.End, endPos, setColor); } if (setColor) { selObj.ObjectColorTemporary(Color.Aquamarine); } } } step.ClearSelection(); }
public void Execute(IPCBIWindow parent) { //this script replace mini arcs by lines try { IStep step = parent.GetCurrentStep(); if (step == null) { return; } double minLenghtArcToReplaceByLine = IMath.MM2Mils(0.02); //20?m maximum for arcs IFilter objectCreator = new IFilter(parent); foreach (string layerName in step.GetAllLayerNames()) //check all layer { ILayer gerberLayer = step.GetLayer(layerName); if (gerberLayer == null) { continue; } if (gerberLayer is ICMPLayer) { continue; //should not be for gerberlayers } if (gerberLayer is IPictureLayer) { continue; //should not be for gerberlayers } //gerber layers always contain IODBObjects foreach (IODBObject obj in gerberLayer.GetAllLayerObjects()) { if (obj.Type == IObjectType.Arc) { #region one arc IArcSpecificsD arc = (IArcSpecificsD)obj.GetSpecificsD(); double radius = IMath.DistancePointToPoint(arc.Start, arc.Center); double angle = IMath.GetAngle(arc.Start, arc.End, arc.Center, arc.ClockWise); //always >=0 if (angle > 0) //ODB++ spec define arcs with Start == End as full circles (angle = 0 in this calculation) { double bogen = 2 * Math.PI * radius * angle / 360; if (bogen < minLenghtArcToReplaceByLine && arc.PenWidth > bogen)//simple condition to identify mini arcs { //replace by line IODBObject lineObj = objectCreator.CreateLine((IODBLayer)gerberLayer); //we know it's a gerber layer -> it must be a IODBLayer lineObj.SetSpecifics(new ILineSpecificsD() { Start = arc.Start, End = arc.End, ShapeIndex = arc.ShapeIndex, Positive = arc.Positive }); if (!obj.ReplaceItemBy(lineObj)) //replace it { Console.WriteLine("Could not replace item!"); } } } #endregion } } } } catch (Exception ex) { Console.WriteLine("Error! " + ex.ToString()); } parent.UpdateView(); //to show the replaced elements }
public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } if (step.GetSelectedElementsCount() == 2) //this script is optimiezd for two line elements { List <IODBObject> selectedElements = step.GetSelectedElements(); IODBObject obj1 = selectedElements[0]; IODBObject obj2 = selectedElements[1]; bool firstArc = false; bool secondArc = false; if (obj1.Type == IObjectType.Arc) { firstArc = true; } if (obj2.Type == IObjectType.Arc) { secondArc = true; } if (!firstArc && obj1.Type != IObjectType.Line) { return; } else if (!secondArc && obj2.Type != IObjectType.Line) { return; } ILineSpecificsD obS1; ILineSpecificsD obS2; if (firstArc) { obS1 = new ILineSpecificsD(); IArcSpecificsD arcS1 = (IArcSpecificsD)obj1.GetSpecificsD(); obS1.Start = arcS1.Start; obS1.End = arcS1.End; } else { obS1 = (ILineSpecificsD)obj1.GetSpecificsD(); } if (secondArc) { obS2 = new ILineSpecificsD(); IArcSpecificsD arcS2 = (IArcSpecificsD)obj2.GetSpecificsD(); obS2.Start = arcS2.Start; obS2.End = arcS2.End; } else { obS2 = (ILineSpecificsD)obj2.GetSpecificsD(); } //make simple check for crossing point, this is nearly correct for arc endings PCBI.MathUtils.PointD crossingPoint = PCBI.MathUtils.IMath.CrossingPoint(obS1.Start, obS1.End, obS2.Start, obS2.End, false); if (PCBI.MathUtils.PointD.InfPoint == crossingPoint) { return; //parallel lines do not work } #region set ends of lines to the crossing Point if (!firstArc) { if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.Start)) { obS1.End = crossingPoint; } else { obS1.Start = crossingPoint; } obj1.SetSpecifics(obS1); } else { //special case for arc IArcSpecificsD arcS1 = (IArcSpecificsD)obj1.GetSpecificsD(); if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.Start)) { arcS1.End = crossingPoint; } else { arcS1.Start = crossingPoint; } obj1.SetSpecifics(arcS1); obj1.UpdateInternal(); } if (!secondArc) { if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS2.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS2.Start)) { obS2.End = crossingPoint; } else { obS2.Start = crossingPoint; } obj2.SetSpecifics(obS2); } else { //special case for arc IArcSpecificsD arcS2 = (IArcSpecificsD)obj2.GetSpecificsD(); if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, arcS2.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, arcS2.Start)) { arcS2.End = crossingPoint; } else { arcS2.Start = crossingPoint; } obj2.SetSpecifics(arcS2); obj2.UpdateInternal(); } #endregion } parent.UpdateView(); }
private void CreateNewDrillODBLayer(PCBI.Automation.IFilter filter, string newLayerName, IPCBIWindow parent, List <IODBObject> currIODBObjectList, bool activateLayer) { if (currIODBObjectList.Count == 0) { return; } IODBLayer layer = filter.CreateEmptyODBLayer(newLayerName, parent.GetCurrentStep().Name); Dictionary <string, int> shapeList = new Dictionary <string, int>(); foreach (IODBObject obj in currIODBObjectList) { if (obj.Type == IObjectType.Pad) { IPadSpecificsD specPad = (IPadSpecificsD)obj.GetSpecificsD(); if (!shapeList.ContainsKey(specPad.ODBSymbol_String)) { int newShapeIndex = IFilter.AddToolFromODBString(layer, specPad.ODBSymbol_String, shapeList.Count); shapeList.Add(specPad.ODBSymbol_String, newShapeIndex); } IODBObject pad = filter.CreatePad(layer); IPadSpecificsD padInfosD = (IPadSpecificsD)obj.GetSpecificsD(); padInfosD.ShapeIndex = shapeList[specPad.ODBSymbol_String]; pad.SetSpecifics(padInfosD, shapeList[specPad.ODBSymbol_String]); } else if (obj.Type == IObjectType.Line) { ILineSpecificsD specLine = (ILineSpecificsD)obj.GetSpecificsD(); if (!shapeList.ContainsKey(specLine.ODBSymbol_String)) { int newShapeIndex = IFilter.AddToolFromODBString(layer, specLine.ODBSymbol_String, shapeList.Count); shapeList.Add(specLine.ODBSymbol_String, newShapeIndex); } IODBObject line = filter.CreateLine(layer); ILineSpecificsD lineSpecificsD = (ILineSpecificsD)obj.GetSpecificsD(); lineSpecificsD.ShapeIndex = shapeList[specLine.ODBSymbol_String]; line.SetSpecifics(lineSpecificsD); } else if (obj.Type == IObjectType.Arc) { IArcSpecificsD specArc = (IArcSpecificsD)obj.GetSpecificsD(); if (!shapeList.ContainsKey(specArc.ODBSymbol_String)) { int newShapeIndex = IFilter.AddToolFromODBString(layer, specArc.ODBSymbol_String, shapeList.Count); shapeList.Add(specArc.ODBSymbol_String, newShapeIndex); } IODBObject arc = filter.CreateArc(layer); IArcSpecificsD specificsArcD = (IArcSpecificsD)obj.GetSpecificsD(); specificsArcD.ShapeIndex = shapeList[specArc.ODBSymbol_String]; arc.SetSpecifics(specificsArcD); } else if (obj.Type == IObjectType.Surface) { IODBObject surface = filter.CreatePolygon(layer); ISurfaceSpecificsD surfaceSpecificsD = (ISurfaceSpecificsD)obj.GetSpecificsD(); surface.SetSpecifics(surfaceSpecificsD); } else if (obj.Type == IObjectType.Text) { IODBObject text = filter.CreateText(layer); ITextSpecificsD textSpecificsD = (ITextSpecificsD)obj.GetSpecificsD(); text.SetSpecifics(textSpecificsD); } } if (activateLayer) { layer.EnableLayer(true); } IMatrix matrix = parent.GetMatrix(); matrix.SetMatrixLayerType(layer.LayerName, MatrixLayerType.Drill); matrix.SetMatrixLayerContext(layer.LayerName, MatrixLayerContext.Board); }
public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } List <IODBObject> selection = step.GetSelectedElements(); if (selection.Count == 2) { IObjectSpecificsD obj = selection[0].GetSpecificsD(); if (obj is ILineSpecificsD) { if (selection[1].Type == IObjectType.Line) //beide lines { #region line to line ILineSpecificsD obj2 = (ILineSpecificsD)selection[1].GetSpecificsD(); double distStart_Start = IMath.DistancePointToPoint(((ILineSpecificsD)obj).Start, obj2.Start); double distStart_End = IMath.DistancePointToPoint(((ILineSpecificsD)obj).Start, obj2.End); double distEnd_Start = IMath.DistancePointToPoint(((ILineSpecificsD)obj).End, obj2.Start); double distEnd_End = IMath.DistancePointToPoint(((ILineSpecificsD)obj).End, obj2.End); Combination comb = CheckShortestDist(distStart_Start, distStart_End, distEnd_Start, distEnd_End); if (comb == Combination.START_START) { //start of both obj2.Start = ((ILineSpecificsD)obj).Start; } else if (comb == Combination.START_END) { obj2.End = ((ILineSpecificsD)obj).Start; } else if (comb == Combination.END_START) { obj2.Start = ((ILineSpecificsD)obj).End; } else { obj2.End = ((ILineSpecificsD)obj).End; } selection[1].SetSpecifics(obj2); #endregion } else if (selection[1].Type == IObjectType.Arc) { #region line to arc IArcSpecificsD obj2 = (IArcSpecificsD)selection[1].GetSpecificsD(); double distStart_Start = IMath.DistancePointToPoint(((ILineSpecificsD)obj).Start, obj2.Start); double distStart_End = IMath.DistancePointToPoint(((ILineSpecificsD)obj).Start, obj2.End); double distEnd_Start = IMath.DistancePointToPoint(((ILineSpecificsD)obj).End, obj2.Start); double distEnd_End = IMath.DistancePointToPoint(((ILineSpecificsD)obj).End, obj2.End); Combination comb = CheckShortestDist(distStart_Start, distStart_End, distEnd_Start, distEnd_End); if (comb == Combination.START_START) { //start of both ((ILineSpecificsD)obj).Start = obj2.Start; } else if (comb == Combination.START_END) { ((ILineSpecificsD)obj).Start = obj2.End; } else if (comb == Combination.END_START) { ((ILineSpecificsD)obj).End = obj2.Start; } else { ((ILineSpecificsD)obj).End = obj2.End; } selection[0].SetSpecifics(obj); #endregion } } else if (obj is IArcSpecificsD) { if (selection[1].Type == IObjectType.Line) { #region arc to line ILineSpecificsD obj2 = (ILineSpecificsD)selection[1].GetSpecificsD(); double distStart_Start = IMath.DistancePointToPoint(((IArcSpecificsD)obj).Start, obj2.Start); double distStart_End = IMath.DistancePointToPoint(((IArcSpecificsD)obj).Start, obj2.End); double distEnd_Start = IMath.DistancePointToPoint(((IArcSpecificsD)obj).End, obj2.Start); double distEnd_End = IMath.DistancePointToPoint(((IArcSpecificsD)obj).End, obj2.End); Combination comb = CheckShortestDist(distStart_Start, distStart_End, distEnd_Start, distEnd_End); if (comb == Combination.START_START) { //start of both ((ILineSpecificsD)obj2).Start = ((IArcSpecificsD)obj).Start; } else if (comb == Combination.START_END) { ((ILineSpecificsD)obj2).End = ((IArcSpecificsD)obj).Start; } else if (comb == Combination.END_START) { ((ILineSpecificsD)obj2).Start = ((IArcSpecificsD)obj).End; } else { ((ILineSpecificsD)obj2).End = ((IArcSpecificsD)obj).End; } selection[1].SetSpecifics(obj2); #endregion } else if (selection[1].Type == IObjectType.Arc) //beides arc { #region arc to arc IArcSpecificsD obj2 = (IArcSpecificsD)selection[1].GetSpecificsD(); double distStart_Start = IMath.DistancePointToPoint(((IArcSpecificsD)obj).Start, obj2.Start); double distStart_End = IMath.DistancePointToPoint(((IArcSpecificsD)obj).Start, obj2.End); double distEnd_Start = IMath.DistancePointToPoint(((IArcSpecificsD)obj).End, obj2.Start); double distEnd_End = IMath.DistancePointToPoint(((IArcSpecificsD)obj).End, obj2.End); Combination comb = CheckShortestDist(distStart_Start, distStart_End, distEnd_Start, distEnd_End); if (comb == Combination.START_START) { //start of both ((IArcSpecificsD)obj).Start = obj2.Start; } else if (comb == Combination.START_END) { ((IArcSpecificsD)obj).Start = obj2.End; } else if (comb == Combination.END_START) { ((IArcSpecificsD)obj).End = obj2.Start; } else { ((IArcSpecificsD)obj).End = obj2.End; } ((IArcSpecificsD)obj).Center += ((IArcSpecificsD)obj2).Center; ((IArcSpecificsD)obj).Center /= 2; selection[0].SetSpecifics(obj); #endregion } } } parent.UpdateView(); }
public void Execute(IPCBIWindow parent) { double sizeRouting = PCBI.MathUtils.IMath.MM2Mils(2); //2 mm double sizeCutout = PCBI.MathUtils.IMath.MM2Mils(2); //2 mm double spaceCutout = PCBI.MathUtils.IMath.MM2Mils(100); //100 mm double lengthCutout = PCBI.MathUtils.IMath.MM2Mils(5); //5 mm double sumUpLength = 0; //offset for start IStep step = parent.GetCurrentStep(); if (step == null) { return; } PCBI.MathUtils.IPolyClass polyOfOutline = step.GetPCBOutlinePoly(); if (polyOfOutline.GetEdgeCount() == 0) { return; } IFilter filter = new IFilter(parent); IODBLayer HelperLayer = filter.CreateEmptyODBLayer("rout_outline_helper", step.Name); //this helper layer contains the uncutted line elements IODBLayer outlineLayerRouting = filter.CreateEmptyODBLayer("rout_outline", step.Name); IODBLayer cutoutLayerRouting = filter.CreateEmptyODBLayer("rout_cutout", step.Name); #region clean layers for multi use List <IODBObject> objListToRemove = new List <IODBObject>(); foreach (IODBObject obj in HelperLayer.GetAllLayerObjects()) { objListToRemove.Add(obj); } HelperLayer.RemoveObjects(objListToRemove); objListToRemove = new List <IODBObject>(); foreach (IODBObject obj in cutoutLayerRouting.GetAllLayerObjects()) { objListToRemove.Add(obj); } cutoutLayerRouting.RemoveObjects(objListToRemove); objListToRemove = new List <IODBObject>(); foreach (IODBObject obj in outlineLayerRouting.GetAllLayerObjects()) { objListToRemove.Add(obj); } outlineLayerRouting.RemoveObjects(objListToRemove); #endregion int shapeIndexOutlinediameter = IFilter.AddToolDefinitionRound(HelperLayer, (float)sizeRouting); foreach (PCBI.MathUtils.IEdge edge in polyOfOutline.GetEdges()) { #region outline elements if (edge.Type == IEdgeType.Arc) { IODBObject newArc = filter.CreateArc(HelperLayer); IArcSpecificsD arc = (IArcSpecificsD)newArc.GetSpecificsD(); arc.ClockWise = ((IArcEdge)edge).ClockWise; if (arc.ClockWise) { arc.Start = edge.Begin; arc.End = edge.End; } else { arc.End = edge.Begin; arc.Start = edge.End; } arc.Center = ((PCBI.MathUtils.IArcEdge)edge).Center; arc.ShapeIndex = shapeIndexOutlinediameter; newArc.SetSpecifics(arc); } else { IODBObject newLine = filter.CreateLine(HelperLayer); ILineSpecificsD line = (ILineSpecificsD)newLine.GetSpecificsD(); line.Start = edge.Begin; line.End = edge.End; line.ShapeIndex = shapeIndexOutlinediameter; newLine.SetSpecifics(line); } #endregion } //make one surface of all lines and arcs HelperLayer.CreateLayerNetList(true); HelperLayer.PolygonizeLayer(0, false); PointD lastPToIdentifyHole = PointD.InfPoint; foreach (IODBObject surface in HelperLayer.GetAllLayerObjects()) { #region replace surfaces by routing lines and arcs if (surface.Type != IObjectType.Surface) { continue; } objListToRemove.Add(surface); List <ISurfaceSpecificsD> isle = ((ISurfaceSpecificsD)surface.GetSpecificsD()).SplitInIsleAndHoles(parent); if (isle.Count > 0) { for (int i = 0; i < isle.Count; i++) { bool foundelement = false; foreach (IODBObject linesAndArcs in isle[i].GetOutline()) { if (linesAndArcs.Type == IObjectType.Arc) { #region arc IODBObject newArc = filter.CreateArc(HelperLayer); IArcSpecificsD arc = (IArcSpecificsD)linesAndArcs.GetSpecificsD(); if (lastPToIdentifyHole == PointD.InfPoint || !(lastPToIdentifyHole != arc.Start && lastPToIdentifyHole != arc.End)) { lastPToIdentifyHole = arc.End; } else { break; } newArc.SetSpecifics(arc); #endregion } else { #region line IODBObject newLine = filter.CreateLine(HelperLayer); ILineSpecificsD line = (ILineSpecificsD)linesAndArcs.GetSpecificsD(); if (lastPToIdentifyHole == PointD.InfPoint || line.Start == lastPToIdentifyHole) { lastPToIdentifyHole = line.End; } else { break; } newLine.SetSpecifics(line); #endregion } foundelement = true; } if (foundelement) { break; } } } #endregion } HelperLayer.RemoveObjects(objListToRemove); //surface remove int shapeIndexCutoutdiameter = IFilter.AddToolDefinitionRound(outlineLayerRouting, (float)sizeCutout); int shapeIndexCutoutdiameter2 = IFilter.AddToolDefinitionRound(cutoutLayerRouting, (float)sizeCutout); double sumUpGap = 0; foreach (IODBObject lineOrArc in HelperLayer.GetAllLayerObjects()) { if (lineOrArc.Type == IObjectType.Line) { #region lines ILineSpecificsD line = (ILineSpecificsD)lineOrArc.GetSpecificsD(); double length = IMath.DistancePointToPoint(line.Start, line.End); double lengthComplete = length; while (true) { if (length <= lengthCutout) { #region short lines sumUpLength += lengthCutout; if (sumUpLength > spaceCutout) { sumUpGap += lengthCutout; IODBObject lineObj = filter.CreateLine(cutoutLayerRouting); ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD(); lineSub.ShapeIndex = shapeIndexCutoutdiameter2; lineSub.Start = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); length = 0; lineSub.End = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); lineObj.SetSpecifics(lineSub); if (sumUpGap > lengthCutout) { sumUpGap = 0; sumUpLength = 0; } IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, lineObj); } else { IODBObject lineObj = filter.CreateLine(outlineLayerRouting); ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD(); lineSub.ShapeIndex = shapeIndexCutoutdiameter; lineSub.Start = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); length = 0; lineSub.End = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); lineObj.SetSpecifics(lineSub); IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, lineObj); } break; #endregion } else { #region long lines sumUpLength += lengthCutout; if (sumUpLength > spaceCutout || sumUpGap > 0) { sumUpGap += lengthCutout; IODBObject lineObj = filter.CreateLine(cutoutLayerRouting); ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD(); lineSub.ShapeIndex = shapeIndexCutoutdiameter2; lineSub.Start = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); length -= lengthCutout; lineSub.End = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); lineObj.SetSpecifics(lineSub); if (sumUpGap > lengthCutout) { sumUpGap = 0; sumUpLength = 0; } IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, lineObj); } else { IODBObject lineObj = filter.CreateLine(outlineLayerRouting); ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD(); lineSub.ShapeIndex = shapeIndexCutoutdiameter; lineSub.Start = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); length -= lengthCutout; lineSub.End = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length); lineObj.SetSpecifics(lineSub); IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, lineObj); } #endregion } } #endregion } else if (lineOrArc.Type == IObjectType.Arc) { #region arcs IArcSpecificsD arc = (IArcSpecificsD)lineOrArc.GetSpecificsD(); double arcLength = IMath.DistancePointToPoint(arc.Start, arc.End); sumUpLength += arcLength; if (sumUpLength > spaceCutout || sumUpGap > 0) { sumUpGap += arcLength; IODBObject arcObj = filter.CreateArc(cutoutLayerRouting); arc.ShapeIndex = shapeIndexCutoutdiameter2; arcObj.SetSpecifics(arc); if (sumUpGap > lengthCutout) { sumUpGap = 0; sumUpLength = 0; } IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, arcObj); } else { IODBObject arcObj = filter.CreateArc(outlineLayerRouting); arc.ShapeIndex = shapeIndexCutoutdiameter; arcObj.SetSpecifics(arc); IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp); attribRoutningComp.Value = "none"; IAttribute.SetAttribute(attribRoutningComp, arcObj); } #endregion } } //additional attributes are .feed, .speed, .rout_flag, .comp. and .rout_chain IMatrix matrix = parent.GetMatrix(); if (matrix != null) { matrix.UpdateDataAndList(); } parent.UpdateView(); }