Jump to content
Wesley_Amsterdam

Copy text into same place but in different layer

Recommended Posts

Wesley_Amsterdam

Hi all,

 

I need to translate a selction of (130) details (all different dwg files) into 6 languages.

 

So what I wanted to do is copy all the text and paste them 6 times in the same location but all in 6 different layers. So for english the layername would be like Text_English, for German Text_German etc.

 

How would you do this?

Or maybe someone has a routine for it allready :D

 

Edit:

I already have a tool to export the text to excel and import it back into autocad after translation.

 

Gr. Wesley

Share this post


Link to post
Share on other sites
ReMark

Please refrain from double posting as it just causes confusion. Thank you.

Share this post


Link to post
Share on other sites
BIGAL

A quick put together no checking for layers existing etc.

 

(defun c:test ( / oldsnap ss x obj)
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq ss (ssget '((0 . "Text"))))
(repeat (setq x (sslength ss))
 (setq obj (ssname ss (setq x (- x 1))))
   (command "copy" obj "" "0,0" "0,0") ; repeat these 2 lines as required
   (command "chprop" "L" "" "layer" "German" "") 
)
(setvar "osmode" oldsnap)
(princ)
)

Share this post


Link to post
Share on other sites
Grrr

EDIT: Removed previous suggestion, try this instead:

[b][color=BLACK]([/color][/b]defun C:test [b][color=FUCHSIA]([/color][/b] / *error* add c svrs LayNames s enx [b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]defun add [b][color=NAVY]([/color][/b]n i[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]repeat n [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
[b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]not c[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq c 0[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]defun *error* [b][color=NAVY]([/color][/b]msg[b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b]if svrs [b][color=MAROON]([/color][/b]mapcar 'setvar [b][color=GREEN]([/color][/b]list 'cmdecho 'clipromptlines[b][color=GREEN])[/color][/b] svrs[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ[b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]setq LayNames [color=#8b4513]; type your languages here [b][color=NAVY]([/color][/b][color=#2f4f4f]"Text_"[/color] prefix will be added automatically[b][color=NAVY])[/color][/b][/color]
	[b][color=NAVY]([/color][/b]list
		[color=#2f4f4f]"English"[/color] [color=#2f4f4f]"German"[/color] [color=#2f4f4f]"Spanish"[/color]
		[color=#2f4f4f]"Russian"[/color] [color=#2f4f4f]"Serbian"[/color] [color=#2f4f4f]"Bulgarian"[/color]
	[b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]setq svrs [b][color=NAVY]([/color][/b]mapcar 'getvar [b][color=MAROON]([/color][/b]list 'cmdecho 'clipromptlines[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
[b][color=FUCHSIA]([/color][/b]mapcar 'setvar [b][color=NAVY]([/color][/b]list 'errno 'cmdecho 'clipromptlines[b][color=NAVY])[/color][/b] '[b][color=NAVY]([/color][/b]0 0 2[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]mapcar
	[b][color=NAVY]([/color][/b]function
		[b][color=MAROON]([/color][/b]lambda [b][color=GREEN]([/color][/b]x / [b][color=GREEN])[/color][/b]
			[b][color=GREEN]([/color][/b]or
				[b][color=BLUE]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] x[b][color=BLUE])[/color][/b]
				[b][color=BLUE]([/color][/b]progn
					[b][color=RED]([/color][/b]entmakex
						[b][color=PURPLE]([/color][/b]list
							[b][color=TEAL]([/color][/b]cons 0 [color=#2f4f4f]"LAYER"[/color][b][color=TEAL])[/color][/b]
							[b][color=TEAL]([/color][/b]cons 100 [color=#2f4f4f]"AcDbSymbolTableRecord"[/color][b][color=TEAL])[/color][/b]
							[b][color=TEAL]([/color][/b]cons 100 [color=#2f4f4f]"AcDbLayerTableRecord"[/color][b][color=TEAL])[/color][/b]
							[b][color=TEAL]([/color][/b]cons 2 x[b][color=TEAL])[/color][/b]
							[b][color=TEAL]([/color][/b]cons 70 0[b][color=TEAL])[/color][/b]
							[b][color=TEAL]([/color][/b]cons 62 [b][color=OLIVE]([/color][/b]setq c [b][color=GRAY]([/color][/b]add 15 c[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b]
						[b][color=PURPLE])[/color][/b]
					[b][color=RED])[/color][/b]
					[b][color=RED]([/color][/b]princ [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"\nCreated layer: "[/color] x [color=#2f4f4f]" !"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
				[b][color=BLUE])[/color][/b]
			[b][color=GREEN])[/color][/b][color=#8b4513]; or[/color]
		[b][color=MAROON])[/color][/b]
	[b][color=NAVY])[/color][/b]	 
	[b][color=NAVY]([/color][/b]setq LayNames [b][color=MAROON]([/color][/b]mapcar '[b][color=GREEN]([/color][/b]lambda [b][color=BLUE]([/color][/b]x[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"Text_"[/color] x[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] LayNames[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]/= 52 [b][color=MAROON]([/color][/b]getvar 'errno[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b]setq s [b][color=MAROON]([/color][/b]vl-catch-all-apply [b][color=GREEN]([/color][/b]function ssget[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"_+.:E:S"[/color] [b][color=BLUE]([/color][/b]list [b][color=RED]([/color][/b]cons 0 [color=#2f4f4f]"*TEXT"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect Text to Copy above the different layers"[/color][b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b]cond
		[b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]or [b][color=BLUE]([/color][/b]= 7 [b][color=RED]([/color][/b]getvar 'errno[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]null s[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
			[b][color=GREEN]([/color][/b]princ [color=#2f4f4f]"\nYou missed, try again!"[/color][b][color=GREEN])[/color][/b]
			[b][color=GREEN]([/color][/b]setvar 'errno 0[b][color=GREEN])[/color][/b]
		[b][color=MAROON])[/color][/b]
		[b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]not [b][color=BLUE]([/color][/b]vl-catch-all-error-p s[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
			[b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]setq enx [b][color=RED]([/color][/b]entget [b][color=PURPLE]([/color][/b]ssname s 0[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
				[b][color=BLUE]([/color][/b]progn
					[b][color=RED]([/color][/b]setq s nil[b][color=RED])[/color][/b]
					[b][color=RED]([/color][/b]foreach x LayNames 
						[b][color=PURPLE]([/color][/b]entupd 
							[b][color=TEAL]([/color][/b]entmakex
								[b][color=OLIVE]([/color][/b]subst [b][color=GRAY]([/color][/b]cons 8 x[b][color=GRAY])[/color][/b] [b][color=GRAY]([/color][/b]assoc 8 enx[b][color=GRAY])[/color][/b] enx[b][color=OLIVE])[/color][/b]
							[b][color=TEAL])[/color][/b]
						[b][color=PURPLE])[/color][/b]
					[b][color=RED])[/color][/b]
					[b][color=RED]([/color][/b]princ [color=#2f4f4f]"\nCopied the layers above the selected text !"[/color][b][color=RED])[/color][/b]
				[b][color=BLUE])[/color][/b]
			[b][color=GREEN])[/color][/b]
		[b][color=MAROON])[/color][/b]
		[b][color=MAROON]([/color][/b]T [b][color=GREEN]([/color][/b]setvar 'errno 52[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
	[b][color=NAVY])[/color][/b][color=#8b4513]; cond[/color]
[b][color=FUCHSIA])[/color][/b][color=#8b4513]; while[/color]
[b][color=FUCHSIA]([/color][/b]if svrs [b][color=NAVY]([/color][/b]mapcar 'setvar [b][color=MAROON]([/color][/b]list 'cmdecho 'clipromptlines[b][color=MAROON])[/color][/b] svrs[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]princ[b][color=FUCHSIA])[/color][/b]
[b][color=BLACK])[/color][/b][color=#8b4513]; defun						[/color]

Still theres a issue, since the user can't exit the selection loop by pressing ENTER .. but I'm lazy to figure it out.

Edited by Grrr

Share this post


Link to post
Share on other sites
Roy_043

@Grrr:

 

Hmm...

(add 11 15) => 26

(+ 11 15) => 26

Share this post


Link to post
Share on other sites
Roy_043
.. but I'm lazy to figure it out.
That is a pity.

Share this post


Link to post
Share on other sites
Wesley_Amsterdam

Thnx Grrr!

This is a great start.

 

in order to use this in a script, I would like to skip the selection of each text bij selecting all text in the drawing which is in a certain layer.

So how do i implement the following in the script above?

 

(setq s (ssget "x" '((0 . "TEXT,MTEXT")(8 . "AAc-0-TEXT"))))

Share this post


Link to post
Share on other sites
Grrr
@Grrr:

 

Hmm...

(add 11 15) => 26

(+ 11 15) => 26

 

Thanks, at first I tried to use the 1+ function, and completely forgot about the DIESEL functions.

Btw I have everytime this "exit with enter" issue, while forcing the user to select.

Unfortunately from where I write these codes, I can't test this behaviour (although I try any kind of checks like: vl-catch-error-p sslength (= 'pickset (type ...)).

Share this post


Link to post
Share on other sites
BIGAL

Wesley just replace the ssget line in my code above with yours ICalled the selection set ss so easiest is change you "s" to ss

 

Add the two lines for the other languages required required.

 

Again I have not put in the add new layer names it's quick to do anyway.

 

Grr your code is a bit long winded, no disrespect, Not sure about a couple of things in it ? Clippromptlines

 

Grr a little trick if you use command -la m layer1 m layer2 etc if it exists you do not get an error and lisp will continue whilst this is not really good programming it's quick and simple.

Your correct the chprop show my age.

 

I hate iPads makes my typing even worse.

Edited by BIGAL

Share this post


Link to post
Share on other sites
BIGAL

A script is just that a Lisp is also just that. A Vba is a Visual Basic program a c# is also a high level language now preferred is .Net

 

Sorry but so many now call lisp coding a script.

Share this post


Link to post
Share on other sites
BIGAL

No worries just

 

open dwg1 (load "your lisp") close y

Repeat using Lee,s script writer to find files.

 

Just post again if stuck between Grr and me sure we can provide you with something.

Share this post


Link to post
Share on other sites
Wesley_Amsterdam

Bigal,

 

It's having issues when there is a text in the paperspace.

Can we let it do the trick only for text in modelspace?

:-)

Edited by Wesley_Amsterdam

Share this post


Link to post
Share on other sites
Grrr

BigAl,

I use clipromptlines to strip out the unneeded lines from the console, while the user is prompted for the selection.

Usually I prefer this variable to be at value 4 (for any AutoCAD command-call prompts),

but while using the code I posted, its enough to be at value 2, otherwise

one may be spammed with "Select Objects:" and "Select Text to Copy above the different layers" messages:

 

clipromptlines.jpg

 

I have nothing against using the "_.chprop" or "_.layer" commands,

but was advised by Tharwat to skip any command calls if I can - for a more proffesional code (and I agree with him).

Altough I think that any proffesional AutoLISP programmer must be aware of any commands (incase he has to deal without VLISP).

 

As for the length of the code, it could be shortened by (indenting?/folding) the syntaxes - not sure how do programmers call this.

I try to keep my formatting with a maximum readability (for certain "blocks")

of the codes I'm posting (especially when I have questions - which is almost always) altough their length.

 

Don't worry, keep asking if you have more questions (My elephant memory still remembers when you taught me about using progn ;) )

BTW, this is not the first thread where I understand easier your reply-code than what OP is asking for.

 

Wesley,

Try this (it only requires calling the command in the certain tab):

[b][color=BLACK]([/color][/b]defun C:test [b][color=FUCHSIA]([/color][/b] / LayNames c SSX cnt [b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]setq LayNames [color=#8b4513]; type your languages here [b][color=NAVY]([/color][/b][color=#2f4f4f]"Text_"[/color] prefix will be added automatically[b][color=NAVY])[/color][/b][/color]
	[b][color=NAVY]([/color][/b]list
		[color=#2f4f4f]"English"[/color] [color=#2f4f4f]"German"[/color] [color=#2f4f4f]"Spanish"[/color]
		[color=#2f4f4f]"Russian"[/color] [color=#2f4f4f]"Serbian"[/color] [color=#2f4f4f]"Bulgarian"[/color]
	[b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]mapcar [b][color=NAVY]([/color][/b]function [b][color=MAROON]([/color][/b]lambda [b][color=GREEN]([/color][/b]x / [b][color=GREEN])[/color][/b]
	[b][color=GREEN]([/color][/b]or [b][color=BLUE]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] x[b][color=BLUE])[/color][/b]
		[b][color=BLUE]([/color][/b]progn
			[b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]not c[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]setq c 0[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
			[b][color=RED]([/color][/b]entmakex [b][color=PURPLE]([/color][/b]list
				[b][color=TEAL]([/color][/b]cons 0 [color=#2f4f4f]"LAYER"[/color][b][color=TEAL])[/color][/b]
				[b][color=TEAL]([/color][/b]cons 100 [color=#2f4f4f]"AcDbSymbolTableRecord"[/color][b][color=TEAL])[/color][/b]
				[b][color=TEAL]([/color][/b]cons 100 [color=#2f4f4f]"AcDbLayerTableRecord"[/color][b][color=TEAL])[/color][/b]
				[b][color=TEAL]([/color][/b]cons 2 x[b][color=TEAL])[/color][/b]
				[b][color=TEAL]([/color][/b]cons 70 0[b][color=TEAL])[/color][/b]
				[b][color=TEAL]([/color][/b]cons 62 [b][color=OLIVE]([/color][/b]setq c [b][color=GRAY]([/color][/b]+ c 15[b][color=GRAY])[/color][/b][b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][color=#8b4513];<- Roy was here[/color]
			[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]princ [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"\nCreated layer: "[/color] x [color=#2f4f4f]" !"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
		[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq LayNames [b][color=MAROON]([/color][/b]mapcar '[b][color=GREEN]([/color][/b]lambda [b][color=BLUE]([/color][/b]x[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"Text_"[/color] x[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] LayNames[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]setq SSX [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"_X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=BLUE]([/color][/b]cons 8 [color=#2f4f4f]"AAc-0-TEXT"[/color][b][color=BLUE])[/color][/b][b][color=BLUE]([/color][/b]cons 410 [b][color=RED]([/color][/b]getvar 'ctab[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b] [color=#8b4513]; this time decided to use [b][color=MAROON]([/color][/b]lambda[b][color=MAROON])[/color][/b] [/color]
		[b][color=MAROON]([/color][/b]lambda [b][color=GREEN]([/color][/b] i / e enx [b][color=GREEN])[/color][/b][color=#8b4513]; <- should these arguments be included in the main function [b][color=GREEN]([/color][/b]c:test[b][color=GREEN])[/color][/b] ?[/color]
			[b][color=GREEN]([/color][/b]repeat i
				[b][color=BLUE]([/color][/b]setq e [b][color=RED]([/color][/b]ssname SSX [b][color=PURPLE]([/color][/b]setq i [b][color=TEAL]([/color][/b]1- i[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [color=#8b4513]; reverse iteration[/color]
				[b][color=BLUE]([/color][/b]setq enx [b][color=RED]([/color][/b]entget e[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
				[b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]not cnt[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setq cnt 0[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
				[b][color=BLUE]([/color][/b]foreach x LayNames 
					[b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]entmakex [b][color=TEAL]([/color][/b]subst [b][color=OLIVE]([/color][/b]cons 8 x[b][color=OLIVE])[/color][/b] [b][color=OLIVE]([/color][/b]assoc 8 enx[b][color=OLIVE])[/color][/b] enx[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=PURPLE]([/color][/b]setq cnt [b][color=TEAL]([/color][/b]1+ cnt[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
				[b][color=BLUE])[/color][/b]
			[b][color=GREEN])[/color][/b]
		[b][color=MAROON])[/color][/b]
		[b][color=MAROON]([/color][/b]sslength SSX[b][color=MAROON])[/color][/b]
	[b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]
[b][color=FUCHSIA]([/color][/b]if cnt [b][color=NAVY]([/color][/b]princ [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"\nCopied/created above "[/color] [b][color=GREEN]([/color][/b]itoa cnt[b][color=GREEN])[/color][/b] [color=#2f4f4f]" total of text/mtext objects in the \"[/color][color=#2f4f4f]" [b][color=GREEN]([/color][/b]getvar 'ctab[b][color=GREEN])[/color][/b] "[/color]\[color=#2f4f4f]" tab!"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
	[b][color=NAVY]([/color][/b]princ [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"\nNo text/mtext objects found in the \"[/color][color=#2f4f4f]" [b][color=GREEN]([/color][/b]getvar 'ctab[b][color=GREEN])[/color][/b] "[/color]\[color=#2f4f4f]" tab!"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
[b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]princ[b][color=FUCHSIA])[/color][/b]
[b][color=BLACK])[/color][/b][color=#8b4513]; defun[/color]

For this one I think theres no need to set/reset system variables.

But I'm not sure where the e enx and cnt must be included as arguments - inside lambda / inside the main function / or both ? Seems to work this way.

 

Sorry for the late reply, I was at work.

Share this post


Link to post
Share on other sites
Lee Mac

FWIW, if the OP doesn't require specific layer properties, the code could be reduced to:

(defun c:test ( / e i l s )
   (setq l
      '(
           "English"
           "German"
           "Spanish"
           "Russian"
           "Serbian"
           "Bulgarian"
       )
   )
   (if (setq s (ssget "_X" '((0 . "TEXT,MTEXT") (8 . "AAC-0-TEXT"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i)))))
           (foreach x l (entmake (subst (cons 8 (strcat "Text_" x)) (assoc 8 e) e)))
       )
   )
   (princ)
)

Share this post


Link to post
Share on other sites
Grrr

Hi Lee,

Could you write this SS iteration, using (lambda) ? Few days ago I was exploring a very interesting thread about mapcar and lambda (OP's nickname was "Sweety") and there were your awesome explanations about it.

However I couldn't figure out where the variables must be located: 1. inside the (lambda) 2. inside the main (defun) 3. both

Heres my breakdown few days ago:

; The differences between (defun) and (lambda):

; DEfineFUNction
; main defun structure (defined function by its <symbol>):
(defun <symbol> ( [arguments] [/ variables] )
<expressions>
); defun

; main lambda structure (anonymous function):
(
(lambda ( [arguments] [/ variables] )
	<expressions> ;(do stuff)
); lambda
[values for the arguments] ;<- I think it may be a single value or a list of values
)

(mapcar (quote/function <defun's symbol>) (list))
(mapcar (quote/function <lambda function>) (list))

Sorry for the offtopic - but I think that Wesley's request should be solved by now.

Share this post


Link to post
Share on other sites
Wesley_Amsterdam

Thnx everyone!

 

Lee Mac's code is the fastest of all.

 

So, if nobody has a lisp to traslate everything to Spanish French Italian and German, I will get started translating that (exept for the Russian part :-) )...

Share this post


Link to post
Share on other sites
Grrr

To suggest an even more complex idea, it would be possible to substitute the source text with a new translated via already created assoc list.

Share this post


Link to post
Share on other sites
BIGAL

Grr using Lee's parse CSv you would make a list of the words seperated by a space then compare each word with other language make a new string and replace. Keep the word list as a file on its own 2 bits of info original other per line. Just use a load

; mini lsp
(setq lstfrench (list 
word1 word1french
.........
)

 

Wesley need a sample data say 5 words each language.

 

Making use of defuns would simplify the repetitive nature of the problem.

Share this post


Link to post
Share on other sites
Wesley_Amsterdam

No worries guys, it is too much to translate via LISP.

All the details are different so not much repetition in the text.

 

I will export all the text from one drawing to an excel file.

Then translate it

Then import it from excel back to autocad.

 

and all that 130 times :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×