Search the Community
Showing results for tags 'special characters'.
-
Problem renaming special characters in Layers
gustavobernardi posted a topic in AutoLISP, Visual LISP & DCL
Hi, Why sometimes this operation returns wrong: (defun c:cvt() (setq oldname "ESP - Esquadrias CIR")(setq newname "ANT - Esquadria Círculo")(runtorenamelayer) ) (defun runtorenamelayer() (if (and(tblsearch "layer" oldname)(not(tblsearch "layer" newname))) (COMMAND "._-RENAME" "LA" OLDNAME NEWNAME);;(command "._-layer" "R" oldname newname "") ) (if (and(tblsearch "layer" oldname)(tblsearch "layer" newname)) (progn (command "Laymrg") (foreach e (list oldname) (if (tblsearch "LAYER" e)(command "_Name" e)))(command "" "_N" newname "_Y") ;;(command "_.-PURGE" "_La" oldname "_N") ) ) (princ) ) Being specific, if I load the code with the appload or even in the ACAD.LSP the problem occurs. And the result is a strange name: ANT - Esquadria CÃrculo If I just copy and paste the code into the command bar it works fine and te name is ok: ANT - Esquadria Círculo Ok, I am thinking about avoiding special characters in the new Layer names, but in some cases the old layers have them already, and in this situation the operation doesn't rename that old layers, the application just skip them because the names doesn't match. TIA -
Hi folks My target was to do a little routine that creates layouts for the views and sets page setups for these layouts. Name of the page setup is asked from the user before making the layouts and I try to use PromptKeywordOptions so that user can only select existing page setups. And here comes the problem. If there is underscore (_) or more in the page setup's name and I type that name, I get error "Invalid option keyword." in the command line. When I messed with page setup manager and tried to rename setups with special characters, I got the following message: "The following characters are not supported: \ / ? " : ; * | , = `". but there are no mention about the underscore. How do I select the name with underscore or do I have to replace all underscores from my page setup names? Here is the routine for selecting page setup: using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using System; using System.Collections.Generic; namespace CAD { public class PageSetupSelector { Document doc; [CommandMethod("SelectPageSetup")] public void SelectPageSetup() { doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; using (Transaction trans = db.TransactionManager.StartTransaction()) { DBDictionary pageSetups = (DBDictionary)trans.GetObject(db.PlotSettingsDictionaryId, OpenMode.ForRead); List<string> setupNames = new List<string>(); doc.Editor.WriteMessage("\nPage setups:"); foreach (DBDictionaryEntry entry in pageSetups) { doc.Editor.WriteMessage("\n {0}", entry.Key); setupNames.Add(entry.Key); } if (pageSetups.Count > 0) { string question = "\nSelect pagesetup: "; string answer = AskKeywordFromUser(question, setupNames.ToArray(), setupNames[0]); doc.Editor.WriteMessage("\nSelected setup: {0} ", answer); } trans.Abort(); } } protected string AskKeywordFromUser(string question, string[] words, string defaultWord) { PromptKeywordOptions pko = new PromptKeywordOptions(""); pko.Message = question; pko.AllowNone = false; foreach (string word in words) { pko.Keywords.Add(word); } pko.Keywords.Default = defaultWord; PromptResult pr = doc.Editor.GetKeywords(pko); if (pr.Status != PromptStatus.OK) { return String.Empty; } return pr.StringResult; } } } And here is the output from the command line: Page setups: test-A3 test_A3 Select pagesetup [test-A3/test_A3] <test-A3>: test_A3 Invalid option keyword. Select pagesetup [test-A3/test_A3] <test-A3>: "test_A3" Invalid option keyword. Select pagesetup [test-A3/test_A3] <test-A3>: 'test_A3' Invalid option keyword. Select pagesetup [test-A3/test_A3] <test-A3>: Selected setup: test-A3
- 1 reply
-
- special characters
- promptkeywordoptions
-
(and 1 more)
Tagged with:
-
how to get to the power of ???
mkv123 posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
here it is if i want to put m (cube) is there is any way to put m^3 in autocad as it is in unit.how to get special characters in autocad....- 13 replies
-
- special characters
- meter cube unit
-
(and 1 more)
Tagged with: