Jump to content

Recommended Posts

Posted

I am doing my best to learn what I can, but most of it is just over my head and hurts my eyes just looking at it. I have figured some stuff out and learned how to edit somethings in existing code, but still have a hard time without taking classes or something to figure out more.

 

I have searched around online, but I still cannot find a way to reset to the previous dimstyle in use. With this command, it makes a dimstyle and sets it to current. How can I revert back to the previous dimstyle?

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • brawleyman

    13

  • Lee Mac

    12

  • The Buzzard

    7

  • Se7en

    3

Top Posters In This Topic

Posted

As the DIMSTYLE Sys Var is RO, I think you would have to store it:

 

(setq oldDim (getvar "DIMSTYLE"))

 

Then restore it at the end, (and also in any error handlers!):

 

(command "_.-dimstyle" "_R" oldDim)

 

Lee

Posted
As the DIMSTYLE Sys Var is RO, I think you would have to store it:

 

(setq oldDim (getvar "DIMSTYLE"))

 

Then restore it at the end, (and also in any error handlers!):

 

(command "_.-dimstyle" "_R" oldDim)

 

Lee

 

Awesome! Just what I needed. The last thing I need to do is to create an error fixer. While in the command, if you right click, it will just end and finish the LISP routine and purge the dimstyle. But, if you press "Esc" to end it, then it doesn't finish the routine and then "crun" ends up being the last dimstyle. How would I program an error so that no matter how the program is exited out of early, it will always purge the crun dimstyle and revert back to whatever original dimstyle you had?

 

Here is the lastest of my code.

 

(defun c:crun ()
(setvar "cmdecho" 1)
(if
(tblsearch "dimstyle" "crun")
(command "-purge" "d" "crun" "y" "y")
);if
(setq oldDim (getvar "DIMSTYLE"))
 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
(command "DIMTOL" "0")
(command "DIMLIM" "0")
(command "DIMTIH" "0")
(command "DIMTOH" "0")
(command "DIMSE1" "0")
(command "DIMSE2" "0")
(command "DIMALT" "0")
(command "DIMTOFL" "1")
(command "DIMSAH" "0")
(command "DIMTIX" "1")
(command "DIMSOXD" "0")
(command "DIMSD1" "0")
(command "DIMSD2" "0")
(command "DIMUPT" "0")
(command "DIMDSEP" ".")
(command "DIMALTD" "2")
(command "DIMZIN" "1")
(command "DIMJUST" "0")
(command "DIMFIT" "1")
(command "DIMTZIN" "0")
(command "DIMALTZ" "0")
(command "DIMALTTZ" "0")
(command "DIMTAD" "3")
(command "DIMUNIT" "2")
(command "DIMAUNIT" "0")
(command "DIMDEC" "1")
(command "DIMTDEC" "1")
(command "DIMALTU" "2")
(command "DIMALTTD" "2")
(command "DIMADEC" "4")
(command "DIMAZIN" "0")
(command "DIMATFIT" "3")
(command "DIMFRAC" "0")
(command "DIMLUNIT" "2")
(command "DIMTMOVE" "2")
(command "DIMTXSTY" "standard")
(command "DIMASZ" "0")
(command "DIMEXO" "0")
(command "DIMDLI" "0")
(command "DIMEXE" "0")
(command "DIMRND" "0")
(command "DIMDLE" "0")
(command "DIMTP" "0")
(command "DIMTM" "0")
(command "DIMTXT" "9")
(command "DIMCEN" "0")
(command "DIMTSZ" "0")
(command "DIMALTF" "1")
(command "DIMLFAC" "1")
(command "DIMTVP" "0")
(command "DIMTFAC" "1")
(command "DIMGAP" "0")
(command "DIMALTRND" "0")
(command "DIMPOST" "'")
(command "DIMAPOST" ".")
(command "DIMBLK" "_none")
(command "DIMBLK1" "_none")
(command "DIMBLK2" "_none")
(command "DIMLDRBLK" "_none")
(command "DIMCLRD" "0")
(command "DIMCLRE" "0")
(command "DIMCLRT" "0")
(command "DIMLWD" "-2")
(command "DIMLWE" "-2")
(command "-dimstyle" "s" "crun")
);end progn
);end if
;
;;;;;;;;;;Finishing Program;;;;;;;;;;
;
(command "-dimstyle" "r" "crun")
(command "_dimlinear" pause pause "t" " " pause)
(command "explode" "last")
(command "peditaccept" "1")
(command "pedit" "m" "previous" "" "j" "0" "")
(command "fillet" "p" "last")
(command "peditaccept" "0")
(command "_.-dimstyle" "_R" oldDim)
(if
(tblsearch "dimstyle" "crun")
(command "-purge" "d" "crun" "y" "y")
);if
(setvar "cmdecho" 1)
(princ)
)

Posted

How about something along these lines...

 

(defun c:crun (/ *error* vl ov oldDim)

 (defun *error* (msg)
   (if (and oldDim
         (tblsearch "DIMSTYLE" oldDim))
     (command "_.-dimstyle" "_R" oldDim))
   (if ov (mapcar 'setvar vl ov))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n<< Error: " msg " >>")))
   (princ))

 (setq vl '("CMDECHO" "PEDITACCEPT")
       ov (mapcar 'getvar vl))
 (mapcar 'setvar vl '(1 0))
 (setq oldDim (getvar "DIMSTYLE"))

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_y" "_y"))

 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
     (mapcar
       (function
         (lambda (x)
           (apply 'setvar x)))
       '(("DIMTOL"   0)
         ("DIMLIM"   0)
         ("DIMTIH"   0)
         ("DIMTOH"   0)
         ("DIMSE1"   0)
         ("DIMSE2"   0)
         ("DIMALT"   0)
         ("DIMTOFL"  1)
         ("DIMSAH"   0)
         ("DIMTIX"   1)
         ("DIMSOXD"  0)
         ("DIMSD1"   0)
         ("DIMSD2"   0)
         ("DIMUPT"   0)
         ("DIMDSEP" ".")
         ("DIMALTD"  2)
         ("DIMZIN"   1)
         ("DIMJUST"  0)
         ("DIMFIT"   1)
         ("DIMTZIN"  0)
         ("DIMALTZ"  0)
         ("DIMALTTZ" 0)
         ("DIMTAD"   3)
         ("DIMUNIT"  2)
         ("DIMAUNIT" 0)
         ("DIMDEC"   1)
         ("DIMTDEC"  1)
         ("DIMALTU"  2)
         ("DIMALTTD" 2)
         ("DIMADEC"  4)
         ("DIMAZIN"  0)
         ("DIMATFIT" 3)
         ("DIMFRAC"  0)
         ("DIMLUNIT" 2)
         ("DIMTMOVE" 2)
         ("DIMTXSTY" "STANDARD")
         ("DIMASZ"   0)
         ("DIMEXO"   0)
         ("DIMDLI"   0)
         ("DIMEXE"   0)
         ("DIMRND"   0)
         ("DIMDLE"   0)
         ("DIMTP"    0)
         ("DIMTM"    0)
         ("DIMTXT"   9)
         ("DIMCEN"   0)
         ("DIMTSZ"   0)
         ("DIMALTF"  1)
         ("DIMLFAC"  1)
         ("DIMTVP"   0)
         ("DIMTFAC"  1)
         ("DIMGAP"   0)
         ("DIMALTRND" 0)
         ("DIMPOST"  "'")
         ("DIMAPOST" ".")
         ("DIMBLK"    "None")
         ("DIMBLK1"   "None")
         ("DIMBLK2"   "None")
         ("DIMLDRBLK" "None")
         ("DIMCLRD"  0)
         ("DIMCLRE"  0)
         ("DIMCLRT"  0)
         ("DIMLWD"  -2)
         ("DIMLWE"  -2)))
     
     (command "_.-dimstyle" "_s" "crun")))

;;;;;;;;;;Finishing Program;;;;;;;;;;

 (command "_.-dimstyle" "_r" "crun")
 (command "_.dimlinear" pause pause "_t" " " pause)
 (command "_.explode" "_last")
 (command "_.pedit" "_m" "_previous" "" "_j" "0" "")
 (command "_.fillet" "_p" "_last")
 (command "_.-dimstyle" "_R" oldDim)

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_y" "_y"))
 
(mapcar 'setvar vl ov)
(princ))

Remember to localise your variables, and also to use the correct prefixes when calling commands, to allow for other languages, versions etc.

Posted
How about something along these lines...

 

(defun c:crun (/ *error* vl ov oldDim)

 (defun *error* (msg)
   (if (and oldDim
         (tblsearch "DIMSTYLE" oldDim))
     (command "_.-dimstyle" "_R" oldDim))
   (if ov (mapcar 'setvar vl ov))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n<< Error: " msg " >>")))
   (princ))

 (setq vl '("CMDECHO" "PEDITACCEPT")
       ov (mapcar 'getvar vl))
 (mapcar 'setvar vl '(1 0))
 (setq oldDim (getvar "DIMSTYLE"))

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_y" "_y"))

 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
     (mapcar
       (function
         (lambda (x)
           (apply 'setvar x)))
       '(("DIMTOL"   0)
         ("DIMLIM"   0)
         ("DIMTIH"   0)
         ("DIMTOH"   0)
         ("DIMSE1"   0)
         ("DIMSE2"   0)
         ("DIMALT"   0)
         ("DIMTOFL"  1)
         ("DIMSAH"   0)
         ("DIMTIX"   1)
         ("DIMSOXD"  0)
         ("DIMSD1"   0)
         ("DIMSD2"   0)
         ("DIMUPT"   0)
         ("DIMDSEP" ".")
         ("DIMALTD"  2)
         ("DIMZIN"   1)
         ("DIMJUST"  0)
         ("DIMFIT"   1)
         ("DIMTZIN"  0)
         ("DIMALTZ"  0)
         ("DIMALTTZ" 0)
         ("DIMTAD"   3)
         ("DIMUNIT"  2)
         ("DIMAUNIT" 0)
         ("DIMDEC"   1)
         ("DIMTDEC"  1)
         ("DIMALTU"  2)
         ("DIMALTTD" 2)
         ("DIMADEC"  4)
         ("DIMAZIN"  0)
         ("DIMATFIT" 3)
         ("DIMFRAC"  0)
         ("DIMLUNIT" 2)
         ("DIMTMOVE" 2)
         ("DIMTXSTY" "STANDARD")
         ("DIMASZ"   0)
         ("DIMEXO"   0)
         ("DIMDLI"   0)
         ("DIMEXE"   0)
         ("DIMRND"   0)
         ("DIMDLE"   0)
         ("DIMTP"    0)
         ("DIMTM"    0)
         ("DIMTXT"   9)
         ("DIMCEN"   0)
         ("DIMTSZ"   0)
         ("DIMALTF"  1)
         ("DIMLFAC"  1)
         ("DIMTVP"   0)
         ("DIMTFAC"  1)
         ("DIMGAP"   0)
         ("DIMALTRND" 0)
         ("DIMPOST"  "'")
         ("DIMAPOST" ".")
         ("DIMBLK"    "None")
         ("DIMBLK1"   "None")
         ("DIMBLK2"   "None")
         ("DIMLDRBLK" "None")
         ("DIMCLRD"  0)
         ("DIMCLRE"  0)
         ("DIMCLRT"  0)
         ("DIMLWD"  -2)
         ("DIMLWE"  -2)))
     
     ( "_.-dimstyle" "_s" "crun")))

;;;;;;;;;;Finishing Program;;;;;;;;;;

 (command "_.-dimstyle" "_r" "crun")
 (command "_.dimlinear" pause pause "_t" " " pause)
 (command "_.explode" "_last")
 (command "_.pedit" "_m" "_previous" "" "_j" "0" "")
 (command "_.fillet" "_p" "_last")
 (command "_.-dimstyle" "_R" oldDim)

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_y" "_y"))
 
(mapcar 'setvar vl ov)
(princ))

 

Remember to localise your variables, and also to use the correct prefixes when calling commands, to allow for other languages, versions etc.

 

I keep getting errors when I try to run it. Is there just a simple error handler that will always purge the dimstyle no matter what or when you have to exit the routine prematurely?

Posted

I haven't tested it, but what errors are you getting out of interest?

 

to Add the dimstyle purge, just copy the line (command "_.-purge" ....) into the error handler definition. :)

Posted
I haven't tested it, but what errors are you getting out of interest?

 

to Add the dimstyle purge, just copy the line (command "_.-purge" ....) into the error handler definition. :)

 

">"

 

What is the basic layout of an error handler?

Posted

I have updated the posted code above - it was a typo that was causing the error - there could be others.. :oops:

 

As for the error handler, coincidentally I have just finished writing an FAQ/Tutorial on Error Handlers, but it hasn't been added to the FAQ section yet by the Mods.. :(

 

But, put simply:

 

(defun *error* (msg)
 <Do something>
)

 

You are redefining AutoCAD's default error handler to something you can work with. It take one argument, that is, the error message.

Posted
I have updated the posted code above - it was a typo that was causing the error - there could be others.. :oops:

 

As for the error handler, coincidentally I have just finished writing an FAQ/Tutorial on Error Handlers, but it hasn't been added to the FAQ section yet by the Mods.. :(

 

But, put simply:

 

(defun *error* (msg)
 <Do something>
)

 

You are redefining AutoCAD's default error handler to something you can work with. It take one argument, that is, the error message.

 

So do I have to establish a variable for the old error handler, name my own, set it current, then reset the error handler at the end?

 

I tried the updated code, and now it says:

 

"; error: An error has occurred inside the *error* functionFunction cancelled"

Posted
So do I have to establish a variable for the old error handler, name my own, set it current, then reset the error handler at the end?

 

Well, there is a bit of a debate over this, but imo, as long as you localise the *error* function within the main function, then all should be fine.

 

I tried the updated code, and now it says:

 

"; error: An error has occurred inside the *error* functionFunction cancelled"

 

Great... I think I'm going to have to look over my code a bit more before I post... :oops:

Posted

How about this:

 

(defun c:crun (/ *error* vl ov oldDim)

 (defun *error* (msg)
   (if (and oldDim
         (tblsearch "DIMSTYLE" oldDim))
     (command "_.-dimstyle" "_R" oldDim))
   (command "_.-purge" "_D" "crun" "_N")
   (if ov (mapcar 'setvar vl ov))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n<< Error: " msg " >>")))
   (princ))

 (setq vl '("CMDECHO" "PEDITACCEPT")
       ov (mapcar 'getvar vl))
 (mapcar 'setvar vl '(0 1))
 (setq oldDim (getvar "DIMSTYLE"))

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_N"))

 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
     (mapcar
       (function
         (lambda (x)
           (apply 'setvar x)))
       '(("DIMTOL"   0)
         ("DIMLIM"   0)
         ("DIMTIH"   0)
         ("DIMTOH"   0)
         ("DIMSE1"   0)
         ("DIMSE2"   0)
         ("DIMALT"   0)
         ("DIMTOFL"  1)
         ("DIMSAH"   0)
         ("DIMTIX"   1)
         ("DIMSOXD"  0)
         ("DIMSD1"   0)
         ("DIMSD2"   0)
         ("DIMUPT"   0)
         ("DIMDSEP" ".")
         ("DIMALTD"  2)
         ("DIMZIN"   1)
         ("DIMJUST"  0)
         ("DIMFIT"   1)
         ("DIMTZIN"  0)
         ("DIMALTZ"  0)
         ("DIMALTTZ" 0)
         ("DIMTAD"   3)
         ("DIMUNIT"  2)
         ("DIMAUNIT" 0)
         ("DIMDEC"   1)
         ("DIMTDEC"  1)
         ("DIMALTU"  2)
         ("DIMALTTD" 2)
         ("DIMADEC"  4)
         ("DIMAZIN"  0)
         ("DIMATFIT" 3)
         ("DIMFRAC"  0)
         ("DIMLUNIT" 2)
         ("DIMTMOVE" 2)
         ("DIMTXSTY" "STANDARD")
         ("DIMASZ"   0)
         ("DIMEXO"   0)
         ("DIMDLI"   0)
         ("DIMEXE"   0)
         ("DIMRND"   0)
         ("DIMDLE"   0)
         ("DIMTP"    0)
         ("DIMTM"    0)
         ("DIMTXT"   9)
         ("DIMCEN"   0)
         ("DIMTSZ"   0)
         ("DIMALTF"  1)
         ("DIMLFAC"  1)
         ("DIMTVP"   0)
         ("DIMTFAC"  1)
         ("DIMGAP"   0)
         ("DIMALTRND" 0)
         ("DIMPOST"  "'")
         ("DIMAPOST" ".")
         ("DIMBLK"    "None")
         ("DIMBLK1"   "None")
         ("DIMBLK2"   "None")
         ("DIMLDRBLK" "None")
         ("DIMCLRD"  0)
         ("DIMCLRE"  0)
         ("DIMCLRT"  0)
         ("DIMLWD"  -2)
         ("DIMLWE"  -2)))
     
     (command "_.-dimstyle" "_s" "crun")))

;;;;;;;;;;Finishing Program;;;;;;;;;;

 (command "_.-dimstyle" "_r" "crun")
 (setvar "CMDECHO" 1)
 (command "_.dimlinear" pause pause "_t" " " pause)
 (setvar "CMDECHO" 0)
 (command "_.explode" "_last")
 (command "_.pedit" "_m" "_previous" "" "_j" "0" "")
 (command "_.fillet" "_p" "_last")
 (command "_.-dimstyle" "_R" oldDim)

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_N"))
 
(mapcar 'setvar vl ov)
(princ))

Posted

Okay. I injected the error code in there and made a few other little modifications. Here is the latest and greatest. So far, there have been no problems. Is the error code good and not messing anything up?

 

(defun c:crun ()
(setvar "cmdecho" 0)

(defun *error* (msg)
(command "-dimstyle" "_R" oldDim)
(command "-purge" "d" "crun" "y" "y")
);error

(setq oldDim (getvar "DIMSTYLE"))
 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
(command "DIMTOL" "0")
(command "DIMLIM" "0")
(command "DIMTIH" "0")
(command "DIMTOH" "0")
(command "DIMSE1" "0")
(command "DIMSE2" "0")
(command "DIMALT" "0")
(command "DIMTOFL" "1")
(command "DIMSAH" "0")
(command "DIMTIX" "1")
(command "DIMSOXD" "0")
(command "DIMSD1" "0")
(command "DIMSD2" "0")
(command "DIMUPT" "0")
(command "DIMDSEP" ".")
(command "DIMALTD" "2")
(command "DIMZIN" "1")
(command "DIMJUST" "0")
(command "DIMFIT" "1")
(command "DIMTZIN" "0")
(command "DIMALTZ" "0")
(command "DIMALTTZ" "0")
(command "DIMTAD" "3")
(command "DIMUNIT" "2")
(command "DIMAUNIT" "0")
(command "DIMDEC" "1")
(command "DIMTDEC" "1")
(command "DIMALTU" "2")
(command "DIMALTTD" "2")
(command "DIMADEC" "4")
(command "DIMAZIN" "0")
(command "DIMATFIT" "3")
(command "DIMFRAC" "0")
(command "DIMLUNIT" "2")
(command "DIMTMOVE" "2")
(command "DIMTXSTY" "standard")
(command "DIMASZ" "0")
(command "DIMEXO" "0")
(command "DIMDLI" "0")
(command "DIMEXE" "0")
(command "DIMRND" "0")
(command "DIMDLE" "0")
(command "DIMTP" "0")
(command "DIMTM" "0")
(command "DIMTXT" "9")
(command "DIMCEN" "0")
(command "DIMTSZ" "0")
(command "DIMALTF" "1")
(command "DIMLFAC" "1")
(command "DIMTVP" "0")
(command "DIMTFAC" "1")
(command "DIMGAP" "0")
(command "DIMALTRND" "0")
(command "DIMPOST" "'")
(command "DIMAPOST" ".")
(command "DIMBLK" "_none")
(command "DIMBLK1" "_none")
(command "DIMBLK2" "_none")
(command "DIMLDRBLK" "_none")
(command "DIMCLRD" "0")
(command "DIMCLRE" "0")
(command "DIMCLRT" "0")
(command "DIMLWD" "-2")
(command "DIMLWE" "-2")
(command "-dimstyle" "s" "crun")
);end progn
);end if
;
;;;;;;;;;;Finishing Program;;;;;;;;;;
;
(command "-dimstyle" "r" "crun")
(command "_dimlinear" pause pause "t" " " pause)
(command "explode" "last")
(command "peditaccept" "1")
(command "pedit" "m" "previous" "" "j" "0" "")
(command "fillet" "p" "last")
(command "peditaccept" "0")
(command "_.-dimstyle" "_R" oldDim)
(if
(tblsearch "dimstyle" "crun")
(command "-purge" "d" "crun" "y" "y")
);if
(setvar "cmdecho" 1)
(princ)
)

Posted
How about this:

 

(defun c:crun (/ *error* vl ov oldDim)

 (defun *error* (msg)
   (if (and oldDim
         (tblsearch "DIMSTYLE" oldDim))
     (command "_.-dimstyle" "_R" oldDim))
   (command "_.-purge" "_D" "crun" "_N")
   (if ov (mapcar 'setvar vl ov))
   (if (not
         (wcmatch
           (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
     (princ (strcat "\n<< Error: " msg " >>")))
   (princ))

 (setq vl '("CMDECHO" "PEDITACCEPT")
       ov (mapcar 'getvar vl))
 (mapcar 'setvar vl '(0 1))
 (setq oldDim (getvar "DIMSTYLE"))

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_N"))

 (if (not (tblsearch "DIMSTYLE" "crun"))
   (progn
     (mapcar
       (function
         (lambda (x)
           (apply 'setvar x)))
       '(("DIMTOL"   0)
         ("DIMLIM"   0)
         ("DIMTIH"   0)
         ("DIMTOH"   0)
         ("DIMSE1"   0)
         ("DIMSE2"   0)
         ("DIMALT"   0)
         ("DIMTOFL"  1)
         ("DIMSAH"   0)
         ("DIMTIX"   1)
         ("DIMSOXD"  0)
         ("DIMSD1"   0)
         ("DIMSD2"   0)
         ("DIMUPT"   0)
         ("DIMDSEP" ".")
         ("DIMALTD"  2)
         ("DIMZIN"   1)
         ("DIMJUST"  0)
         ("DIMFIT"   1)
         ("DIMTZIN"  0)
         ("DIMALTZ"  0)
         ("DIMALTTZ" 0)
         ("DIMTAD"   3)
         ("DIMUNIT"  2)
         ("DIMAUNIT" 0)
         ("DIMDEC"   1)
         ("DIMTDEC"  1)
         ("DIMALTU"  2)
         ("DIMALTTD" 2)
         ("DIMADEC"  4)
         ("DIMAZIN"  0)
         ("DIMATFIT" 3)
         ("DIMFRAC"  0)
         ("DIMLUNIT" 2)
         ("DIMTMOVE" 2)
         ("DIMTXSTY" "STANDARD")
         ("DIMASZ"   0)
         ("DIMEXO"   0)
         ("DIMDLI"   0)
         ("DIMEXE"   0)
         ("DIMRND"   0)
         ("DIMDLE"   0)
         ("DIMTP"    0)
         ("DIMTM"    0)
         ("DIMTXT"   9)
         ("DIMCEN"   0)
         ("DIMTSZ"   0)
         ("DIMALTF"  1)
         ("DIMLFAC"  1)
         ("DIMTVP"   0)
         ("DIMTFAC"  1)
         ("DIMGAP"   0)
         ("DIMALTRND" 0)
         ("DIMPOST"  "'")
         ("DIMAPOST" ".")
         ("DIMBLK"    "None")
         ("DIMBLK1"   "None")
         ("DIMBLK2"   "None")
         ("DIMLDRBLK" "None")
         ("DIMCLRD"  0)
         ("DIMCLRE"  0)
         ("DIMCLRT"  0)
         ("DIMLWD"  -2)
         ("DIMLWE"  -2)))
     
     (command "_.-dimstyle" "_s" "crun")))

;;;;;;;;;;Finishing Program;;;;;;;;;;

 (command "_.-dimstyle" "_r" "crun")
 (setvar "CMDECHO" 1)
 (command "_.dimlinear" pause pause "_t" " " pause)
 (setvar "CMDECHO" 0)
 (command "_.explode" "_last")
 (command "_.pedit" "_m" "_previous" "" "_j" "0" "")
 (command "_.fillet" "_p" "_last")
 (command "_.-dimstyle" "_R" oldDim)

 (if (tblsearch "dimstyle" "crun")
   (command "_.-purge" "_d" "crun" "_N"))
 
(mapcar 'setvar vl ov)
(princ))

 

I am getting the error message:

 

"Command: ; error: malformed list on input"

 

when I try to use it.

Posted
I am getting the error message:

 

"Command: ; error: malformed list on input"

 

when I try to use it.

 

I just ran Lees code and it works fine, However I ran your version and cannot help but notice your code seems unpredictable.

 

1. There are no prompts (The code does not tell you what to do.)

2. You turn off cmdecho at the start of you program and turn it back on at the end of your program. (What if someone else was using this program and had their cmdecho off originally.)

You need to save the user settings before you change them, Then restore them back to their original settings.

 

And finally this could have been written alot simpler with a polyline command without making all these dimvar settings and exploding and pediting. This is your code and I am sorry if I seem critical about it,

But I feel you should really think about what you are doing here.

 

If you end up with polylines, Why not just use polylines to start with.

 

Just my 2 cents.

Posted
I just ran Lees code and it works fine, However I ran your version and cannot help but notice your code seems unpredictable.

 

1. There are no prompts (The code does not tell you what to do.)

2. You turn off cmdecho at the start of you program and turn it back on at the end of your program. (What if someone else was using this program and had their cmdecho off originally.)

You need to save the user settings before you change them, Then restore them back to their original settings.

 

And finally this could have been written alot simpler with a polyline command without making all these dimvar settings and exploding and pediting. This is your code and I am sorry if I seem critical about it,

But I feel you should really think about what you are doing here.

 

If you end up with polylines, Why not just use polylines to start with.

 

Just my 2 cents.

 

I know it could be done a different way rather than using the dimension, but it is a crude way to get what I need done. I like that fact that it works similar to a dimension so that you can see the lines as you are deciding the direction you need the conduit to go. Just keep your cursor close to the last point you selected while the grip is showing and the click to set it. Works fine for me.

 

Thanks for all your help guys!

Posted
I know it could be done a different way rather than using the dimension, but it is a crude way to get what I need done. I like that fact that it works similar to a dimension so that you can see the lines as you are deciding the direction you need the conduit to go. Just keep your cursor close to the last point you selected while the grip is showing and the click to set it. Works fine for me.

 

Thanks for all your help guys!

 

 

What can I say,

YOU GO FOR IT!

Posted

brawleyman,

 

Try this link:

http://www.cadtutor.net/forum/showpost.php?p=237828&postcount=7

 

same as u needed but not using dimension o:)

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