Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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")
)

Posted

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.

Posted

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

Posted

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

Posted
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

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