Author Topic: how can i display dimscale with active dwg  (Read 3993 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Swamp Rat
  • Posts: 566
how can i display dimscale with active dwg
« on: November 22, 2011, 11:07:14 AM »
I have the following code in my acaddoc that displays the dimscale of the dwg. (mode macro)
however if i have multiple dwgs opened, it displays the same dimscale across all the dwgs of the last opened dwg.

anyone have any ideas on how to make it so it displays the right dimscale depending on what dwg is active?
I imaging by using vlisp would do it but im not sure how to impliment it

any help or pointers is appreciated

Code: [Select]
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
)

Code: [Select]
(setq modmac (atoi (rtos (getvar "dimscale"))))

(IF (= modmac 1) (setvar "modemacro" "...DWG DIMSCALE IS... 12 = 1' - 0"))
(IF (= modmac 2) (setvar "modemacro" "...DWG DIMSCALE IS... 6 = 1' - 0"))
(IF (= modmac 3) (setvar "modemacro" "...DWG DIMSCALE IS... 4 = 1' - 0"))
(IF (= modmac 4) (setvar "modemacro" "...DWG DIMSCALE IS... 3 = 1' - 0"))
(IF (= modmac 6) (setvar "modemacro" "...DWG DIMSCALE IS... 2 = 1' - 0"))
(IF (= modmac 8) (setvar "modemacro" "...DWG DIMSCALE IS... 1 1/2 = 1' - 0"))
(IF (= modmac 12) (setvar "modemacro" "...DWG DIMSCALE IS... 1 = 1' - 0"))
(IF (= modmac 16) (setvar "modemacro" "...DWG DIMSCALE IS... 3/4 = 1' - 0"))
(IF (= modmac 24) (setvar "modemacro" "...DWG DIMSCALE IS... 1/2 = 1' - 0"))
(IF (= modmac 32) (setvar "modemacro" "...DWG DIMSCALE IS... 3/8 = 1' - 0"))
(IF (= modmac 48) (setvar "modemacro" "...DWG DIMSCALE IS... 1/4 = 1' - 0"))
(IF (= modmac 64) (setvar "modemacro" "...DWG DIMSCALE IS... 3/16 = 1' - 0"))
(IF (= modmac 96) (setvar "modemacro" "...DWG DIMSCALE IS... 1/8 = 1' - 0"))
(IF (= modmac 128) (setvar "modemacro" "...DWG DIMSCALE IS... 3/32 = 1' - 0"))

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #1 on: November 22, 2011, 12:13:11 PM »
Your setting your modemacro with a string rather than an equation.

Code: [Select]
(setvar 'MODEMACRO (blah blah))
Here's mine:

Code: [Select]
                 ("modemacro"
                  "$(getvar,clayer)  ($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))  Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)  Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) "
                 )
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

andrew_nao

  • Swamp Rat
  • Posts: 566
Re: how can i display dimscale with active dwg
« Reply #2 on: November 22, 2011, 02:23:00 PM »
Your setting your modemacro with a string rather than an equation.

Code: [Select]
(setvar 'MODEMACRO (blah blah))
Here's mine:

Code: [Select]
                 ("modemacro"
                  "$(getvar,clayer)  ($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))  Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)  Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) "
                 )

I tried to load yours via lisp and i get bad function error
when i enter it manually (copy n paste) it displays the code and not the date, time or anything that its supposed to

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #3 on: November 22, 2011, 02:25:10 PM »
Your setting your modemacro with a string rather than an equation.

Code: [Select]
(setvar 'MODEMACRO (blah blah))
Here's mine:

Code: [Select]
                 ("modemacro"
                  "$(getvar,clayer)  ($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))  Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)  Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) "
                 )

I tried to load yours and i get bad function error
that's because you have to apply a function to the list. This is one variable in a list of system variables feed to a foreach statement that uses vl-catch-all-apply to apply the variable change.

Just add setvar as the first item in the list.

eg.
Code: [Select]
(setvar "modemacro" blah blah)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #4 on: November 22, 2011, 02:31:39 PM »

It wasn't really given so you could use it, but more so you could look through the bit of code and see how modemacro is being evaluated vs. yours.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox


andrew_nao

  • Swamp Rat
  • Posts: 566
Re: how can i display dimscale with active dwg
« Reply #6 on: November 23, 2011, 09:45:11 AM »

It wasn't really given so you could use it, but more so you could look through the bit of code and see how modemacro is being evaluated vs. yours.


i was trying to see how it worked, cause i wasnt understanding some of it.

yours does the same thing, when you open a dwg, its displays that dwgs info if you goto a dwg you have open (hidden in the background) it displays the info from the dwg you last opened and not the info for the current active dwg.


« Last Edit: November 23, 2011, 09:52:56 AM by andrew_nao »

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #7 on: November 23, 2011, 10:52:41 AM »

It wasn't really given so you could use it, but more so you could look through the bit of code and see how modemacro is being evaluated vs. yours.


i was trying to see how it worked, cause i wasnt understanding some of it.

yours does the same thing, when you open a dwg, its displays that dwgs info if you goto a dwg you have open (hidden in the background) it displays the info from the dwg you last opened and not the info for the current active dwg.
It should - works on my machine...


Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #8 on: November 23, 2011, 11:04:49 AM »
Sorry for the crappy delay in the video, I had 2009 open at moment and it just doesn't do well with jumping between active drawings.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

cmwade77

  • Swamp Rat
  • Posts: 1361
Re: how can i display dimscale with active dwg
« Reply #9 on: November 23, 2011, 03:12:19 PM »
I agree, it works, but it might be some issues with some extra returns and such, here is exactly how I have it:
Code: [Select]
(setvar "modemacro" "$(getvar,clayer)  ($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))  Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)  Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) ")

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #10 on: November 23, 2011, 03:18:08 PM »
I agree, it works, but it might be some issues with some extra returns and such, here is exactly how I have it:
Code: [Select]
(setvar "modemacro" "$(getvar,clayer)  ($(edtime, $(getvar,date),H:MMam/pm) - $(edtime,$(getvar,date),M.DD.YY))  Textsize: $(getvar,textsize) $(if, $(!=, $(getvar,viewtwist), 0), Viewtwist: $(angtos, $(getvar,viewtwist) [, 0, 2]) , ) AnnoScale: $(getvar,cannoscale)  Dimscale: $(getvar,dimscale) $(if, $(!=, $(getvar,filletrad), 0), FilletRad: $(getvar,filletrad), ) $(if, $(=, $(getvar,worlducs), 1),*WCS* ,*NON-WCS*) ")
possible, but I've been using that since I wrote it for 2006 and never had a problem.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

andrew_nao

  • Swamp Rat
  • Posts: 566
Re: how can i display dimscale with active dwg
« Reply #11 on: November 29, 2011, 01:40:11 PM »
Quote from: alanjt link=topic=40164.msg454428#msg454428 It should - works on my machine...
[/quote

what do you use to make that animation?

my tabs are up top so i dont know if i could get it to work

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #12 on: November 29, 2011, 01:44:45 PM »
I use Camtasia for screen capturing and Drawing Tabs Manager for the obvious.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3756
Re: how can i display dimscale with active dwg
« Reply #13 on: November 29, 2011, 01:52:51 PM »
I use Camtasia for screen capturing and Drawing Tabs Manager for the obvious.

Interesting, I've never used Drawing Tabs before, so I'm not sure where they differ, but I use AutoCAD's free bonus tool MDITabs and am quite happy with it.

** Edit to add - The AutoCAD 2010 .ARX file supports 2010 Database, meaning releases 2010-2012. Note there's a different file for 32-Bit, and 64-Bit environments.
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5349
  • Standby for witty remark...
Re: how can i display dimscale with active dwg
« Reply #14 on: November 29, 2011, 02:32:34 PM »
I use Camtasia for screen capturing and Drawing Tabs Manager for the obvious.

Interesting, I've never used Drawing Tabs before, so I'm not sure where they differ, but I use AutoCAD's free bonus tool MDITabs and am quite happy with it.
I've used it for years. I tried the AutoCAD one when it was released but went back to Drawing Tabs.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox