Example #1
0
        public static bool IsHere()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            const ushort VALIDDATA_LENGTH          = 4;
            bool         Answer = false;

            //byte[] packet = new byte[Dicisionpro.SPRO_APIPACKET_SIZE];
            //ed.WriteMessage("  ##  ##  H-1 \n");
            if (DicisionNativeApi.RNBOsproFormatPacket(packet, Dicisionpro.SPRO_APIPACKET_SIZE) == 0)
            {
                //ed.WriteMessage("  ##  ##  H0 \n");
                if (DicisionNativeApi.RNBOsproInitialize(packet) == 0)
                {
                    //ed.WriteMessage("  ##  ##  H1 \n");
                    string sDevID = "1c6d";// string variable for DevID
                    ushort DevID  = 0;
                    isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                    ushort result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                    if (result == 0)
                    {
                        //ed.WriteMessage("  ##  ##  H2 \n");
                        //ed.WriteMessage("HERE FOUND \n");
                        Answer = true;
                    }
                }
            }

            return(Answer);

            //return true;
        }
Example #2
0
        public static unsafe void ReDraw(Autodesk.AutoCAD.EditorInput.Editor ed, ObjectId entityId, RedrawMode mode)
        {
            ads_name objName = new ads_name();

            acdbGetAdsName(&objName, entityId);
            acedRedraw(&objName, (int)mode);
        }
Example #3
0
        public frmDesignProfile()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }
            InitializeComponent();
        }
Example #4
0
        /// <summary>
        /// Loading fileNames of user command files
        /// </summary>
        /// <returns>Collection of files</returns>
        private void LoadingULF()
        {
            // Write message to command window
            Autodesk.AutoCAD.EditorInput.Editor ed =
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.
                MdiActiveDocument.Editor;
            try
            {
                ed.WriteMessage("\nLoading ULF Database ...");

                // Get all userCommandFiles
                string[] ULFFiles;
                ULFFiles = eApp.EneCadRegistry.UserCommandFiles;
                foreach (string file in ULFFiles)
                {
                    string cont = System.IO.File.ReadAllText(file);
                    LoadingULF(cont);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage(ex.Message);
                ed.WriteMessage("\nLoading ULF Database unsuccessfully!");
            }
        }
        //[CommandMethod("PrintAllPressurePipes")]
        //public void PrintAllPressurePipes()
        //{
        //    ObjectIdCollection pipeIds = PipeIdsCollection();
        //}

        public static ObjectIdCollection PipeIdsCollection()
        {
            ObjectIdCollection pipeIds    = new ObjectIdCollection();
            ObjectIdCollection networkIds = CivilDocumentPressurePipesExtension.GetPressurePipeNetworkIds(CivilApplication.ActiveDocument);

            Autodesk.AutoCAD.EditorInput.Editor m_deditor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            using (Transaction trans = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
            {
                foreach (ObjectId id in networkIds)
                {
                    PressurePipeNetwork networkObj = trans.GetObject(id, OpenMode.ForRead) as PressurePipeNetwork;
                    pipeIds = networkObj.GetPipeIds();
                    foreach (ObjectId pipeId in pipeIds)
                    {
                        // Test code
                        PressurePipe pipeObj = trans.GetObject(pipeId, OpenMode.ForRead) as PressurePipe;


                        m_deditor.WriteMessage("Pipe Name: {0}\n", pipeObj.Name);
                        m_deditor.WriteMessage("Pipe Material: {0}\n", pipeObj.PipeMaterial);
                        m_deditor.WriteMessage("Pipe InnerDiameter: {0}\n", pipeObj.InnerDiameter);
                        m_deditor.WriteMessage("Pipe Network Name: {0}\n", pipeObj.NetworkName);
                        // End test

                        //args.Add(PipeRuleSignature.PipeArgument.Name, pipeObj);
                        //args.Add(PipeRuleSignature.ResultArgument.Name, result);
                        //RuleManagerInstance.InvokeRulePoint("/PipeRule", args);
                    }
                }
            }

            return(pipeIds);
        }
Example #6
0
        static private void SetDocking()
        {
            Autodesk.AutoCAD.EditorInput.Editor       e = AcadApp.DocumentManager.MdiActiveDocument.Editor;
            Autodesk.AutoCAD.EditorInput.PromptResult res;

            res = e.GetKeywords("Choose a docking option:", "None", "Left", "Right", "Top", "Bottom");
            if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                switch (res.StringResult)
                {
                case "None":
                    ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None;
                    break;

                case "Left":
                    ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
                    break;

                case "Right":
                    ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right;
                    break;

                case "Top":
                    ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Top;
                    break;

                case "Bottom":
                    ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Bottom;
                    break;
                }
            }
        }
Example #7
0
 /// <summary>
 /// Dumps the object to the console.
 /// </summary>
 /// <param name="obj"></param>
 public static void Dump(this object obj)
 {
     Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
     Autodesk.AutoCAD.EditorInput.Editor           ed  = doc.Editor;
     foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(obj))
     {
         string name  = descriptor.Name;
         object value = descriptor.GetValue(obj);
         ed.WriteMessage("\n{0}={1}", name, value);
     }
 }
Example #8
0
 private static void UpdateTableWithValues(Autodesk.AutoCAD.EditorInput.Editor editor, Table table, Transaction tr, ColumnsCollection columns)
 {
     for (int i = 1; i < int.MaxValue; i++)
     {
         try
         {
             CommonMethods.FillPiket(editor, table, tr, i);
             ProcessSmallTable(editor, table, tr, columns, i);
         }
         catch (Exception)
         {
             editor.WriteMessage("Завершение программы. Дай Бог вам здоровья\n");
             break;
         }
     }
 }
        public void UpdateScale()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;

            using (Autodesk.AutoCAD.ApplicationServices.DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                using (Transaction trans = ed.Document.Database.TransactionManager.StartTransaction())
                {
                    DBObject       obj   = trans.GetObject(this.BaseObjectId, OpenMode.ForWrite);
                    BlockReference block = (BlockReference)obj;
                    block.ScaleFactors = new Scale3d(HeatSourceLayoutApp.globalProperty.BlockScale);
                    trans.Commit();
                    trans.Dispose();
                }
            }
        }
Example #10
0
        public static void DoIt()
        {
            if (ps == null)
            {
                //use constructor with Guid so that we can save/load user data
                ps       = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("{00C0E891-C266-43e4-B95C-613255855BE1}"));
                ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load);
                ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save);
                ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton;
                ps.MinimumSize = new System.Drawing.Size(350, 300);
                ps.Add("XData Palette", new xdataForm(null));
            }
            bool b = ps.Visible;

            ps.Dock    = Autodesk.AutoCAD.Windows.DockSides.None;
            ps.Visible = true;

            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
            Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;


            //下面的主要是设置palette的一些相关属性的
            //在后面的开发中可以做一些相应的简化
            //例如,直接设置一些值
            //Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking");
            //if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            //{
            //    switch (res.StringResult)
            //    {
            //        case "Opacity":
            //            SetOpacity();
            //            break;

            //        case "TitleBarLocation":
            //            SetTitleBarLocation();
            //            break;

            //        case "Docking":
            //            SetDocking();
            //            break;
            //    }
            //}
        }
Example #11
0
        public static void FillPiket(Autodesk.AutoCAD.EditorInput.Editor editor, Table table, Transaction tr, int row)
        {
            var piketObj = editor.GetEntity("Выделите Пикет\n");

            if (piketObj.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                throw new Exception();
            }

            var piketStr = tr.GetObject(piketObj.ObjectId, OpenMode.ForRead) as DBText;

            if (table != null)

            {
                table.UpgradeOpen();
                table.Cells[row, 0].TextString = piketStr.TextString;
            }
        }
Example #12
0
        private static void ProcessSmallTable(Autodesk.AutoCAD.EditorInput.Editor editor, Table table, Transaction tr, ColumnsCollection columns, int i)
        {
            var smallTable = editor.GetEntity("Выделите малую таблицу\n");

            if (smallTable.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                throw new Exception();
            }

            var smallTableObj = tr.GetObject(smallTable.ObjectId, OpenMode.ForWrite, false) as Table;

            var numOfRow = smallTableObj.Rows.Count;

            for (int j = 1; j < numOfRow - 4; j++)
            {
                if (smallTableObj.Cells[j, 0].TextString != string.Empty)
                {
                    var grunt = smallTableObj.Cells[j, 0].TextString;
                    var area  = smallTableObj.Cells[j, 1].TextString;

                    for (int k = 1; k < columns.Count; k++)
                    {
                        var title         = table.Cells[0, k].TextString;
                        var formattedArea = area.Replace(".", ",").Replace("м2", "");
                        if (title != string.Empty)
                        {
                            if (title == grunt)
                            {
                                table.Cells[i, k].TextString = formattedArea;
                                break;
                            }
                        }
                        else
                        {
                            table.Cells[0, k].TextString = grunt;
                            table.Cells[i, k].TextString = formattedArea;
                            break;
                        }
                    }
                }
            }
        }
Example #13
0
        static private void  SetTitleBarLocation()
        {
            Autodesk.AutoCAD.EditorInput.Editor       e = AcadApp.DocumentManager.MdiActiveDocument.Editor;
            Autodesk.AutoCAD.EditorInput.PromptResult res;

            res = e.GetKeywords("Select titlebar location:", "Left", "Right");
            if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                switch (res.StringResult)
                {
                case "Left":
                    ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Left;
                    break;

                case "Right":
                    ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Right;
                    break;
                }
            }
        }
Example #14
0
        static private void  SetOpacity()
        {
            Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;

            Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt;
            do
            {
                resInt = e.GetInteger("Enter opacity:");
                if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                {
                    break;
                }
                if (resInt.Value >= 0 && resInt.Value <= 100)
                {
                    break;
                }
                e.WriteMessage("Opacity must be between 0 and 100\n");
            }while (true);

            ps.Opacity = resInt.Value;
        }
Example #15
0
        // Zooms to given objects
        public static void ZoomToObjects(Database db, IEnumerable <ObjectId> ids)
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            Extents3d outerext = new Extents3d();

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                try
                {
                    foreach (ObjectId id in ids)
                    {
                        Autodesk.AutoCAD.DatabaseServices.Entity ent = tr.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
                        Extents3d ext = ent.GeometricExtents;
                        outerext.AddExtents(ext);
                    }
                }
                catch
                {
                    ;
                }

                tr.Commit();
            }

            outerext.TransformBy(ed.CurrentUserCoordinateSystem.Inverse());
            Point2d min2d = new Point2d(outerext.MinPoint.X, outerext.MinPoint.Y);
            Point2d max2d = new Point2d(outerext.MaxPoint.X, outerext.MaxPoint.Y);

            ViewTableRecord view = new ViewTableRecord();

            view.CenterPoint = min2d + ((max2d - min2d) / 2.0);
            view.Height      = max2d.Y - min2d.Y;
            view.Width       = max2d.X - min2d.X;

            ed.SetCurrentView(view);
        }
Example #16
0
        public static void DoIt()
        {
            if (ps == null)
            {
                //use constructor with Guid so that we can save/load user data
                ps       = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set", new Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6"));
                ps.Load += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Load);
                ps.Save += new Autodesk.AutoCAD.Windows.PalettePersistEventHandler(ps_Save);
                ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton |
                           Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton;
                ps.MinimumSize = new System.Drawing.Size(300, 300);
                ps.Add("Test Palette 1", new TestControl());
            }
            bool b = ps.Visible;

            ps.Visible = true;
            Autodesk.AutoCAD.EditorInput.Editor e = AcadApp.DocumentManager.MdiActiveDocument.Editor;

            Autodesk.AutoCAD.EditorInput.PromptResult res = e.GetKeywords("Select a palette set option:", "Opacity", "TitleBarLocation", "Docking");
            if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
            {
                switch (res.StringResult)
                {
                case "Opacity":
                    Autodesk.AutoCAD.EditorInput.PromptIntegerResult resInt;
                    do
                    {
                        resInt = e.GetInteger("Enter opacity:");
                        if (resInt.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                        {
                            break;
                        }
                        if (resInt.Value >= 0 && resInt.Value <= 100)
                        {
                            break;
                        }
                        e.WriteMessage("Opacity must be between 0 and 100\n");
                    }while (true);
                    ps.Opacity = resInt.Value;
                    break;

                case "TitleBarLocation":
                    res = e.GetKeywords("Select titlebar location:", "Left", "Right");
                    if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                    {
                        switch (res.StringResult)
                        {
                        case "Left":
                            ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Left;
                            break;

                        case "Right":
                            ps.TitleBarLocation = Autodesk.AutoCAD.Windows.PaletteSetTitleBarLocation.Right;
                            break;
                        }
                    }
                    break;

                case "Docking":
                {
                    res = e.GetKeywords("Choose a docking option:", "None", "Left", "Right", "Top", "Bottom");
                    if (res.Status == Autodesk.AutoCAD.EditorInput.PromptStatus.OK)
                    {
                        switch (res.StringResult)
                        {
                        case "None":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.None;
                            break;

                        case "Left":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Left;
                            break;

                        case "Right":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right;
                            break;

                        case "Top":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Top;
                            break;

                        case "Bottom":
                            ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Bottom;
                            break;
                        }
                    }
                    break;
                }
                }
            }
        }
Example #17
0
        /// <summary>
        /// Loading Enesy Command Method (ECM) information in this assembly
        /// </summary>
        /// <param name="markedOnly">Default value: false</param>
        internal void LoadingECM(bool markedOnly)
        {
            // Write message to command window
            Autodesk.AutoCAD.EditorInput.Editor ed =
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.
                MdiActiveDocument.Editor;
            ed.WriteMessage("\nLoading ECM Database ...");

            // Just get the commands for this assembly
            Assembly asm = Assembly.GetExecutingAssembly();

            // for command category
            object[] categorys = asm.GetCustomAttributes(typeof(CommandGroup), true);
            Type[]   catTypes;
            int      catNumtypes = categorys.Length;



            // Get EnesyCommandMethod attributes
            object[] objs = asm.GetCustomAttributes(typeof(EnesyCADCommandMethod), true);
            Type[]   tps;
            int      numTypes = objs.Length;

            if (numTypes > 0)
            {
                tps = new Type[numTypes];
                for (int i = 0; i < numTypes; i++)
                {
                    CommandClassAttribute cca = objs[i] as CommandClassAttribute;
                    if (cca != null)
                    {
                        tps[i] = cca.Type;
                    }
                }
            }
            else
            {
                // If we're only looking for specifically marked CommandClasses, then use an
                // empty list
                if (markedOnly)
                {
                    tps = new Type[0];
                }
                else
                {
                    tps = asm.GetExportedTypes();
                }
            }

            // Append valid value into Database
            foreach (Type tp in tps)
            {
                MethodInfo[] meths = tp.GetMethods();
                foreach (MethodInfo meth in meths)
                {
                    objs = meth.GetCustomAttributes(typeof(EnesyCADCommandMethod), true);
                    foreach (object obj in objs)
                    {
                        EnesyCADCommandMethod attb = (EnesyCADCommandMethod)obj;
                        if (!attb.IsTest)
                        {
                            // get command category
                            object[] cats     = meth.GetCustomAttributes(typeof(CommandGroup), true);
                            string   category = "";
                            int      index    = 0;
                            foreach (object c in cats)
                            {
                                index++;
                                CommandGroup commandCat = c as CommandGroup;
                                //GLOBAL.WriteMessage("Command " + attb.GlobalName + " - Category: " + commandCat.Category);
                                category = commandCat.Category;
                            }
                            //GLOBAL.WriteMessage("\nCategory " + index + "");
                            //
                            CmdRecord cmd = new CmdRecord(attb.GlobalName,
                                                          attb.Tag,
                                                          attb.Description,
                                                          attb.Author,
                                                          attb.Email,
                                                          attb.WebLink,
                                                          category
                                                          );
                            // Check if Database contains this cmd
                            if (!this.CmdTableRecord.Contains(attb.GlobalName))
                            {
                                this.CmdTableRecord.Add(attb.GlobalName,
                                                        attb.Tag,
                                                        !String.IsNullOrEmpty(attb.Tag) ? "[" + attb.Tag + "] " + GetCommandDescription(attb.Description) : GetCommandDescription(attb.Description),
                                                        attb.Author,
                                                        attb.Email,
                                                        attb.WebLink,
                                                        category
                                                        );
                                //if (!String.IsNullOrEmpty(cat.Category))
                                //{
                                //    GLOBAL.WriteMessage("Category: " + cat.Category);
                                //}
                            }
                        }
                    }
                }
            }
            //
        }
Example #18
0
 // Regenerates the drawing window
 public static void Regen()
 {
     Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     ed.Regen();
 }
Example #19
0
 public static string GetAreaOfBoundaries(this BlockTableRecord btr, Autodesk.AutoCAD.EditorInput.Editor ed, Autodesk.AutoCAD.EditorInput.PromptPointResult pRes)
 {
     return("#");
 }
Example #20
0
        public dynamic FabDumpItem(ResultBuffer args)
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            List <string> res = new List <string>();
            ObjectId      ent;
            string        path       = "";
            int           OutputType = 3;
            dynamic       itm        = null;

            if (args != null)
            {
                TypedValue[] argarray = args.AsArray();
                if (argarray.Length >= 1 && argarray[0].TypeCode == (int)LispDataType.ObjectId)
                {
                    ent = (ObjectId)argarray[0].Value;
                    try { itm = Autodesk.Fabrication.Job.GetFabricationItemFromACADHandle(ent.Handle.ToString()); }
                    catch (System.Exception) { }
                }
                else if (argarray.Length >= 1 && argarray[0].TypeCode == (int)LispDataType.Text)
                {
                    itm = (string)argarray[0].Value;
                    if (itm.StartsWith("$") == true && VarCache.ContainsKey(hand.VariableName(itm)) == true)
                    {
                        itm = VarCache[hand.VariableName(itm)];
                    }
                }
                if (argarray.Length >= 2 && argarray[1].TypeCode == (int)LispDataType.Text)
                {
                    path = (string)argarray[1].Value;
                }
                if (argarray.Length >= 3 && argarray[2].TypeCode == (int)LispDataType.Int16)
                {
                    OutputType = Convert.ToInt32(argarray[2].Value);
                }

                if (itm != null && path.Length > 1)
                {
                    res = Sequencing.GetReflectedTypesList(itm, new List <string>(path.Split('.')));
                    if (res.Count >= 1)
                    {
                        ed.WriteMessage("\n\n");
                        foreach (string s in res)
                        {
                            if (s.StartsWith("Property:") == true)
                            {
                                if (OutputType == 1 || OutputType == 3)
                                {
                                    ed.WriteMessage(s + "\n");
                                }
                            }
                            else if (s.StartsWith("Method:") == true)
                            {
                                if (OutputType == 2 || OutputType == 3)
                                {
                                    ed.WriteMessage(s + "\n");
                                }
                            }
                        }
                    }
                }
            }
            ResultBuffer rb = new ResultBuffer();

            rb.Add(new TypedValue((int)LispDataType.ListBegin));
            foreach (string s in res)
            {
                rb.Add(new TypedValue((int)LispDataType.Text, s));
            }
            rb.Add(new TypedValue((int)LispDataType.ListEnd));
            if (OutputType >= 1 && OutputType <= 3)
            {
                return(null);
            }
            else
            {
                return(rb);
            }
        }
Example #21
0
        public static bool IsThere()
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            const ushort VALIDDATA_LENGTH          = 4;
            bool         Answer = false;

            //---- check terminal
            int allowCheck;

            allowCheck = Dicisionpro.SP_ALLOW_CHECK_TERMINAL_CLIENT;

            //if (TerminalClientCheck.Checked == true)
            if (true)
            {
                allowCheck = Dicisionpro.SP_ALLOW_CHECK_TERMINAL_CLIENT;
            }
            //ed.WriteMessage("  ##  ##  0 \n");
            //if (TerminalClientCheck.Checked == false)
            //{
            //    allowCheck = Dicisionpro.SP_DISALLOW_CHECK_TERMINAL_CLIENT;
            //}

            //----------------


            //------ set shered licence -----
            ushort shareMainLic, shareSubLic;

            //ushort status;
            shareMainLic = Dicisionpro.SP_DISABLE_MAINLIC_SHARING;
            shareSubLic  = Dicisionpro.SP_DISABLE_SUBLIC_SHARING;

            //-------------------------------

            if (DicisionNativeApi.RNBOsproFormatPacket(packet, Dicisionpro.SPRO_APIPACKET_SIZE) == 0)
            {
                //ed.WriteMessage("  ##  ##  1 \n");
                if (DicisionNativeApi.RNBOsproInitialize(packet) == 0)
                {
                    //ed.WriteMessage("  ##  ##  2 \n");
                    if (DicisionNativeApi.RNBOsproSetProtocol(packet, (int)Dicisionpro.PROTOCOL_FLAG.NSPRO_TCP_PROTOCOL) == 0)
                    {
                        //ed.WriteMessage("  ##  ##  3 \n");
                        status = RNBOsproCheckTerminalService(allowCheck);
                        //If API successfull
                        if (status == 0)
                        {
                            //ed.WriteMessage("  ##  ##  4 \n");
                            //Clear all the input text box
                            //clearTextBox_succ("CheckTerminalService");
                            string ServerName = Atend.Control.ConnectionString.LST;
                            if (DicisionNativeApi.RNBOsproSetContactServer(packet, ServerName) == 0)
                            {
                                //ed.WriteMessage("  ##  ##  5 \n");
                                string sDevID = "1c6d";// string variable for DevID
                                ushort DevID  = 0;
                                isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                                ushort result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                                if (result == 0)
                                {
                                    //ed.WriteMessage("  ##  ##  6 \n");
                                    //if (MainSharing.Checked != false)
                                    //if (true)
                                    //{
                                    //if (MainSharing.Checked == true && SubLicSharing.Checked == true)
                                    //if (true && true)
                                    //{
                                    //    shareMainLic = Superpro.SP_ENABLE_MAINLIC_SHARING;
                                    //    shareSubLic = Superpro.SP_ENABLE_SUBLIC_SHARING;
                                    //}
                                    //if (MainSharing.Checked == true && SubLicSharing.Checked == false)
                                    //////////////////if (true)
                                    //////////////////{
                                    //////////////////    shareMainLic = Dicisionpro.SP_ENABLE_MAINLIC_SHARING;
                                    //////////////////    shareSubLic = Dicisionpro.SP_DISABLE_SUBLIC_SHARING;
                                    //////////////////}
                                    //}
                                    //**************RNBOsproSetSharedLicense API **********************
                                    //////////////////////status = RNBOsproSetSharedLicense(shareMainLic, shareSubLic);
                                    ////////////////////////If API successfull
                                    //////////////////////if (status == 0)
                                    //////////////////////{
                                    //Clear all the input text box
                                    //clearTextBox_succ("SetSharedLicense");

                                    ////////////sDevID = "1c6d";// string variable for DevID
                                    ////////////DevID = 0;
                                    ////////////isValidData(sDevID.Trim(), VALIDDATA_LENGTH, ref DevID);
                                    ////////////result = DicisionNativeApi.RNBOsproFindFirstUnit(packet, DevID);
                                    ////////////if (result == 0)
                                    ////////////{

                                    //ed.WriteMessage("THERE FOUND \n");
                                    Answer = true;
                                    ////////////}

                                    ////////////////////}
                                    ////////////////////else //If API failed then
                                    ////////////////////{
                                    ////////////////////    //Display API failure message with API return code.
                                    ////////////////////    //clearTextBox_fail("SetSharedLicense", status);
                                    ////////////////////    //RNBOsproSetSharedLicense
                                    ////////////////////    ed.WriteMessage("SuperproNativeApi.RNBOsproSetSharedLicense failed \n");
                                    ////////////////////}
                                }
                                else
                                {
                                    //RNBOsproFindFirstUnit
                                    ed.WriteMessage("SuperproNativeApi.RNBOsproFindFirstUnit failed \n");
                                }
                            }
                            else
                            {
                                ed.WriteMessage("SuperproNativeApi.RNBOsproSetContactServer failed \n");
                            }
                        }
                        else //If API failed then
                        {
                            //Display API failure message with API return code.
                            //clearTextBox_fail("CheckTerminalService", status);
                            ed.WriteMessage("DicisionNativeApi.RNBOsproCheckTerminalService failed \n");
                        }
                    }
                    else
                    {
                        ed.WriteMessage("DicisionNativeApi.RNBOsproSetProtocol failed \n");
                    }
                }
                else
                {
                    ed.WriteMessage("DicisionNativeApi.RNBOsproInitialize failed \n");
                }
            }
            else
            {
                ed.WriteMessage("DicisionNativeApi.RNBOsproFormatPacket failed \n");
            }
            return(Answer);
            //return true;
        }