Beispiel #1
0
    private void SetTrackLocaton(IPCB_Track PcbTrack, int ArgX1, int ArgY1, int ArgX2, int ArgY2)
    {
        if (PcbTrack == null)
        {
            return;
        }

        PcbTrack.SetState_X1(ArgX1);
        PcbTrack.SetState_Y1(ArgY1);
        PcbTrack.SetState_X2(ArgX2);
        PcbTrack.SetState_Y2(ArgY2);
    }
Beispiel #2
0
    IPCB_Primitive CreateTrack(double x1, double y1, double x2, double y2, TV6_Layer Layer)
    {
        IPCB_Primitive tmpPrim = PCBServer.PCBObjectFactory(TObjectId.eTrackObject, TDimensionKind.eNoDimension, TObjectCreationMode.eCreate_Default);
        IPCB_Track     track   = tmpPrim as IPCB_Track;

        track.SetState_X1(OffsetX + EDP.Utils.MilsToCoord(x1 - 4285));
        track.SetState_Y1(OffsetY + EDP.Utils.MilsToCoord(y1));
        track.SetState_X2(OffsetX + EDP.Utils.MilsToCoord(x2 - 4285));
        track.SetState_Y2(OffsetY + EDP.Utils.MilsToCoord(y2));

        track.SetState_Layer(Layer);
        track.SetState_Width(EDP.Utils.MilsToCoord(20));

        return(tmpPrim);
    }
Beispiel #3
0
    /// <summary>
    /// Adds a new track to the PCB
    /// </summary>
    /// <param name="Offset"></param>
    /// <param name="argWidth"></param>
    private void AddTrack(structPos Offset, int argWidth)//, V7_Layer argLayer)
    {
        PCBServer = PCB.GlobalVars.PCBServer;
        if (Offset.x == null)
        {
            Offset.x = 0;
        }
        if (Offset.y == null)
        {
            Offset.y = 0;
        }

        int        xL, yL, xO, yO;
        IPCB_Board pcbBoard = Util.GetCurrentPCB();

        if (pcbBoard == null)
        {
            return;
        }

        System.Diagnostics.Debug.WriteLine(pcbBoard.GetState_DisplayUnit().ToString());



        TV6_Layer ActiveLayer = pcbBoard.GetState_CurrentLayer();

        int OriginX = pcbBoard.GetState_XOrigin();
        int OriginY = pcbBoard.GetState_YOrigin();

        PCBServer.PreProcess();

        // Set the value of J to point to the "next" vertex; this is normally
        // I + 1, but needs to be set to 0 instead for the very last vertex
        // that is processed by this loop.
        IPCB_Primitive primitive = PCBServer.PCBObjectFactory(TObjectId.eTrackObject, TDimensionKind.eNoDimension, TObjectCreationMode.eCreate_Default);

        if (primitive == null)
        {
            return;
        }
        IPCB_Track track = primitive as IPCB_Track;

        if (pcbBoard.GetState_DisplayUnit() == TUnit.eImperial)
        {
            xL       = EDP.Utils.MilsToCoord((double)LastPos.x);
            yL       = EDP.Utils.MilsToCoord((double)LastPos.y);
            xO       = EDP.Utils.MilsToCoord((double)Offset.x);
            yO       = EDP.Utils.MilsToCoord((double)Offset.y);
            argWidth = EDP.Utils.MilsToCoord((double)argWidth);
        }
        else
        {
            xL       = EDP.Utils.MMsToCoord((double)LastPos.x);
            yL       = EDP.Utils.MMsToCoord((double)LastPos.y);
            xO       = EDP.Utils.MMsToCoord((double)Offset.x);
            yO       = EDP.Utils.MMsToCoord((double)Offset.y);
            argWidth = EDP.Utils.MMsToCoord((double)argWidth);
        }

        if (Offset.absolute)
        {
            track.SetState_X1(OriginX + xL);
            track.SetState_Y1(OriginY + yL);
            track.SetState_X2(OriginX + xO);
            track.SetState_Y2(OriginY + yO);

            LastPos = Offset;
        }
        else
        {
            track.SetState_X1(OriginX + xL);
            track.SetState_Y1(OriginY + yL);
            track.SetState_X2(OriginX + (xL + xO));
            track.SetState_Y2(OriginY + (yL + yO));

            LastPos.x = LastPos.x + Offset.x;
            LastPos.y = LastPos.y + Offset.y;
        }

        track.SetState_Layer(ActiveLayer);
        track.SetState_Width(argWidth);
        pcbBoard.AddPCBObject(primitive);

        PCBServer.PostProcess();


        // Refresh PCB workspace.
        //DXP.Utils.RunCommand("PCB:Zoom", "Action=Redraw");
    }