private static void CreateBoardView(IStep step, IFilter filter, IODBLayer frontLayer, float boardThickness, bool front) { if (boardThickness > 0) { #region draw board front int shapeIndexBoardHeight = IFilter.AddToolDefinitionRect(frontLayer, boardThickness, boardThickness, boardThickness, false); //add line with board symbol index to have correct thickness IODBObject boardLineFront = filter.CreateLine(frontLayer); ILineSpecificsD lineDetails = (ILineSpecificsD)boardLineFront.GetSpecificsD(); if (front) { lineDetails.Start = new PointD(step.GetBoundsD().Left + boardThickness / 2, 0); lineDetails.End = new PointD(step.GetBoundsD().Right - boardThickness / 2, 0); } else { lineDetails.Start = new PointD(0, step.GetBoundsD().Top + boardThickness / 2); lineDetails.End = new PointD(0, step.GetBoundsD().Bottom - boardThickness / 2); } boardLineFront.SetSpecifics(lineDetails, shapeIndexBoardHeight); boardLineFront.ObjectColorTemporary(Color.Green); #endregion } }
private static void CreateComponents(bool top, ICMPLayer CMPLayer, IODBLayer frontLayer, IODBLayer sideLayer, float offset, IFilter filter, bool allValuesInMM) { if (CMPLayer == null) { return; } foreach (ICMPObject component in CMPLayer.GetAllLayerObjects()) { float height = (float)component.CompHEIGHT; IPackageSpecificsD usedPackage = component.GetPackageSpecificsD(); if (height == 0) { height = usedPackage.Height; } if (height == 0) { #region check height //check attributes foreach (string attrib in component.GetComponentAttributes()) { if (attrib.ToLowerInvariant().Contains("height")) { string[] attribtValueFinder = attrib.Split('='); if (attribtValueFinder.Length > 1) { float.TryParse(attribtValueFinder[1], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height); } else if (attribtValueFinder[0].Contains("\'")) { string subStr = attribtValueFinder[0].Substring(attribtValueFinder[0].IndexOf('\'') + 1); if (subStr.Contains("\'")) { subStr = subStr.Substring(0, subStr.IndexOf('\'')); float.TryParse(subStr, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height); } } } } #endregion } if (allValuesInMM) { height = (float)IMath.MM2Mils(height); } #region front layer int componentFront = IFilter.AddToolDefinitionRect(frontLayer, (float)component.Bounds.Width, height, (float)component.Bounds.Width, false); IODBObject cmpFront = filter.CreatePad(frontLayer); IPadSpecificsD padCMPFront = (IPadSpecificsD)cmpFront.GetSpecificsD(); if (top) { padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, offset + height / 2); } else { padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, -(offset + height / 2)); } cmpFront.SetSpecifics(padCMPFront, componentFront); cmpFront.FreeText = component.Ref; if (top) { cmpFront.ObjectColorTemporary(Color.Silver); } else { cmpFront.ObjectColorTemporary(Color.Gray); } #endregion #region side layer int componentSide = IFilter.AddToolDefinitionRect(sideLayer, (float)component.Bounds.Height, (float)component.Bounds.Height, height, false); IODBObject cmpSide = filter.CreatePad(sideLayer); IPadSpecificsD padCMPSide = (IPadSpecificsD)cmpSide.GetSpecificsD(); if (top) { padCMPSide.Location = new PointD(offset + height / 2, component.Bounds.Y + component.Bounds.Height / 2); } else { padCMPSide.Location = new PointD(-(offset + height / 2), component.Bounds.Y + component.Bounds.Height / 2); } cmpSide.SetSpecifics(padCMPSide, componentSide); cmpSide.FreeText = component.Ref; if (top) { cmpSide.ObjectColorTemporary(Color.Silver); } else { cmpSide.ObjectColorTemporary(Color.Gray); } #endregion } }