Jump to content

Recommended Posts

Posted

Hello,

I live in Austria.

 

If I execute a Lisp written in English and it does not contain "_" (underline) in the program it is very

Effortlessly enter all the underlines in a longer Lisp by hand.

Is there a faster solution for this?

Please help.

 

Example:

(Command "copy" unit1 "" "m" p2 p6 p22 p23 "") ;;;; without underlines

(Command "_copy" unit1 "" "_m" p2 p6 p22 p23 "") ;;; With underscores

 

Martin

Posted

Hi,

 

The underscore prefix has nothing to do with fast process or anything else other than it ensures is that the command name is used in English if you are using None-English release of AutoCAD.

 

Furthermore, to avoid changing the name of the command call within your lisp file to the language of your AutoCAD Program. eg: 'copy' to 'kopiëren'

Posted (edited)

@martinle:

In Notepad++ you can use regular expressions to search and replace texts.

 

> Notepad++ > Replace...
 > Find what: [b]\(\s*command\s*"(?!\._|_\.|_)[/b]
 > Replace with: [b]\(command "_[/b]
 > [ ] Match case
 > [[b]v[/b]] Wrap around
 > Search mode > [[b]*[/b]] Regular expression

Edited by Roy_043
Posted

Hello tharwat, I am looking for a lisp translation of English in German which automatically sets the underscores.

 

Martin

Posted

Hello roy, I use notepad ++, but it is rather tedious to change everything individually

 

Martin

Posted

Like Roy_043 use word and make a macro and just do a number of "replace", after coding just be carefull when saving as you can make a DOC not a TXT. Just do one and then you can copy it and edit etc Below is directly from Word record macro

' this example from word replaces all lower case b with a uppercase B 
' depending on your word "View" "macros"
Sub Macro1()
'
' Macro1 Macro
'
'
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = "b"
       .Replacement.Text = "B"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Posted

@martinle:

Using the regular expressions in my previous post *ALL* commands will be fixed at once. Just try it.

 

@BIGAL:

It is not a simple case of exchanging one character. Command names may already have a "_" or "_." or "._" prefix. See the 'Find what:' regular expression.

Posted

Hello roy, I will try it when I am on Monday again at work. But I can not yet understand their explanation. Excuse me.

 

Martin

Posted

Note that my suggestion will only change command names not command options.

So:

(Command "copy" unit1 "" "m" p2 p6 p22 p23 "")

Will become:

(command "_copy" unit1 "" "m" p2 p6 p22 p23 "")

Posted

@Roy, you may want to include a double-quote in the negative-lookahead, to avoid (command "") being changed to (command "_")

Posted

Roy_043 as I suggested using Word you make a macro with a number of changes then you do not have to remember all the typing save a blank DOC. This way it would be all done in one go. As Word macro's are VBA you could read a file with the replace options.

Posted

@Lee: you are right. Thanks.

 

Improved version:

Find what (Suchen nach): \(\s*command\s*"(?!\._|_|")

Replace with (Ersetzen durch): \(command "_

 

Alternative (also works for command options):

Find what (Suchen nach): "(?!\._|_|\s|\)|")

Replace with (Ersetzen durch): "_

Note: Since this regular expression matches not just command names and options, replace matches one at a time.

Posted

Nice one Roy :thumbsup:

 

The following could be used to also account for the use of vl-cmdf:

 

Find:    \(\s*(command|vl\-cmdf)\s*"(?!\._|_\.|_|")
Replace: \($1 "_

Posted

Thanks to all of you for the great support. I'll try it out at work tomorrow. Maybe I manage to change the command and the options in one piece.? I hope!

 

Martin

Posted

Hello, have it tested and it makes me a lot of work. Many thanks. It works wonderfully!

 

Martin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...