Author Topic: Dimscale display  (Read 8127 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
Dimscale display
« on: January 28, 2009, 10:33:54 AM »
I want to create a button that when I click will display the Dimscale on the screen (not on the command line)

I know how to create the button, I'm not sure how to get it to output the result on the screen.

I also want it to convert the dimscale.  So if dimscale is 16 that would equal 3/4" = 1'.  I would end up w/ 15-16-17 different dimscales.





ronjonp

  • Needs a day job
  • Posts: 7527
Re: Dimscale display
« Reply #1 on: January 28, 2009, 10:44:24 AM »
Here's to show on screen with no conversion:

(alert (rtos (getvar 'dimscale)))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dimscale display
« Reply #2 on: January 28, 2009, 10:48:34 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Spike Wilbury

  • Guest
Re: Dimscale display
« Reply #3 on: January 28, 2009, 10:52:11 AM »
I'm sure I posted one of my old lisp functions rcmd-showScale

But for some reason, could not found it here....  :roll:

Shinyhead

  • Guest
Re: Dimscale display
« Reply #4 on: January 28, 2009, 11:16:39 AM »
what about modemacro?

I have a nearly identical command that does not use lisp and puts the dimscale as modemacro display.

main difference is it is a set dimscale command, you enter the ratio (i.e. "16" for 3/4"=1'-0") and it updates dimscale and displays the scale you just set until you reset it.

Only hitch is you don't display scale when a drawing is first opened until you hit this button.

^C^C_dimscale;\_MODEMACRO;DIMSCALE=$M=$(RTOS,$(/,12,$(GETVAR,DIMSCALE)))"""=12"""_;

Luke

  • Guest
Re: Dimscale display
« Reply #5 on: January 28, 2009, 11:30:37 AM »
Shiny,
Maybe mine is working wrong? 

When I click my button it puts this on command line and waits for input from me...


Shinyhead

  • Guest
Re: Dimscale display
« Reply #6 on: January 28, 2009, 11:39:14 AM »
thats correct, its to set dimscale and display it.

for just display try this

^C^C_MODEMACRO;DIMSCALE=$M=$(RTOS,$(/,12,$(GETVAR,DIMSCALE)))"""=12"""_;

(not tested, edited on the fly)

Luke

  • Guest
Re: Dimscale display
« Reply #7 on: January 28, 2009, 11:48:22 AM »
My dimscales set automatically when I insert the border.

I can also manually set them by clicking one of the buttons on the dimscale toolbar (see first screen shot beginning of thread)

Or I can click the DIM button and it will read the scale factor of my title block and set the dimscale to match accordingle.

All this is done so I only have one dimension style insetad of one for every scale factor.

The problem is that guys are complaining that if they have a drawing w/ many different title blocks in it they dont know what dimscale they are currently set to.  My solution is to type dimscale and look at our scale facto chart but that is not silver platter enough.  They want it instant...  Click this button and poof tells you it is set to 3/4" = 1' scale. So that is what I'm trying to figure out how to do.

skennedy

  • Guest
Re: Dimscale display
« Reply #8 on: January 28, 2009, 01:03:23 PM »
You could always use diesel:
[$(eval, Dimscale: $(getvar,dimscale))]
Just put it into a pulldown.

deegeecees

  • Guest
Re: Dimscale display
« Reply #9 on: January 28, 2009, 01:09:05 PM »
In your button properties, add a bit of lisp to send a dialog box to the screen as has been suggested, as in:

(alert "3/4=1")... and such, or...

use the MODEMACRO variable. this variable will display text on the bottom left of your application, as in:

(setvar "modemacro" "3/4=1")

Not tested.  <------------Discalimer

Shinyhead

  • Guest
Re: Dimscale display
« Reply #10 on: January 28, 2009, 01:10:52 PM »
also, in newer versions of autocad you can get the scale to display without quite so much code in the format you want, but it depends on if you are using annotative dimensioning and the like.

skennedy

  • Guest
Re: Dimscale display
« Reply #11 on: January 28, 2009, 01:19:23 PM »
You could use DGCS's idea with mine and type modemacro and paste the diesel code: [$(eval, Dimscale: $(getvar,dimscale))] into the new value prompt.
This will tell you the current dimscale setting and it will also update if the dimscale changes.  It will also stay on during the session and you could code it into the overall environment to work every time ACAD opens.

Luke

  • Guest
Re: Dimscale display
« Reply #12 on: January 28, 2009, 03:57:28 PM »
OK so too many time I ask the question here and I'm given "a fish"

I want to learn this stuff but when I only do it like 2 times a year it is tough to really learn and retain.

So I'm going to start over and go little by little...

If I put in the following
(alert "3/4in = 1'") it works

problem is I want this to say 3/4" = 1' not 3/4in

can anybody tell me how to get the " mark to show up on the alert box

dustinthiesse

  • Guest
Re: Dimscale display
« Reply #13 on: January 28, 2009, 04:00:26 PM »
OK so too many time I ask the question here and I'm given "a fish"

I want to learn this stuff but when I only do it like 2 times a year it is tough to really learn and retain.

So I'm going to start over and go little by little...

If I put in the following
(alert "3/4in = 1'") it works

problem is I want this to say 3/4" = 1' not 3/4in

can anybody tell me how to get the " mark to show up on the alert box

(alert "3/4\" = 1'")
EDIT:  Any time you want a quotation mark to show up inside a string you have to escape it with a \ so that the string doesn't end but keeps going.
« Last Edit: January 28, 2009, 04:03:45 PM by d-unit »

Luke

  • Guest
Re: Dimscale display
« Reply #14 on: January 28, 2009, 04:10:22 PM »
this is the site I'm using (in addition to swamp)
http://www.afralisp.net/index.htm

does anybody recommend any others?

deegeecees

  • Guest
Re: Dimscale display
« Reply #15 on: January 28, 2009, 04:11:14 PM »
You pretty much got the best right there.

dustinthiesse

  • Guest
Re: Dimscale display
« Reply #16 on: January 28, 2009, 04:19:59 PM »
this is the site I'm using (in addition to swamp)
http://www.afralisp.net/index.htm

does anybody recommend any others?

That one is pretty comprehensive and a very good resource.
Another that I found pretty helpful when I started learning lisp was
http://www.jefferypsanders.com/autolisptut.html

deegeecees

  • Guest
Re: Dimscale display
« Reply #17 on: January 28, 2009, 04:23:08 PM »
The Garden Path is a good tutorial/resource too, available in the Developer Help section of your installed AutoCad application, as well as the Developer Help section itself.

Luke

  • Guest
Re: Dimscale display
« Reply #18 on: January 30, 2009, 08:43:36 AM »
Still struggling w/ this...

I've got the defun and I've got the alert but can't understand the IF...

If dimscale = # then display alert...

but I can not just say (= dimscale 20) right?... cause = is for numbers and dimscale is a system variable?


dustinthiesse

  • Guest
Re: Dimscale display
« Reply #19 on: January 30, 2009, 09:27:21 AM »
Still struggling w/ this...

I've got the defun and I've got the alert but can't understand the IF...

If dimscale = # then display alert...

but I can not just say (= dimscale 20) right?... cause = is for numbers and dimscale is a system variable?

use getvar
Code: [Select]
(if (= (getvar 'dimscale) ##)) (alert........))

Luke

  • Guest
Re: Dimscale display
« Reply #20 on: January 30, 2009, 10:25:47 AM »
Thanks d-unit!

So here is where I am at now...
Code: [Select]
(defun c:dimscale_Display ()
(IF    (= (getvar 'dimscale) 1) (alert "12\"  =  1'"))
        (= (getvar 'dimscale) 2) (alert "6\"  =  1'")
        (= (getvar 'dimscale) 3) (alert "4\"  =  1'")
        (= (getvar 'dimscale) 4) (alert "3\"  =  1'")
        (= (getvar 'dimscale) 6) (alert "2\"  =  1'")
        (= (getvar 'dimscale) 8) (alert "1-1/2\"  =  1'")
        (= (getvar 'dimscale) 12) (alert "1\"  =  1'")
        (= (getvar 'dimscale) 16) (alert "3/4\"  =  1'")
        (= (getvar 'dimscale) 24) (alert "1/2\"  =  1'")
        (= (getvar 'dimscale) 32) (alert "3/8\"  =  1'")
        (= (getvar 'dimscale) 48) (alert "1/4\"  =  1'")
        (= (getvar 'dimscale) 64) (alert "3/16\"  =  1'")
        (= (getvar 'dimscale) 96) (alert "1/8\"  =  1'")
        (= (getvar 'dimscale) 128) (alert "3/32\"  =  1'")
        (= (getvar 'dimscale) 192) (alert "1/16\"  =  1'")
        (= (getvar 'dimscale) 384) (alert "1/32\"  =  1'")
        (t (alert "SCALE IS NOT STANDARD"))
)

as of right now this is giving every alert regardless of dimscale?

I've tried as cond instead of if but same results.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dimscale display
« Reply #21 on: January 30, 2009, 10:44:27 AM »
Code: [Select]
(defun c:dimscale_Display ( / msg)
  (if
    (setq msg (assoc (getvar 'dimscale)
                     '((1 "12\"  =  1'")
                       (2 "6\"  =  1'")
                       (3 "4\"  =  1'")
                       (4 "3\"  =  1'")
                       (6 "2\"  =  1'")
                       (8 "1-1/2\"  =  1'")
                       (12 "1\"  =  1'")
                       (16 "3/4\"  =  1'")
                       (24 "1/2\"  =  1'")
                       (32 "3/8\"  =  1'")
                       (48 "1/4\"  =  1'")
                       (64 "3/16\"  =  1'")
                       (96 "1/8\"  =  1'")
                       (128 "3/32\"  =  1'")
                       (192 "1/16\"  =  1'")
                       (384 "1/32\"  =  1'")
                       )))
    (alert (cadr msg))
    (alert "SCALE IS NOT STANDARD")
  )
  (princ)
  )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dimscale display
« Reply #22 on: January 30, 2009, 10:49:30 AM »
Didn't validate your data, but functionally this should work:

Code: [Select]
(defun c:DDimscale ( / desc )

    (princ
        (strcat "Dimscale is "
            (if
                (setq desc
                    (cadr
                        (assoc (getvar "dimscale")
                           '(
                                (  1 "12\" = 1'")
                                (  2 "6\" = 1'")
                                (  3 "4\" = 1'")
                                (  4 "3\" = 1'")
                                (  6 "2\" = 1'")
                                (  8 "1-1/2\" = 1'")
                                ( 12 "1\" = 1'")
                                ( 16 "3/4\" = 1'")
                                ( 24 "1/2\" = 1'")
                                ( 32 "3/8\" = 1'")
                                ( 48 "1/4\" = 1'")
                                ( 64 "3/16\" = 1'")
                                ( 96 "1/8\" = 1'")
                                (128 "3/32\" = 1'")
                                (192 "1/16\" = 1'")
                                (384 "1/32\" = 1'")
                            )
                        )
                    )
                )
                desc
                "NOT STANDARD"
            )
            "\n"
        )
    )
   
    (princ)       

)

I see CAB posted near verbatim code; sweet.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dustinthiesse

  • Guest
Re: Dimscale display
« Reply #23 on: January 30, 2009, 10:52:32 AM »
Nice CAB!!!

I've always used "assoc" when dealing with DFX lists, but never really thought about what it actually did haha.

This turns on so many lights!  :roll:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dimscale display
« Reply #24 on: January 30, 2009, 11:03:30 AM »
Wow MP, that's spooky.  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dimscale display
« Reply #25 on: January 30, 2009, 11:16:53 AM »
One upon a time it may have been spooky. After all these years being co-contributers (if I may be so immodest) to the swamp? Not so much.  :-)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Spike Wilbury

  • Guest
Re: Dimscale display
« Reply #26 on: January 30, 2009, 11:31:05 AM »
One upon a time it may have been spooky. After all these years being co-contributers (if I may be so immodest) to the swamp? Not so much.  :-)

when i was a lisp coder... i did or use many times an approach similar as yours....

Code: [Select]
;;;=========================================================

  (cond ;; no lleva marco, crear la variable "_tframe" = a "none" para compararla
;; dentro de la funcion "qdr-opening" que esta en idoor.lsp
((= idoor_frame "none") (setq _tframe "none"))
((= idoor_frame "2")
(setq _tframe "2")
(setq *rcmdFrameWidth* 2.0))
((= idoor_frame "4")
(setq _tframe "4")
(setq *rcmdFrameWidth* 4.0)))
  ;; tipo de puerta
  (setq block_dwg
(cdr
   (assoc idoor_doorname
  (list (cons "90 degrees swing" "90")
(cons "45 degrees swing" "45")
(cons "30 degrees swing" "30")
(cons "15 degrees swing" "15")
(cons "180 degrees swing" "180")
(cons "Pair 90 degrees swing" "PAIR")
(cons "Pair 90 degrees double egress" "DOUBLEA")
(cons "Sliding" "SLIDING")
(cons "Pocket" "POCKET")
(cons "Folding" "FOLDING")
(cons "Rolling" "ROLLING")))))

  ;; asegurarme que esta lista este vacia
  (setq marcos_lst nil)

  ;; instalar "point-x"
  (if (= idoor_position "point")
    (progn (setq encased idoor_opening)
   (setq ss (qdr-door-installer
      ;; distancia a la esquina
      (distof idoor_corner_ref 4)
      nil
      ;; ancho de la puerta
      (distof idoor_door_width 4)))))
  ;; instalar "centered"
  (if (= idoor_position "center")
    (progn (setq encased idoor_opening)

a code done many moons ago....  :-P

 :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dimscale display
« Reply #27 on: January 30, 2009, 11:44:56 AM »
Code: [Select]
...   (list (cons "90 degrees swing" "90")
(cons "45 degrees swing" "45")
(cons "30 degrees swing" "30")
(cons "15 degrees swing" "15")
(cons "180 degrees swing" "180")
(cons "Pair 90 degrees swing" "PAIR")
(cons "Pair 90 degrees double egress" "DOUBLEA")
(cons "Sliding" "SLIDING")
(cons "Pocket" "POCKET")
(cons "Folding" "FOLDING")
(cons "Rolling" "ROLLING")))))

I'm curious Luis, why not just quote the data since it's all literals?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Spike Wilbury

  • Guest
Re: Dimscale display
« Reply #28 on: January 30, 2009, 11:48:02 AM »
Code: [Select]
...   (list (cons "90 degrees swing" "90")
(cons "45 degrees swing" "45")
(cons "30 degrees swing" "30")
(cons "15 degrees swing" "15")
(cons "180 degrees swing" "180")
(cons "Pair 90 degrees swing" "PAIR")
(cons "Pair 90 degrees double egress" "DOUBLEA")
(cons "Sliding" "SLIDING")
(cons "Pocket" "POCKET")
(cons "Folding" "FOLDING")
(cons "Rolling" "ROLLING")))))

I'm curious Luis, why not just quote the data since it's all literals?

No idea.

That is one of my first lisps... to old - it is abandoned as basically all of my lisp routines....  :-(

:)

Luke

  • Guest
Re: Dimscale display
« Reply #29 on: January 30, 2009, 11:48:43 AM »
Thanks all.  I appreciate it.  Little by little I'm getting a better understanding.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dimscale display
« Reply #30 on: January 30, 2009, 11:59:44 AM »
No idea.

That is one of my first lisps... to old - it is abandoned as basically all of my lisp routines....  :-(

:)

Your programming language queue will only host one element?   ;-)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Spike Wilbury

  • Guest
Re: Dimscale display
« Reply #31 on: January 30, 2009, 12:14:59 PM »
No idea.

That is one of my first lisps... to old - it is abandoned as basically all of my lisp routines....  :-(

:)

Your programming language queue will only host one element?   ;-)

<If that's translate to if I can hold just one programming language... nope>

Today I spent my time in C++, MFC, ObjectARX, ATL, Custom Objects/Entities, and what I know so far about C#

<end my translation, if that was not your question, then please ignore me> :)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dimscale display
« Reply #32 on: January 30, 2009, 12:55:22 PM »
My obscure way of asking why you'd dump such an expressive little language like lisp when many of the other languages you're developing in are overkill for many day to day automation requirements. In particular it's odd to me because you're proficient in lisp and can knock out little lisp utils as required without much effort.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Spike Wilbury

  • Guest
Re: Dimscale display
« Reply #33 on: January 30, 2009, 01:45:48 PM »
My obscure way of asking why you'd dump such an expressive little language like lisp when many of the other languages you're developing in are overkill for many day to day automation requirements. In particular it's odd to me because you're proficient in lisp and can knock out little lisp utils as required without much effort.

Am I, maybe masochist ? maybe


But, I like a lot these new stuff... (and is not that hard at all)  ;-)