Jump to content

Changing text color for Lisp Routines


mikman

Recommended Posts

Hey all,

I am wanting to just get real picky with what I am doing. I am trying to have a lisp routine run with a prompt telling me that it finished but I want it to be in a different color that the text in my command line. Is this possible? I couldn't find any comments on it anywhere.

 

 
(defun C:osm ()
(command "osmode" "163")
(prompt "Object Snap Mode is set to Meikle")
(prin1)
)

 

Here is an example, I'm new at this so it is really simple, but hey you gotta start somewhere!:D Any ideas can only help! Thanks all!

Link to comment
Share on other sites

(vl-load-com)

(defun #Asmi_Cmd_Line_ForeColor(Color / Col)
 (if(setq Col(cdr(assoc(strcase Color)
       '(("WHITE" . 16777215)("BLACK" . 2)
	 ("RED" . 255)("YELLOW" . 65535)
	 ("GREEN" . 65280)("CYAN" . 16776960)
	 ("BLUE". 16711680)("MAGENTA". 16711935)))))
  (vla-put-TextWinTextColor
    (vla-get-Display
      (vla-get-Preferences
 (vlax-get-acad-object)))
          (vlax-make-variant Col 19))
   ); end if
 (princ)
 ); end of #Asmi_Cmd_Line_ForeColor


(defun #Asmi_Cmd_Line_BackColor(Color / Col)
 (if(setq Col(cdr(assoc(strcase Color)
       '(("WHITE" . 16777215)("BLACK" . 2)
	 ("RED" . 255)("YELLOW" . 65535)
	 ("GREEN" . 65280)("CYAN" . 16776960)
	 ("BLUE". 16711680)("MAGENTA". 16711935)))))
  (vla-put-TextWinBackgrndColor 
    (vla-get-Display
      (vla-get-Preferences
 (vlax-get-acad-object)))
          (vlax-make-variant Col 19))
   ); end if
 (princ)
 ); end of #Asmi_Cmd_Line_BackColor

 

Usage example:

 

(#Asmi_Cmd_Line_ForeColor "red") ; to set red font
(#Asmi_Cmd_Line_BackColor "black") ; to set black background

 

> CAB

 

Tip!

 

BackColor = ForeColor and NOMUTT no need! :D

Link to comment
Share on other sites

  • 1 month later...

Alright so I am back now with another question about lisp and text. I was recently using a lisp that added up text in the drawing I was working in. I stopped working and qutoed "mktext" as the problem. I can't modify the routine, its locked and the owner doesn't work with me anymore. :( Where can I find a place that would have a lisp that I could read and learn for myself?

Link to comment
Share on other sites

You say the routine added up text...

Did the routine sum the value of text strings that were numerical?

 

BTW, you might want to start a new thread with a new topic heading...

Link to comment
Share on other sites

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