Jump to content

Recommended Posts

Posted

But I tried anyway, using Lee's code all in a line:

(vla-get-Height (vla-get-ActiveTextStyle (vla-get-ActiveDocument (vlax-get-acad-object))))

because I'm a glutton for punishment, and I really wanted it to work.

It does return the correct value when run from the command line.

 

This bit of ugliness didn't work either:

(setq style (tblsearch "style" "standard"))
(setq tHgt (dxf 40 style))

 

Steve

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    22

  • alanjt

    12

  • MarcoW

    7

  • StevJ

    5

Top Posters In This Topic

Posted Images

Posted

Yes, Steve,

 

It will work if you just set it using LISP, but it won't update Real-time, 'cause you need either Diesel or a reactor of some form for that :thumbsup:

Posted

If you opted for the reactor, this would work:

 

(defun c:styON ( )
 (vl-load-com)
 (if (not *sty-reac*)
   (progn
     (setq *sty-reac*
       (vlr-command-reactor nil
         (list
           (cons :vlr-commandCancelled 'sSet)
           (cons :vlr-commandEnded     'sSet))))
     (setq *doc (vla-get-ActiveDocument
                  (vlax-get-acad-object))
           *oldmode (getvar "MODEMACRO"))
     (setvar "MODEMACRO"
       (strcat "tSze: "
         (rtos
           (vla-get-height
             (vla-get-ActiveTextStyle *doc)))))
     (princ "\n<<-- Reactor Initiated -->>"))
   (princ "\n<<-- Reactor Already Running! -->>"))
 (princ))

(defun sSet (Reac Args)
 (if (eq "STYLE" (strcase (car Args)))
   (setvar "MODEMACRO"
     (strcat "tSze: "
       (rtos
         (vla-get-height
           (vla-get-ActiveTextStyle *doc))))))            
 (princ))

(defun c:styOFF ( )
 (vl-load-com)
 (if (and *sty-reac* (vlr-added-p *sty-reac*))
   (progn
     (vlr-remove *sty-reac*)
     (if *oldmode (setvar "MODEMACRO" *oldmode))
     (setq *doc nil *sty-reac* nil *oldmode nil)
     (princ "\n<<-- Reactor Deactivated -->>"))
   (princ "\n<<-- Reactor Is Not Activated -->>"))
 (princ))

Posted

Wow. Thanks again, Lee.

I'll give it a test at work tomorrow on acad 2006.

I kept getting "error: no function definition: VLR-COMMAND-REACTOR" on my 2010 trial version at home.

Interestingly, though, on my 2010 trial version, alanjt's modemacro

 (setvar "modemacro" "Mr YOUR NAME: DSc=$(getvar,dimscale).TSz=$(getvar,textsize). ALT_U=$(getvar,DIMALTF).")

works just fine and instantly displays text height as it changes.

 

Steve

Posted

Hi all,

 

First of all: I never knew it was possible, putting something custom in the statusbar. I think it is very cool to put the company name in there. It would wonder some people how it was done :).

 

The routine Lee provided is great! The fact it is realtime (reactor) makes it usable too. Only I think the textheight is not that interesting. To display the dimscale in the statusbar is very handy: especially when one draws in multiple scales.

 

Anyone got ideas of what might be nice to put in the statusbar?

Posted
Wow. Thanks again, Lee.

I'll give it a test at work tomorrow on acad 2006.

I kept getting "error: no function definition: VLR-COMMAND-REACTOR" on my 2010 trial version at home.

Interestingly, though, on my 2010 trial version, alanjt's modemacro

 (setvar "modemacro" "Mr YOUR NAME: DSc=$(getvar,dimscale).TSz=$(getvar,textsize). ALT_U=$(getvar,DIMALTF).")

works just fine and instantly displays text height as it changes.

 

Steve

 

Steve,

 

Normally a "no function definition" means that (vl-load-com) hasn't been initiated, but this is obviously not the case, as my code shows.

 

But, interestingly, this has happened to others using 2010:

 

http://www.theswamp.org/index.php?topic=29484.0

 

Hi all,

 

First of all: I never knew it was possible, putting something custom in the statusbar. I think it is very cool to put the company name in there. It would wonder some people how it was done :).

 

The routine Lee provided is great! The fact it is realtime (reactor) makes it usable too. Only I think the textheight is not that interesting. To display the dimscale in the statusbar is very handy: especially when one draws in multiple scales.

 

Anyone got ideas of what might be nice to put in the statusbar?

 

Thanks Marco,

 

Just as an aside, you don't need to use a reactor to make the status bar update automatically - DIESEL will have the same effect - but I provided the reactor option in response to Steve's difficulties.

 

I have seen the company name there, yes. I sometimes build the status bar text into my programs - see here for example:

http://www.cadtutor.net/forum/showthread.php?t=37859

 

Lee

Posted

$(getvar,cannoscale)

here, use this to test your work:

(defun c:Diesel (/ #Diesel)
 (and (not
        (eq ""
            (setq #Diesel (getstring T "\nDiesel text string: "))
        ) ;_ eq
      ) ;_ not
      (princ (menucmd (strcat "M=" #Diesel)))
 ) ;_ and
 (princ)
) ;_ defun

Posted

I wonder how that should work, I don't get it at all :oops:

 

Of course due to my lack of diesel / lisp knowledge

Posted
I wonder how that should work, I don't get it at all :oops:

 

Of course due to my lack of diesel / lisp knowledge

 

execute the command, then type in something like: $(getvar,cannoscale)

Posted
Alan's LISP will read and princ a valid DIESEL expression :thumbsup:

 

thought it might make testing a little easier.:dwg:

haha, my mood is autocad.

Posted

Lee, the reactor you posted works just fine in ACAD 2006 I use at work.

I'm constantly amazed, as I read through the various threads on this forum, at the quick and seemingly easy way you have of helping folks, with your contribution of useful programs and code.

Thank you again for sharing your programming skills.

 

Steve

Posted

Thanks Steve, your welcome :)

 

But really, I am still learning myself - only been programming for 10 months or so and still have a great deal to learn.

Posted

Lee,

 

This is what I have made of it. Works all nice...

 

 
(defun c:styON ( )
(setq d (rtos (getvar "CDATE") 2 6)
yr (substr d 3 2)
mo (substr d 5 2)
day (substr d 7 2)
company "My Company"
lname (getvar "loginname")
)
 (vl-load-com)
 (if (not *sty-reac*)
   (progn
     (setq *sty-reac*
       (vlr-command-reactor nil
         (list
           (cons :vlr-commandCancelled 'sSet)
           (cons :vlr-commandEnded     'sSet))))
     (setq *doc (vla-get-ActiveDocument
                  (vlax-get-acad-object))
           *oldmode (getvar "MODEMACRO"))
     (setvar "MODEMACRO"
       (strcat company ": welcome " lname " - Today is " day "/" mo "/" yr
         ))))
 (princ))
(defun sSet (Reac Args)
 (if (eq "STYLE" (strcase (car Args)))
   (setvar "MODEMACRO"
       (strcat company ": welcome " lname " - Today is " day "/" mo "/" yr
       )))            
 (princ))
(defun c:styOFF ( )
 (vl-load-com)
 (if (and *sty-reac* (vlr-added-p *sty-reac*))
   (progn
     (vlr-remove *sty-reac*)
     (if *oldmode (setvar "MODEMACRO" *oldmode))
     (setq *doc nil *sty-reac* nil *oldmode nil)))
 (princ))

Posted

Just curious - why the reactor for that?

 

Why not use a Diesel?

(setvar "MODEMACRO"
 (strcat "The Date is: "
   (menucmd "M=$(edtime,$(getvar, date),DD/MO/YYYY)")))

Posted

THe answer is simple, I know how to edit the lisp routine (a bit :oops:).

Diesel I don't know, only in command buttons or in menu files.

 

I know, I am Dutch... :)

Posted

Ok, well in DIESEL:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:MdON [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] company[b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] company [b][color=#ff00ff]"Marco Industries"[/color][/b][b][color=RED])[/color][/b]
 
 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] *oldMode* [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"MODEMACRO"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"MODEMACRO"[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] company [b][color=#ff00ff]": Welcome "[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]menucmd[/color][/b] [b][color=#ff00ff]"M=$(getvar,loginname)"[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]" - Today is "[/color][/b]
       [b][color=RED]([/color][/b][b][color=BLUE]menucmd[/color][/b] [b][color=#ff00ff]"M=$(edtime,$(getvar,date),DD/MO/YYYY)"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:MdOFF [b][color=RED]([/color][/b] [b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] *oldMode* [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=#ff00ff]"MODEMACRO"[/color][/b] *oldMode*[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] *oldMode* [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b]       
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

Posted

Lee,

 

I have exchanged both files. The diesel one works the same for my use. The reason I prefer this one is the less amount coding. Tnx for this.

 

Now I am just curious. Let's say this is a strange or funny thing to do within autocad; putting text right there in the left bottom corner. Never knew it was possible and it will catch my collegues eyes.

 

Are there more funny things to do with autocad, just to experiment with? I tried one of those games, not very cool to play but very cool to see how it was made. Maybe the autocad window can be "see through" (opacity)... o:)

Posted

haha - you just want something to impress your colleagues :D

 

Well, I'm not sure there are many things that aren't obvious, but I suppose you could change the setting of the sys var: MTJIGSTRING :)

Posted

It is possible to get AutoCAD to 'speak' to the user

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