예제 #1
0
        public void SendtoAutoCAD(PlanSwift.Item AItem)
        {
            PlanSwift.ISection CurrentSection;
            PlanSwift.INode    CurrentNode;
            int    ItemDigiType, SectionIndex, NodeIndex;
            double Xscale, Yscale;
            float  nx, ny;
            object StartNode, EndNode;

            if (AItem.DigiType != 3)
            {
                ItemDigiType = AItem.DigiType;
                switch (ItemDigiType)
                {
                // IF Digitizer type is "Area" do something
                case 0:
                    for (SectionIndex = 0; SectionIndex <= AItem.Sections.Count - 1; SectionIndex++)
                    {
                        CurrentSection = AItem.Sections[SectionIndex];
                        StartNode      = CurrentSection.Nodes[0].Point;
                        EndNode        = CurrentSection.Nodes[CurrentSection.Nodes.Count - 1].Point;
                        double[] SP = new double[((CurrentSection.Nodes.Count + 1) * 2)];
                        Xscale = CurrentSection.Page().ScaleX;
                        Yscale = CurrentSection.Page().ScaleY;
                        //Loop Though all nodes in current section
                        for (NodeIndex = 0; NodeIndex <= CurrentSection.Nodes.Count - 1; NodeIndex++)
                        {
                            CurrentNode           = CurrentSection.Nodes[NodeIndex];
                            nx                    = CurrentNode.x;
                            ny                    = -CurrentNode.y;
                            SP[NodeIndex * 2]     = (nx / Xscale) * 12;
                            SP[NodeIndex * 2 + 1] = (ny / Yscale) * 12;
                        }
                        //Close lines of the area
                        SP[SP.Length - 2] = (CurrentSection.Nodes[0].x / Xscale) * 12;
                        SP[SP.Length - 1] = (-CurrentSection.Nodes[0].y / Yscale) * 12;
                        AuDocument.ModelSpace.AddLightWeightPolyline(SP);
                    }
                    break;
                }
            }
        }