MikeP Posted April 21, 2008 Share Posted April 21, 2008 Is anyone aware of a LISP that creates a dimension line but before you choose the position it asks for a measurement override. I'm tired of going into the properties each time I want to change the dimension. It should also prompt which type of dimension tool I want to use like either aligned or linear. or if anyone is up to the challenge of creating one for me that would great. Quote Link to comment Share on other sites More sharing options...
Adesu Posted April 22, 2008 Share Posted April 22, 2008 Hi MikeP, I'm not sure this code as you are looking for. (defun c:test (/ ass el ent3 nval oldcmdecho olddimasz olddimblk olddimdec olddimexe olddimexo olddimgap olddimlim olddimse1 olddimse2 olddimtad olddimtdec olddimtih olddimtm olddimtol olddimtxt oldfilletrad oldosmode opt p1 p2 p3 sse str vaL) (setq oldosmode (getvar "osmode")) (setvar "osmode" 0) (setq oldcmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (setq olddimtxt (getvar "dimtxt")) (setq olddimdec (getvar "dimdec")) (setq olddimtad (getvar "dimtad")) (setq olddimse1 (getvar "dimse1")) (setq olddimse2 (getvar "dimse2")) (setq olddimexe (getvar "dimexe")) (setq olddimexo (getvar "dimexo")) (setq olddimgap (getvar "dimgap")) (setq olddimtih (getvar "dimtih")) (setq oldfilletrad (getvar "filletrad")) (setq olddimblk (getvar "dimblk")) (setq olddimasz (getvar "dimasz")) (setq olddimlim (getvar "dimlim")) (setq olddimtm (getvar "dimtm")) (setq olddimtol (getvar "dimtol")) (setq olddimtdec (getvar "dimtdec")) (setvar "dimtxt" 1) ; set text height (setvar "dimdec" 3) ; set decimal presicion (setvar "dimtad" 1) ; set vertical position (setvar "dimse1" 0) ; set Suppresses display of the first extension line (setvar "dimse2" 0) ; set Suppresses display of the second extension line (setvar "dimexe" 1) ; set Specifies how far to extend the extension line beyond the dimension line (setvar "dimexo" 1) ; set Specifies how far extension lines are offset from origin points (setvar "dimgap" 1) ; set Sets the distance around the dimension text when the dimension line breaks to accommodate dimension text (setvar "dimtih" 0) ; set Controls the position of dimension text inside the extension lines for all dimension types except ordinate (setvar "filletrad" 3) ; set radius of follet (setvar "dimblk" "_open") ; set style arrow (setvar "dimasz" 1) ; set arrow size (setvar "dimlim" 1) ; set limit (setvar "dimtm" 5) ; set lower limit (setvar "dimtol" 1) ; set limit (setvar "dimtdec" 0) ; set limit presicion (setq p1 (getpoint "\nSelect first end point: ")) (setq p2 (getpoint p1 "\nSelect second end point: ")) (setq p3 (getpoint p2 "\nPick any location above line: ")) (command "_dimlinear" p1 p2 "_n" p3 "") (setq el (entlast)) (setq sse (entget el)) (setq val (cdr (assoc 42 sse))) (setq str "\nDo you want to become measurement override(hit enter to exit)") (setq opt (getstring t (strcat str "< " (rtos val) " >: "))) (cond ((= opt "")(setq opt nil)) ((not (= opt "")) (setq nval (cons 1 opt)) (setq ass (assoc 1 sse)) (entmod (subst nval ass sse)))) (setvar "osmode" oldosmode) (setvar "cmdecho" oldcmdecho) (setvar "dimtxt" olddimtxt) (setvar "dimdec" olddimdec) (setvar "dimtad" olddimtad) (setvar "dimse1" olddimse1) (setvar "dimse2" olddimse2) (setvar "dimexe" olddimexe) (setvar "dimexo" olddimexo) (setvar "dimgap" olddimgap) (setvar "dimtih" olddimtih) (setvar "dimblk" olddimblk) (setvar "dimasz" olddimasz) (setvar "dimlim" olddimlim) (setvar "dimtm" olddimtm) (setvar "dimtol" olddimtm) (setvar "dimtdec" olddimtdec) (princ) ) ; defun Is anyone aware of a LISP that creates a dimension line but before you choose the position it asks for a measurement override. I'm tired of going into the properties each time I want to change the dimension. It should also prompt which type of dimension tool I want to use like either aligned or linear. or if anyone is up to the challenge of creating one for me that would great. Quote Link to comment Share on other sites More sharing options...
MikeP Posted April 22, 2008 Author Share Posted April 22, 2008 I have changed the code to a much simpler program. not sure why so many variables had to be assigned. but now the only thing i cant figure out is how to make the arrow sizes be the same as the dim style i have selected. it wants to set itself to 1. here is what I made it to (defun c:dimdim2 (/ ass el ent3 nval oldcmdecho olddimtih opt p1 p2 p3 sse str vaL) (setq oldcmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (setq olddimtih (getvar "dimtih")) (setvar "dimtih" 0) ; set Controls the position of dimension text inside the extension lines for all dimension types except ordinate (setq p1 (getpoint "\nSelect first end point: ")) (setq p2 (getpoint p1 "\nSelect second end point: ")) (setq p3 (getpoint p2 "\nPick any location above line: ")) (command "_dimaligned" p1 p2 "_n" p3 "") (setq el (entlast)) (setq sse (entget el)) (setq val (cdr (assoc 42 sse))) (setq str "\nDo you want to become measurement override(hit enter to exit)") (setq opt (getstring t (strcat str ": "))) (cond ((= opt "")(setq opt nil)) ((not (= opt "")) (setq nval (cons 1 opt)) (setq ass (assoc 1 sse)) (entmod (subst nval ass sse)))) (setvar "cmdecho" oldcmdecho) (setvar "dimtih" olddimtih) (princ) ) ; defun Quote Link to comment Share on other sites More sharing options...
ASMI Posted April 22, 2008 Share Posted April 22, 2008 This with dynamic dimension draw: (defun c:dover(/ cDim nVal) (vl-load-com) (and(vl-cmdf "_.dimaligned" pause pause pause) (setq cDim(vlax-ename->vla-object(entlast))) (setq nVal(getstring (strcat"\nDo you want override dimension? (Enter to exit) <" (rtos(vla-get-Measurement cDim)) ">: "))) (vla-put-TextOverride cDim nVal)) (princ) ); end of c:dover Quote Link to comment Share on other sites More sharing options...
au-s Posted January 28, 2009 Share Posted January 28, 2009 is there a way to make that lisp smarter like: Or maybe if the lisp searches dimstyle which I have in my dimstyle lisp and if it could not find it load the dimstyle, but if it loaded it uses it... ANd to disable override...??? (setq dimstyle (strcat "1_50")) (if dimstyle (if (tblsearch "dimstyle" 1_50) (command _dimstyle" "load" dimstyle and use it ( i could not find the command for it... ) then do the rest here (defun c:dimdim2 (/ ass el ent3 nval oldcmdecho olddimtih opt p1 p2 p3 sse str vaL) (setq oldcmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (setq olddimtih (getvar "dimtih")) (setvar "dimtih" 0) ; set Controls the position of dimension text inside the extension lines for all dimension types except ordinate (setq p1 (getpoint "\nSelect first end point: ")) (setq p2 (getpoint p1 "\nSelect second end point: ")) (setq p3 (getpoint p2 "\nPick any location above line: ")) (command "_dimaligned" p1 p2 "_n" p3 "") (setq el (entlast)) (setq sse (entget el)) (setq val (cdr (assoc 42 sse))) (setq str "\nDo you want to become measurement override(hit enter to exit)") (setq opt (getstring t (strcat str "< " (rtos val) " >: "))) (cond ((= opt "")(setq opt nil)) ((not (= opt "")) (setq nval (cons 1 opt)) (setq ass (assoc 1 sse)) (entmod (subst nval ass sse)))) (setvar "cmdecho" oldcmdecho) (setvar "dimtih" olddimtih) (princ) ) ; defun Thanx everyone Quote Link to comment Share on other sites More sharing options...
Girgilis Posted January 28, 2009 Share Posted January 28, 2009 Is there a way (or better a part of Alisp code ) that i can use to extract from a polyline or line LEvel-Height information>? Suppose that i'm not interested on 3d-polys... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 28, 2009 Share Posted January 28, 2009 I wrote a level height LISP a while back -- see here: http://www.cadtutor.net/forum/showthread.php?t=31363&highlight=floor+height+LISP Quote Link to comment Share on other sites More sharing options...
au-s Posted January 28, 2009 Share Posted January 28, 2009 This with dynamic dimension draw: (defun c:dover(/ cDim nVal) (vl-load-com) (and(vl-cmdf "_.dimaligned" pause pause pause) (setq cDim(vlax-ename->vla-object(entlast))) (setq nVal(getstring (strcat"\nDo you want override dimension? (Enter to exit) <" (rtos(vla-get-Measurement cDim)) ">: "))) (vla-put-TextOverride cDim nVal)) (princ) ); end of c:dover I tried this (defun c:dover(/ cDim nVal dstyl) (vl-load-com) ::: check for layer (setq oldlay (getvar "clayer")) (setvar "cmdecho" 0) (if (not (tblsearch "LAYER" "dim50")) (command "-layer" "M" "dim50" "C" "cyan" "dim50" "") (setvar "clayer" "dim50") ) ; end if (if (tblsearch "dimstyle" "my_dimstyle") (progn (setq dstyl (vla-item (vla-get-dimstyles *doc*) "my_dimstyle")) (vla-put-activedimstyle *doc* dstyl) ) ) (and(vl-cmdf "_.dimlinear" pause pause pause) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim dstyl)) (setvar "clayer" oldlay) (princ) ); end of c:dover I think its wrong cause its not working as I want it to work. I want the dim lisp to first look for my_dimstyle and if it does not find it load it from a dim.lsp where I have all the Dim variables set. The command there is C:dim ... and then follows dimvariables .. And of course to put the dimension in layer dim50 Quote Link to comment Share on other sites More sharing options...
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.