Jump to content

Recommended Posts

Posted

Dears,

AUTOLIPS works on the english version but i want to use it on the frensh version, any kind of support

 

Thanks

Posted

The base commands are the same, AutoCAD was written in English, however might be that you need to translate some parts.

 

For example in your LISPs if you have a line such as (command "LINE" .... ) you might want to translate "Line" to the French language or add an underscore to specify that this is the native English command (command "_line" .... ) or (command "LIGNE" ..... ) 

 

Might be you have to work through them one at a time as you use them to do the conversion. Post one on here and we can work through it with you, show you what you need to do

 

A quick internet search brought this up t show he different language commands:

https://www.cadforum.cz/en/command.asp?lan=FR

and note that this is for what you'd type in the command line. Not sure how it works for vla- commands and so on if there are different languages for them

 

 

Anyway, post one and see

  • Like 1
Posted

this is the code thanks for the help

i want o used it in the frensh version of autocad

-----------------------------------------------------------------------------

(defun C:AREARON (/
          allx
          ally
          areaobj
          counter
          ctr
          el
          entity-name
          entnamevla
          mysset
          pt
          tst
          vertex
          x
          y
         )
  (vl-load-com)
  (COMMAND "_.UNDO" "BE")
  (set_var)
  (if (tblsearch "Layer" "AREARON")
    (command "._layer"
         "_thaw"
         "AREARON"
         "_on"
         "AREARON"
         "_unlock"
         "AREARON"
         "_set"
         "AREARON"
         ""
    ) ;_ closes command
    (command "._layer"
         "_make"
         "AREARON"
         "_color"
         1
         "AREARON"
         ""
    ) ;_ closes command
  )
  (if (null sch)
    (setq sch 1.0)
  )
  (initget 6)
  (setq    temp (getreal (strcat "\nENTER SCALE <"
                  (rtos sch 2 2)
                  ">: "
              )
         )
  )
  (if temp
    (setq sch temp)
    (setq temp sch)
  )

  (if (null precision)
    (setq precision 1)
  )
  (initget 6)
  (setq    prec_temp (getint (strcat "\nHOW MANY DECIMAL PLACES?: <"
                  (rtos precision 2 2)
                  ">: "
              )
          )
  )
  (if prec_temp
    (setq precision prec_temp)
    (setq prec_temp precision)
  )
  (prompt "\nSELECT CLOSED POLYLINES:> ")
  (setq
    mysset  (ssget '((0 . "POLYLINE,LWPOLYLINE") (-4 . "&") (70 . 1)))
    counter 0
  )
  (if mysset
    (progn
      (while (< counter (sslength mysset))
    (setq allx      0
          ally      0
          ctr      0
          tst      1
          entity-name (ssname mysset counter)
          EL      (entget entity-name)
          entnamevla  (vlax-ename->vla-object entity-name)
          areaobj      (vla-get-area entnamevla)
    )
    (while (assoc 10 el)
      (setq    vertex (cdr (assoc 10 el))
        ctr    (+ ctr 1)
        x      (car vertex)
        y      (cadr vertex)
        allx   (+ allx x)
        ally   (+ ally y)
        EL     (cdr (member (assoc 10 el) el))
      )
    )
    (setq x     (/ allx ctr)
          y     (/ ally ctr)
          pt (list x y)
    )
    (command "text" "j" "mc"
         pt
         (* sch 2.5)
         "0"
         (rtos areaobj 2 precision)
    )
    (setq counter (+ counter 1))
      )
    )
    (alert "\nNO CLOSED POLYLINES/LWPOLYLINES IN YOUR SELECTION"
    )
  )
  (reset_var)
  (princ)
(COMMAND "_.UNDO" "END")
)
(princ)


(defun set_var ()
  (setq oldlayer (getvar "clayer"))
  (setq oldsnap (getvar "osmode"))
  (setq temperr *error*)
  (setq *error* traperror)
  (setvar "osmode" 0)
  (princ)
)


(defun traperror (errmsg)
  (command nil nil nil)
  (if (not (member errmsg '("console break" "Function Cancelled"))
      )
    (princ (strcat "\nError: " errmsg))
  )
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (princ "\nError Resetting Enviroment ")
  (setq *error* temperr)
  (princ)
)

(defun reset_var ()
  (setq *error* temperr)
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (princ)
)
 

  • Like 1
Posted

Composez en langage international (par défaut en Anglais)
Tous les appels à commande (ainsi que les options) devront se faire avec un souligné. Ex: (command "Calque" "Etablir" ...) devrait devenir (command "_.-layer" "_set" ...)
Le tiret sert à éviter (généralement)l'appel de la commande en boite de dialogue, bien que dans un code en lisp l'appel de la boite de dialogue est généralement ignoré.
Le point sert à appeler la commande native au cas ou la commande aurait été redéfinie: commande "Nondef" (_UNDEFINE)
Le souligné sert pour appeler la commande internationale. Si employé la commande sera reconnue sur n'importe quelle version linguistique : Espagnole, Française, Allemande, Italienne , etc ...


Une astuce pour connaître la commande anglaise: (getcname "Calque") -> "_Layer"
Pour les options c'est plus subtil: lancer la commande en Français puis l'option choisie, faite alors Echapp (Esc). Rappelez la commande par entrée ET AVEC la flèche haute rappelez la dernière option, elle vous sera proposée alors en Anglais.

Pour le lisp il y a moins de pièges:
les options de la fonction (ssget):
"F" Fenêtre -> "_W" window
"D" Dernier -> "_L" Last
"I" Implicite -> "_I"
"P" Précédent -> "_P" Previous"
"C" Capture -> "_C" Crossing"
"SP" Fenêtre polygonale -> "_WP" Window Polygon
"CP" Capture polygonale -> "_CP" Crossing Polygon
"T" Trajet -> "_F" Fence
"X" Tout -> "_X" All

les option de (osnap):
"mil" milieu -> "_mid" middle
"ext" extrémité - > "_end"
"int"intersection -> "_int"
"cen" centre -> "_cen" center
"pro" proche -> "_near"
etc..

Si tu respecte ces syntaxes, ton code devrait fonctionner sous n'importe quelle version linguistique sans problème.

 

 

Translate

Compose in international language (by default in English)
All command calls (as well as options) must be made with an underline. Ex: (command "Calque" "Etablir" ...) should become (command "_.-layer" "_set" ...)
The hyphen is used to (generally) avoid calling the command in a dialog box, although in Lisp code calling the dialog box is generally ignored.
The point is used to call the native command in case the command has been redefined: "Nondef" command (_.UNDEFINE)
The underline is used to call the international command. If used, the command will be recognized on any language version: Spanish, French, German, Italian, etc.


A tip to know the English command: (getcname "Calque") -> "_Layer"
For the options it's more subtle: launch the command in French then the chosen option, then do Escape (Esc). Recall the command by enter AND WITH the up arrow recall the last option, it will then be offered to you in English.

For lisp there are fewer pitfalls:
function options (ssget):
"F" Fenêtre -> "_W" window
"D" Dernier -> "_L" Last
"I" Implicite -> "_I"
"P" Précédent -> "_P" Previous"
"C" Capture -> "_C" Crossing"
"SP" Fenêtre polygonale -> "_WP" Window Polygon
"CP" Capture polygonale -> "_CP" Crossing Polygon
"T" Trajet -> "_F" Fence
"X" Tout -> "_X" All

the options of (osnap):
"mil" milieu -> "_mid" middle
"ext" extrémité - > "_end"
"int"intersection -> "_int"
"cen" centre -> "_cen" center
"pro" proche -> "_near"
etc..

If you follow these syntaxes, your code should work under any language version without problem.

  • Like 1
Posted

if you can apply this just in small part of the code and i take care of the reste it will be great and thank to all of you for the huge support.

Posted

After a few modifications, your code works on a French version (so on any language)
I'll let you compare to see the errors
I commented out non-functional parts for classic polylines and rewritten otherwise so that they work with optimized and/or classic polylines.

 

(defun C:AREARON (/
          allx
          ally
          areaobj
          counter
          pr
          entity-name
          entnamevla
          mysset
          pt
          vertex
          x
          y
         )
  (vl-load-com)
  (COMMAND "_.UNDO" "_BE")
  (set_var)
  (if (tblsearch "Layer" "AREARON")
    (command "_.-layer"
         "_thaw"
         "AREARON"
         "_on"
         "AREARON"
         "_unlock"
         "AREARON"
         "_set"
         "AREARON"
         ""
    ) ;_ closes command
    (command "_.-layer"
         "_make"
         "AREARON"
         "_color"
         1
         "AREARON"
         ""
    ) ;_ closes command
  )
  (if (null sch)
    (setq sch 1.0)
  )
  (initget 6)
  (setq    temp (getreal (strcat "\nENTER SCALE <"
                  (rtos sch 2 2)
                  ">: "
              )
         )
  )
  (if temp
    (setq sch temp)
    (setq temp sch)
  )

  (if (null precision)
    (setq precision 1)
  )
  (initget 6)
  (setq    prec_temp (getint (strcat "\nHOW MANY DECIMAL PLACES?: <"
                  (rtos precision 2 2)
                  ">: "
              )
          )
  )
  (if prec_temp
    (setq precision prec_temp)
    (setq prec_temp precision)
  )
  (prompt "\nSELECT CLOSED POLYLINES:> ")
  (setq
;    mysset  (ssget '((0 . "POLYLINE,LWPOLYLINE") (-4 . "&") (70 . 1)))
    mysset  (ssget '((0 . "*POLYLINE") (-4 . "<AND") (-4 . "<NOT") (-4 . "&") (70 . 120) (-4 . "NOT>") (-4 . "&") (70 . 1) (-4 . "AND>")))
    counter 0
  )
  (if mysset
    (progn
      (while (< counter (sslength mysset))
    (setq allx      0
          ally      0
          entity-name (ssname mysset counter)
          entnamevla  (vlax-ename->vla-object entity-name)
          areaobj      (vla-get-area entnamevla)
          pr -1
    )
;|
    (while (assoc 10 el)
      (setq    vertex (cdr (assoc 10 el))
        ctr    (+ ctr 1)
        x      (car vertex)
        y      (cadr vertex)
        allx   (+ allx x)
        ally   (+ ally y)
        EL     (cdr (member (assoc 10 el) el))
      )
    )
    (setq x     (/ allx ctr)
          y     (/ ally ctr)
          pt (list x y)
    )
|;
    (repeat (1+ (fix (vlax-curve-getEndParam entnamevla)))
      (setq
        pr (1+ pr)
        vertex (vlax-curve-GetPointAtParam entnamevla pr)
        x      (car vertex)
        y      (cadr vertex)
        allx   (+ allx x)
        ally   (+ ally y)
      )
    )
    (setq x     (/ allx (1+ pr))
          y     (/ ally (1+ pr))
          pt (list x y)
    )
    (command "_.text" "_j" "_mc"
         pt
         (* sch 2.5)
         "0"
         (rtos areaobj 2 precision)
    )
    (setq counter (+ counter 1))
      )
    )
    (alert "\nNO CLOSED POLYLINES/LWPOLYLINES IN YOUR SELECTION"
    )
  )
  (reset_var)
  (princ)
(COMMAND "_.UNDO" "_END")
)
(princ)
(defun set_var ()
  (setq oldlayer (getvar "clayer"))
  (setq oldsnap (getvar "osmode"))
  (setq temperr *error*)
  (setq *error* traperror)
  (setvar "osmode" 0)
  (princ)
)
(defun traperror (errmsg)
  (command nil nil nil)
  (if (not (member errmsg '("console break" "Function Cancelled"))
      )
    (princ (strcat "\nError: " errmsg))
  )
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (princ "\nError Resetting Enviroment ")
  (setq *error* temperr)
  (princ)
)
(defun reset_var ()
  (setq *error* temperr)
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (princ)
)

 

  • Like 2

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...