예제 #1
0
 public static void SetComputationalCADRegistryValue(string name, string value)
 {
     try
     {
         RegistryKey registryKey = Reg.ComputationalCADRegistryKey();
         registryKey.SetValue(name, value, RegistryValueKind.String);
     }
     catch (System.Exception ex)
     {
         throw new System.Exception("Can not write setting " + name + ": " + ex.Message);
     }
 }
예제 #2
0
 public static void RegisterComputationalCADVersion(string currentVersion)
 {
     try
     {
         RegistryKey registryKey = Reg.GetCurrentProductKey(true);
         registryKey = registryKey.CreateSubKey("Applications\\TCPlugin", RegistryKeyPermissionCheck.ReadWriteSubTree);
         registryKey.SetValue("LastUsedVersion", currentVersion, RegistryValueKind.String);
     }
     catch (System.Exception ex)
     {
         throw new System.Exception("TCPlugin could not register current version." + Environment.NewLine + ex.Message);
     }
 }
예제 #3
0
        public static string GetComputationalCADRegistryValue(string name)
        {
            string result;

            try
            {
                RegistryKey registryKey = Reg.ComputationalCADRegistryKey();
                result = (string)registryKey.GetValue(name);
            }
            catch (System.Exception ex)
            {
                throw new System.Exception("Can not read setting " + name + ": " + ex.Message);
            }
            return(result);
        }
예제 #4
0
        public void GenerateSubDMeshCommand()
        {
            Database arg_05_0 = HostApplicationServices.WorkingDatabase;
            Editor   editor   = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                if (!Reg.Is2010OrHigher())
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("This method is supported only for version 2010 or higher.");
                }
                else
                {
                    ObjectId[] array = CommandLineQuerries.SelectFaces(false);
                    string     text  = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("SMOOTHMESHMAXFACE").ToString().Trim();
                    if (array.Length > Convert.ToInt32(text))
                    {
                        throw new InvalidOperationException(string.Concat(new object[]
                        {
                            "\nERROR: you have selected ",
                            array.Length.ToString(),
                            " faces while an allowable maximum of ",
                            text,
                            " is specified in the SMOOTHMESHMAXFACE system variable. Please set the SMOOTHMESHMAXFACE system variable at least to ",
                            array.Length,
                            " or select fewer faces."
                        }));
                    }
                    CMD_FacesToMesh.string_0 = CommandLineQuerries.KeywordYesNo("Delete original faces", CMD_FacesToMesh.string_0, false, false);
                    List <Triangle>         triangles = Conversions.ToCeometricAcDbTriangleList(array);
                    List <List <Triangle> > list      = this.method_0(triangles);
                    for (int i = 0; i < list.Count; i++)
                    {
                        SubDMeshHandler subDMeshHandler = new SubDMeshHandler(list[i]);
                        SubDMeshHandler.MeshGenerationResult meshGenerationResult = subDMeshHandler.GenerateSubDMesh();
                        editor.WriteMessage("\nMesh " + i.ToString().PadLeft(4) + ":\n" + meshGenerationResult.ToString());
                    }
                    if (CMD_FacesToMesh.string_0 == "Y")
                    {
                        DBManager.EraseObjects(array, 100000);
                    }
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message);
            }
        }
예제 #5
0
 public void OpenHelp_Command()
 {
     try
     {
         string text  = Reg.GetInstallationFolder() + "\\ComputationalCAD_Help.chm";
         IntPtr value = CMD_Help.HtmlHelp((IntPtr)0, text, 1u, 0);
         if (value == IntPtr.Zero)
         {
             Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("No help file available for TCPlugin at " + text);
         }
     }
     catch (System.Exception ex)
     {
         Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Could not determine TCPlugin installation path:" + Environment.NewLine + ex.Message);
     }
 }
예제 #6
0
        public static string GetInstallationFolder()
        {
            string directoryName;

            try
            {
                RegistryKey registryKey = Reg.GetCurrentProductKey(false);
                registryKey   = registryKey.OpenSubKey("Applications\\TCPlugin");
                directoryName = Path.GetDirectoryName(registryKey.GetValue("LOADER").ToString());
            }
            catch (System.Exception ex)
            {
                throw new System.Exception("Can not determine TCPlugin installation path:" + Environment.NewLine + ex.Message);
            }
            return(directoryName);
        }
예제 #7
0
 public void Initialize()
 {
     if (Reg.GetMenuLoaderState())
     {
         try
         {
             BackgroundWorker backgroundWorker = new BackgroundWorker();
             backgroundWorker.DoWork += new DoWorkEventHandler(this.method_0);
             backgroundWorker.RunWorkerAsync();
         }
         catch (System.Exception ex)
         {
             Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
             editor.WriteMessage("\nError: " + ex.ToString());
         }
     }
 }
예제 #8
0
        private void method_3()
        {
            Editor arg_0F_0 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            string suffix   = ".cui";

            if (Reg.Is2010OrHigher())
            {
                suffix = ".cuix";
            }
            this.string_1 = string.Empty;
            this.string_1 = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("MENUNAME") + suffix;
            if (!File.Exists(this.string_1))
            {
                throw new FileNotFoundException("Main ACAD menu cui file not found: \n" + this.string_1);
            }
            FileInfo fileInfo = new FileInfo(this.string_1);

            this.string_2 = Path.Combine(fileInfo.DirectoryName, "TCPlugin" + suffix);
            string installationFolder = Reg.GetInstallationFolder();

            this.cuiPath = Path.Combine(installationFolder, "TCPlugin" + suffix);
        }
예제 #9
0
        public static string GetLastUsedComputationalCADVersion()
        {
            string result;

            try
            {
                RegistryKey registryKey = Reg.GetCurrentProductKey(false);
                registryKey = registryKey.OpenSubKey("Applications\\TCPlugin");
                try
                {
                    result = registryKey.GetValue("LastUsedVersion").ToString();
                }
                catch
                {
                    result = "";
                }
            }
            catch (System.Exception ex)
            {
                throw new System.Exception("Can not determine last used TCPlugin version:" + Environment.NewLine + ex.Message);
            }
            return(result);
        }