flowerrobot Posted November 5, 2008 Posted November 5, 2008 Sorry guys, its one of those code that are so simple you carnt see the answer. (defun C:5() (setq pt(getpoint "\nStart point of text: ")) (setq tsc (* 5 (getvar "dimscale"))) (command "-color" "red") (command "_.mtext" pt "h" tsc "@500,-500" pause) (command "-color" "bylayer") ) Easy huh, does it work, almost, pause gives /p & -color bylayer, then the text. while "no pause" just gives -color bylayer, then the text. all i wont is one click mtext, also how would i make the "@500,-500" relative to my dimscale? (setq di (* 500 (getvar "dimscale")) (setq tdi (strcat ("@" di "," di))) Thanks heaps, i did search but to no avail, also how do you debug you commands? i know their is a cad script editor, but i dnt know how to make that show the code, how the code acts and where it fails, normall i paste bit by bit to find out where it fails, but i generally dont know why it is, any help would be great Quote
CmdrDuh Posted November 5, 2008 Posted November 5, 2008 is the 500,500 based on dimscale of 1 or *5 ? Anyway, (car pt) will give you the X value of point picked, (cadr pt) gives you the Y, so you could add 500 or -500 to the X or Y from here and generate a new point. Quote
flowerrobot Posted November 5, 2008 Author Posted November 5, 2008 is this what your saying? Tho this dosnt work. (defun C:5() (setq pt(getpoint "\nStart point of text: ")) (Setq xc(car pt)) (setq yc(cadr pt)) (setq tdi (strcat (xc "," yc))) (setq tsc (* 5 (getvar "dimscale"))) (command "-color" "red") (command "_.mtext" pt "h" tsc tdi pause) (command "-color" "bylayer") ) Quote
neekcotrack Posted November 6, 2008 Posted November 6, 2008 I have something like that is diesel: -style;romans;romans.shx;(/ 10 (/ 96 (getvar "dimscale")));.8;0;no;no;no;-layer;m;TEXT;c;3;;;-mtext;\@500,-500; Hope this helps. Quote
ASMI Posted November 6, 2008 Posted November 6, 2008 Usage 'pause' with MText is not good idea. Do something like this example: (defun c:5(/ pt tsc oStr tStr) (setq pt(getpoint "\nStart point of text: ") tsc (* 5 (getvar "dimscale")) oStr ""); end setq (while(/= "" tStr) (setq tStr(getstring T "\nMText: ") oStr(strcat oStr "\\P" tStr) ); end setq ); end while (setvar "CECOLOR" "1") (command "_.mtext" pt "_h" tsc "@500,-500" oStr "") (setvar "CECOLOR" "256") (princ) ); end of c:5 Quote
flowerrobot Posted November 6, 2008 Author Posted November 6, 2008 Thanks you very much. works great, dont under stand it, (not good with the strings bit) is their any way to create the mtext pop up box? but still have commands run after it? ty Quote
ASMI Posted November 7, 2008 Posted November 7, 2008 is their any way to create the mtext pop up box? You can create empty string MText and run MTEDIT command: (defun c:5(/ pt tsc oStr tStr) (setq pt(getpoint "\nStart point of text: ") tsc (* 5 (getvar "dimscale"))); end setq (setvar "CECOLOR" "1") (command "_.mtext" pt "_h" tsc "@500,-500" " " "") (command "_.mtedit"(entlast)) (setvar "CECOLOR" "256") (princ) ); end of c:5 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.