lucas3 Posted January 17, 2014 Posted January 17, 2014 Hey guys, I want use lisp to create a new Text style and a Dimension style,details as follows: 1.Create a text style with name “ggg" font : gdt.shx ,big font : gbcbig.shx 2.Create Dimension style with name "custom" 2.1 Baseline spacing : 7 ,Extend beyond dim lines: 2.25, Offset from origin :2 2.2 Text syle :ggg ,Text height: 2.5 2.3 Create a Child style as diameter 2.4 Text alignment set to ISOstandard The job is finally done. please help me ! thanks very much! I'm overwhelmed with gratitude Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 Why bother? Create the new dim style (really, how long does it take?) then drag and drop it onto a custom tool palette. One and done. Same for the text style. Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 If you intend to use this in new drawings only (that it, not to adjust an existing drawing), then setting up a template with those will be an alternative solution. Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 Why bother? Create the new dim style (really, how long does it take?) then drag and drop it onto a custom tool palette. One and done. Same for the text style. This is just one part of the program, I want make a autodim lisp ,Must use this text style & dim style Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 Then do as previously suggested and make the styles part of your template. Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 If you intend to use this in new drawings only (that it, not to adjust an existing drawing), then setting up a template with those will be an alternative solution. Hi ,MSasu ,If you have extra time, or very boring,please help me! I'm overwhelmed with gratitude Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 Let's say you create a lisp routine to do both. You then use it for the first time in a drawing. From there on out every time you need those styles they are available via the Design Center to drag and drop into a new drawing or like I previously mentioned you place them on a custom tool palette. Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 (command ".-style" "Gdt" "gdt.shx,gbcbig.shx" 0 1.0 0 "n" "n" "n") (defun MkDimStyleFrom (OldName NewName / dims ndim) (setq dims (vla-get-dimstyles (vla-get-activedocument (vlax-get-acad-object)) ) ) (if (tblsearch "dimstyle" oldname) (progn (if (not (tblsearch "DimStyle" newName)) (setq ndim (vla-add dims newName)) ) (vla-copyfrom (vla-item dims oldname) ndim) (vla-put-activedimstyle dims ndim) ) ) ) ;;$2 augular dimensions,$3 diameter dimensions,$4 radius dimensions,$6 ordinate dimensions (defun mksubdimsty (name mod / dims) (setq dims (vla-get-dimstyles (vla-get-activedocument (vlax-get-acad-object)) ) ) (if (not (tblsearch "dimstyle" name)) (progn (vla-put-activedocument dims (vla-item dims name)) (vl-cmdf ".dimstyle" "s" (strcat (getvar "dimstyle") mod)) ) ) (princ) ) This code is from "http://bbs.xdcad.net/thread-672496-1-1.html" author is st788796 I don't know how to use Custom Functions Quote
MSasu Posted January 17, 2014 Posted January 17, 2014 Hi ,MSasu ,If you have extra time, or very boring,please help me! I'm overwhelmed with gratitude Sorry, I will not create a template for you since is very easy to do it by yourself - just do the settings you were looking for (not only the styles, but everything you will like to have available to start a new drawing) and save it as Template file (DWT). AutoCAD will point automatically to template folder; chouse a relevant name. Don't forget to make a back-up copy. May want also to point the NEW command to this template (in Options --> Files --> Template Setting --> Default Template File Name for QNEW). Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 Sorry, I will not create a template for you since is very easy to do it by yourself - just do the settings you were looking for (not only the styles, but everything you will like to have available to start a new drawing) and save it as Template file (DWT). AutoCAD will point automatically to template folder; chouse a relevant name. Don't forget to make a back-up copy.May want also to point the NEW command to this template (in Options --> Files --> Template Setting --> Default Template File Name for QNEW). I don't want a template,I need one lisp ! Quote
SLW210 Posted January 17, 2014 Posted January 17, 2014 I don't want a template,I need one lisp ! This is not a LISP-ON-DEMAND forum, everyone here VOLUNTEERS time to HELP others in their CAD related endeavors. You were already warned in a previous thread about this attitude. If you NEED a LISP, then contact someone to do this for you for a fee. Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 This is not a LISP-ON-DEMAND forum, everyone here VOLUNTEERS time to HELP others in their CAD related endeavors. You were already warned in a previous thread about this attitude. If you NEED a LISP, then contact someone to do this for you for a fee. I know,I not ask someone else to do,Some people are good people willing to help others,I raised this issue,If someone is willing to help, I am very grateful,If no one is willing to help, I don't insist. It doesn't matter Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 What is your reluctance towards using one of the three other (simple) ways of handling the task? Yes, lisp can make repetitive tasks much easier but it is not always the best answer to every problem. Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 What is your reluctance towards using one of the three other (simple) ways of handling the task? Yes, lisp can make repetitive tasks much easier but it is not always the best answer to every problem. Thank you ReMark ,I don't know how to explain. Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 It's like you are trying to drive a nail with a pile driver rather than a hammer. A lisp routine to create a text style and/or a dimension style seems like overkill to me. Apparently you got or wrote a lisp routine that does some of what you want but you need some help with it? Quote
lucas3 Posted January 17, 2014 Author Posted January 17, 2014 It's like you are trying to drive a nail with a pile driver rather than a hammer. A lisp routine to create a text style and/or a dimension style seems like overkill to me. Apparently you got or wrote a lisp routine that does some of what you want but you need some help with it? I want to create a new text style & dim style in an autolisp program and then draw an object using it. Quote
troggarf Posted January 17, 2014 Posted January 17, 2014 Check out this class free from AU 2013. http://au.autodesk.com/au-online/classes-on-demand/class-catalog/2013/autocad/ac1337 Dont try to reinvent the wheel ~Greg Quote
ReMark Posted January 17, 2014 Posted January 17, 2014 I want to create a new text style & dim style in an autolisp program and then draw an object using it. If you had a template that already including the text and dimension styles your lisp program could start a new drawing using the template then draw the object. Wouldn't that be much more simple? Quote
Tharwat Posted January 17, 2014 Posted January 17, 2014 Try this Lucas and let me know how you'd get on with it . (defun Text+Dim nil ;; Tharwat 17. Jan. 2014 ;; (if (not (tblsearch "STYLE" "ggg")) (entmakex '((0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "ggg") (40 . 0.) (41 . 1.) (42 . 1.0) (50 . 0.) (70 . 0) (71 . 0) (3 . "gdt.shx") (4 . "gbcbig.shx") ) ) ) ;; ;; (if (and (not (tblsearch "DIMSTYLE" "custom")) (tblsearch "STYLE" "ggg") ) (entmakex (list '(0 . "DIMSTYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbDimStyleTableRecord") '(2 . "custom") '(70 . 0) '(41 . 2.5) '(42 . 2.0) '(43 . 7.0) '(44 . 2.25) '(73 . 0) '(77 . 1) '(78 . '(140 . 2.5) '(141 . 2.5) '(171 . 3) '(172 . 1) '(271 . 2) '(272 . 2) '(274 . 3) '(278 . 44) '(283 . 0) '(284 . (cons 340 (tblobjname "STYLE" "ggg")) ) ) ) (princ) ) Usage ... (text+dim) Quote
lucas3 Posted January 18, 2014 Author Posted January 18, 2014 Try this Lucas and let me know how you'd get on with it . (defun Text+Dim nil ;; Tharwat 17. Jan. 2014 ;; (if (not (tblsearch "STYLE" "ggg")) (entmakex '((0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "ggg") (40 . 0.) (41 . 1.) (42 . 1.0) (50 . 0.) (70 . 0) (71 . 0) (3 . "gdt.shx") (4 . "gbcbig.shx") ) ) ) ;; ;; (if (and (not (tblsearch "DIMSTYLE" "custom")) (tblsearch "STYLE" "ggg") ) (entmakex (list '(0 . "DIMSTYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbDimStyleTableRecord") '(2 . "custom") '(70 . 0) '(41 . 2.5) '(42 . 2.0) '(43 . 7.0) '(44 . 2.25) '(73 . 0) '(77 . 1) '(78 . '(140 . 2.5) '(141 . 2.5) '(171 . 3) '(172 . 1) '(271 . 2) '(272 . 2) '(274 . 3) '(278 . 44) '(283 . 0) '(284 . (cons 340 (tblobjname "STYLE" "ggg")) ) ) ) (princ) ) Usage ... (text+dim) Whatever the result,all want to thank you! I will try. 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.