Tuesday, May 1, 2007

Translate layers using Laytrans on the command line

If you want to use the Layer Translator command Laytrans in a script file (SCR) or an AutoLISP file (LSP) here is how it can be done.

The use of the LISP function requires that you have already created and saved a layer translation mapping using the dialog version. The syntax is as follows:

(acet-laytrans <file name> [<bits>])

<file name> is a required argument. It is the name of a dwg or dws file that contains saved layer mappings. This file would need to have been created during a manual translation operation with Layer Translator.

[<bits>] is an optional argument. This is a bit code sum indicating which options should be used during translation. These correspond to the same options in the Settings dialog in Layer Translator. If the argument is not provided, the function uses the Layer Translator dialog's last settings.

The bits are as follows:

  • bit = 1: Force color to Bylayer
  • bit = 2: Force linetype to Bylayer
  • bit = 4: Translate into blocks
  • bit = 8: Write the translation log file

Examples:
(acet-laytrans "standard.dws")
Uses the previously saved file "standard.dws" (which contains layer mappings) and the last used options.

(acet-laytrans "standard.dws" (+ 1 2))
Uses the previously saved file "standard.dws" and forces color and linetype to BYLAYER.

(acet-laytrans "standard.dws" (+ 1 2 8))
Uses the previously saved file "standard.dws", forces color and linetype to BYLAYER and writes a translation log.

(cond ((not (member "laytrans.arx" (arx))) (arxload "laytrans")))
(acet-laytrans "standard.dws" (+ 1 4))
Make sure that laytrans.arx is loaded and use bit 1 and bit 4.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner