Example #1
0
        private void CreatePinRef(Port obj, Eagle.segment segment_obj)
        {
            var gate       = obj.Impl.Attributes.EDAGate;
            var pinref_obj = new Eagle.pinref()
            {
                gate = (String.IsNullOrWhiteSpace(gate) == false) ? gate : "gate-unknown",
                part = obj.Parent.Name,
                pin  = obj.Name,
            };

            segment_obj.Items.Add(pinref_obj);
        }
Example #2
0
        private void CreateWireSegment(Port port, Eagle.segment segment_obj)
        {
            // create two short wire segments: 1. from src pin to, and 2. to dst pin
            // TODO: create vertical segments for vertical pins (or rotated symbols)
            var    rot = port.Impl.Attributes.EDASymbolRotation;
            double x1  = port.CanvasX;
            double y1  = port.CanvasY;
            double x2  = x1;
            double y2  = y1;

            if (rot.Equals("R90") || rot.Equals("90"))
            {
                y2 -= netLength; // 90 pointing down
            }
            else if (rot.Equals("R270") || rot.Equals("270"))
            {
                y2 += netLength; // 270 pointing up
            }
            else if (rot.Equals("R180") || rot.Equals("180"))
            {
                x2 += netLength; // 180 going right
            }
            else
            {
                x2 -= netLength; // 0 going left
            }
            var wire_obj = new Eagle.wire()
            {
                x1    = x1.ToString("F2"),
                y1    = y1.ToString("F2"),
                x2    = x2.ToString("F2"),
                y2    = y2.ToString("F2"),
                layer = netLayer,
                width = wireWidth
            };

            segment_obj.Items.Add(wire_obj);

            var label_obj = new Eagle.label()
            {
                x     = wire_obj.x2,
                y     = wire_obj.y2,
                size  = labelSize,
                layer = nameLayer
            };

            segment_obj.Items.Add(label_obj);
        }
Example #3
0
        private void visit(Port obj, Eagle.net net_obj)
        {
            if (obj.Parent.Impl is Tonka.TestComponent)
            {
            }
            else if (CodeGenerator.polyComponentClasses
                     .Contains((obj.Parent.Impl as Tonka.Component).Attributes.Classifications))
            {
                // remember this 'pcb' net for later processing in generating layout
                if (!CodeGenerator.polyNetMap.ContainsKey(obj))
                {
                    CodeGenerator.polyNetMap.Add(obj, net_obj);
                }
            }
            else
            {
                // create a segment for this object
                var segment_obj = new Eagle.segment();
                CreateWireSegment(obj, segment_obj); // simple routing
                CreatePinRef(obj, segment_obj);      // destination pin
                net_obj.segment.Add(segment_obj);
            }
            PortNetMap[obj] = net_obj;  // add to map

            var allPorts =
                (from conn in obj.DstConnections select conn.DstPort).Union
                    (from conn in obj.SrcConnections select conn.SrcPort);

            foreach (var port in allPorts) // visit sources
            {
                if (!PortNetMap.ContainsKey(port))
                {
                    this.visit(port, net_obj);
                }
            }
        }