Hi Guys! Can anybody help me with this lisp? I can't get past the line that reads "(command "mline" "Scale" ductwidth)". I suspect that I need to end the line differently, but how? Forever in your debt ;;;--- Mlines - Draw MultiLines to represent the outside edges ;;; of ducts and including a centerline. ;;; ;;;---10/28/04 by SoxFansl ;;; ;;;--- Function to Design Multilines ;;;--- must have the multiline style "Ducts" defined ;;;--- use the acad.mln file in this folder (defun C:mlines () (setvar "cmdecho" 0) (setq currentlayer (getvar "clayer")) (setvar "clayer" "0-duct") (setq ductwidth (getreal "\nEnter Duct Width: ")) ;;;--- get the current value of "CMLJUST" and save it as currentCMLJUST (setq currentCMLJUST (getvar"CMLJUST")) ;;; ;;;--- get the current value of "CMLSTYLE" and save it as currentCMLSTYLE (setq currentCMLSTYLE (getvar"CMLSTYLE")) ;;; ;;;--- get the current value of "CMLSCALE" and save it as currentCMLSTYLE (setq currentCMLSCALE (getvar"CMLSCALE")) ;;; (setvar "CMLJUST" 1) (setvar "CMLSTYLE""ducts") (command "mline" "Scale" ductwidth) (prompt "\nFinished") (princ) (setvar "clayer" currentlayer) )
Try this... Code: ;;;--- Mlines - Draw MultiLines to represent the outside edges ;;; of ducts and including a centerline. ;;; ;;;---10/28/04 by SoxFansl ;;; ;;;--- Function to Design Multilines ;;;--- must have the multiline style "Ducts" defined ;;;--- use the acad.mln file in this folder (defun C:mlines () (setvar "cmdecho" 0) (setq currentlayer (getvar "clayer")) (setvar "clayer" "0-duct") (setq ductwidth (getreal "\nEnter Duct Width: ")) ;;;--- get the current value of "CMLJUST" and save it as currentCMLJUST (setq currentCMLJUST (getvar"CMLJUST")) ;;; ;;;--- get the current value of "CMLSTYLE" and save it as currentCMLSTYLE (setq currentCMLSTYLE (getvar"CMLSTYLE")) ;;; ;;;--- get the current value of "CMLSCALE" and save it as currentCMLSTYLE (setq currentCMLSCALE (getvar"CMLSCALE")) ;;; (setvar "CMLJUST" 1) (setvar "CMLSTYLE""ducts") (command "mline" "Scale" ductwidth) (prompt "\nFinished") (princ) (command "clayer" currentlayer) )
perhaps a command function wrapper would be useful?... Then, change this line in your code: to: (DoCommand "MLINE" PAUSE 1 '("Scale" ductwidth)) hth, David Kozina Code: ; Run command with options ; Ugly command function, but necessary, sometimes - and rather versatile! (defun DoCommand (Name_str ; Command Name String - caller to provide "_." prefix PauseOrAutoEnter_value ; PAUSE or "" - Let user finish or Autoterminate CmdEcho_flag ; [1/0/nil] - Prompt Echoing / Silent / Run as-is Input_lst ; Preset command option list - may be nil / SysVar_lst ; a list of system variables ; / ; vl:T ; (ttSetVars ) ; begin ; ...Echo prompts or run silent? (if CmdEcho_flag ; then set system variables (setq SysVar_lst (ttSetVars (list (cons "CMDECHO" CmdEcho_flag)) ) );_end setq ; else );_end if ; start command (command Name_str) ; ...Option list provided? (if Input_lst ; then ; ...process command options (foreach CommandOption Input_lst; ; begin loop (command CommandOption) ; end loop );_end foreach ; else );_end if ; did caller use a "." command prefix? ; - remove it for cmdnames usage below (setq Name_str (vl-string-subst "" "." Name_str ) );_end setq ; did caller use a "_" command prefix? ; - remove it for cmdnames usage below (setq Name_str (vl-string-subst "" "_" Name_str ) );_end setq ; ...is command still active? ; - it needs to finish (while (wcmatch (getvar "CMDNAMES") (strcat "*" Name_str "*") ) ; begin loop (command PauseOrAutoEnter_value) ; end loop );_end while ; ...restore CMDECHO? (if CmdEcho_flag ; then Restore system variables (ttSetVars SysVar_lst) ; else );_end if ; end );_end defun ; (ttSetVars ((<varname> . <newvalue>)...)) ; Copyright 2000 by Tony Tanzillo (defun ttSetVars (sysvar_lst ; a list of system variables / result ) ; begin (foreach var sysvar_lst (setq result (cons (cons (car var) (getvar (car var))) result ) );_end setq (setvar (car var) (cdr var)) );_end foreach result ; end );_end defun [\code]
OOPS! Important! Change the line in your code to: (DoCommand "MLINE" PAUSE 1 (list "Scale" ductwidth))
you should use getdist instead of getreal then the user can pick a distance or enter it numerically i've had much success put this in and it will display your current mline scale at the prompt (SETVAR "DIMZIN" 1) (SETQ X (GETVAR "CMLSCALE")) (SETQ MS1 (RTOS X 4 2)) (prompt "\nMulti-Line width <") (PRINC (STRCAT MS1)) (SETQ MS2 (GETDIST ">: ")) (COMMAND "CMLSCALE" MS2) if anyone figures an easy way to load the mln file without the dialog box, i would be much appreciative, i don't like loading a block with defined styles already in it, i would just like to load my specific mline that's already defined