blueshake Posted September 22, 2010 Posted September 22, 2010 hi,all in autocad2010 for "style",we can easily use the codes below to build a new style. (if (= (tblsearch "style" "standard") nil) (command "style" "standard" "arial" "3.5" "0.666" "0.0" "" "" "") (command "style" "standard" "arial" "3.5" "0.666" "0.0" "" "" "") ) it seems the story is not the same for "dimstyle" if I want to build a new "dimstyle" named "standard",what should I do? if the "standard" existed, and I want to modify some option of "standard",what should I do then?? could somebody give me some example codes,please? thanks for your help. Quote
lpseifert Posted September 22, 2010 Posted September 22, 2010 here's a thread on how to create a dimstyle http://www.cadtutor.net/forum/showthread.php?50845-dimension-style-create-%28plz-chk-my-new-lisp-amp-how-to-improve%29 take a look here on how to modify a dimstyle http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/DImstyle-modification-using-Table-record/m-p/2776102#U2776102 Quote
blueshake Posted September 22, 2010 Author Posted September 22, 2010 hi,after read the thread,I am still confused ,still don't know how to build /modify "dimstyle":( Quote
lpseifert Posted September 22, 2010 Posted September 22, 2010 give an example on what you want to modify in an existing dimstyle BTW, I edited my first post to include a thread on how to create a dimstyle Quote
blueshake Posted September 22, 2010 Author Posted September 22, 2010 here's a thread on how to create a dimstylehttp://www.cadtutor.net/forum/showthread.php?50845-dimension-style-create-%28plz-chk-my-new-lisp-amp-how-to-improve%29 take a look here on how to modify a dimstyle http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/DImstyle-modification-using-Table-record/m-p/2776102#U2776102 ok,the new thread should help a lot,thank you. Quote
Tharwat Posted September 22, 2010 Posted September 22, 2010 You can make new dimension with this simple command : (vl-cmdf "_.-dimstyle" "_save" "New Dims." ) Tharwat Quote
blueshake Posted September 22, 2010 Author Posted September 22, 2010 You can make new dimension with this simple command : (vl-cmdf "_.-dimstyle" "_save" "New Dims." ) Tharwat thank you . Quote
blueshake Posted September 23, 2010 Author Posted September 23, 2010 hi,after some help from you,I finally know how to do it. here is the codes: (defun build_dimstyle(/) (if (= (tblsearch "dimstyle" "standard") nil) ;then (command "dimstyle" "s" "标准") ;else (command "dimstyle" "r" "standard") ) (princ "start setting") (foreach setuplisp '( ("dimtxt" . 3.5) ("DIMADEC" . 2) ("DIMALTRND" . 0.0000) ("DIMARCSYM" . 2) ("DIMASZ" . 2.5000) ("DIMATFIT" . 3) ("DIMAUNIT" . 0) ("DIMAZIN" . 0) ) (setvar (car setuplisp) (cdr setuplisp)) ) (command "-dimstyle" "s" "standard" "yes") ) by the way, is anyone know how to do this ? http://www.cadtutor.net/forum/showthread.php?52664-change-the-length-of-tail-of-arrow&p=356629#post356629 Quote
Tharwat Posted September 23, 2010 Posted September 23, 2010 Good work blueshake. And here is another way with the same result if you would like to. And with some corrections as following . Check this out . (defun build_dimstyle (/) (if (not (tblsearch "dimstyle" "standard")) (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "??") (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]r" "standard") ) (princ "start setting") (mapcar 'setvar '("dimtxt" "DIMADEC" "DIMALTRND" "DIMARCSYM" "DIMASZ" "DIMATFIT" "DIMAUNIT" "DIMAZIN") '(3.5 2 0.0000 2 2.5000 3 0 0)) (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "standard" "[color="red"]_[/color]yes") ) Besides that, you can use the dimstyle entmake to dimstyle as well and which is a little bit faster . Good luck Tharwat Quote
BlackBox Posted September 23, 2010 Posted September 23, 2010 Five points for mapcar usage, Tharwat. Although... all of that shows up in the command line. lol Quote
Tharwat Posted September 23, 2010 Posted September 23, 2010 Five points for mapcar usage, Tharwat. Although... all of that shows up in the command line. lol I also give five STARS for that comment. Quote
alanjt Posted September 23, 2010 Posted September 23, 2010 (foreach item '(("dimtxt" 3.5) ("DIMADEC" 2) ("DIMALTRND" 0.0000) ("DIMARCSYM" 2) ("DIMASZ" 2.5000) ("DIMATFIT" 3) ("DIMAUNIT" 0) ("DIMAZIN" 0) ) (apply 'setvar item) ) Quote
BlackBox Posted September 23, 2010 Posted September 23, 2010 ... foreach + apply combo beats mapcar... Alanjt Wins. Quote
blueshake Posted September 23, 2010 Author Posted September 23, 2010 Good work blueshake. And here is another way with the same result if you would like to. And with some corrections as following . Check this out . (defun build_dimstyle (/) (if (not (tblsearch "dimstyle" "standard")) (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "??") (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]r" "standard") ) (princ "start setting") (mapcar 'setvar '("dimtxt" "DIMADEC" "DIMALTRND" "DIMARCSYM" "DIMASZ" "DIMATFIT" "DIMAUNIT" "DIMAZIN") '(3.5 2 0.0000 2 2.5000 3 0 0)) (command "[color="red"]_.-[/color]dimstyle" "[color="red"]_[/color]s" "standard" "[color="red"]_[/color]yes") ) Besides that, you can use the dimstyle entmake to dimstyle as well and which is a little bit faster . Good luck Tharwat thanks. but what is the difference between dimstyle and _.-dimstyle? and what is the mean of symbol "??" Quote
Steven Erickson Posted September 24, 2010 Posted September 24, 2010 (edited) thanks.but what is the difference between dimstyle and _.-dimstyle? and what is the mean of symbol "??" The underscore ===> _dimstyle .... allows translation into other languages The dot ===> .dimstyle ..... means to use the true definition of the command rather than user defined The hyphen ===> -dimstyle ..... forces the command line version (that's just what I've read; I'm not exactly sure what it means, however) For a good set of tutorials you might want to check this site out. It's got plenty of good information: http://www.afralisp.net/index.php Edited September 24, 2010 by Steven Erickson correct misspelled word Quote
blueshake Posted September 24, 2010 Author Posted September 24, 2010 The underscore ===> _dimstyle .... allows translation into other languagesThe dot ===> .dimstyle ..... means to use the true definition of the command rather than user defined The hyphen ===> -dimstyle ..... forces the command line version (that's just what I've read; I'm not exactly sure what it means, however) For a good set of tutorials you might want to check this site out. It's got plenty of good information: http://www.afralisp.net/index.php thank you for your reply. Quote
alanjt Posted September 24, 2010 Posted September 24, 2010 ... foreach + apply combo beats mapcar... Alanjt Wins. In this situation, I'm just not a fan of breaking up a list. If one wants to make changes down the line, it will be a lot easier if the settings are together, rather than in two separate lists. I liked stepping through a list of dotted pairs and using (setvar (car x) (cdr x)). Quote
BlackBox Posted September 24, 2010 Posted September 24, 2010 In this situation, I'm just not a fan of breaking up a list. If one wants to make changes down the line, it will be a lot easier if the settings are together, rather than in two separate lists. I liked stepping through a list of dotted pairs and using (setvar (car x) (cdr x)). As always, I appreciate the explanation. I've never thought to set sysvars in this manor, and I'm sure I'm not the only one. You've, how the hippies put it... "blown my mind." :wink: Quote
alanjt Posted September 24, 2010 Posted September 24, 2010 As always, I appreciate the explanation. I've never thought to set sysvars in this manor, and I'm sure I'm not the only one. You've, how the hippies put it... "blown my mind." :wink:I'm not saying there's anything wrong with using mapcar and two lists, I use it myself when setting/storing system variables (cmdecho, etc.) within a routine. However, in this situation, when needing to look at a clear and concise list of variables and settings, I would rather keep a format that is a little easier to look at and edit. Quote
Recommended Posts
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.