Scale Lisp

Scale Lisp

Jrooker06
Collaborator Collaborator
748 Views
3 Replies
Message 1 of 4

Scale Lisp

Jrooker06
Collaborator
Collaborator

I am looking for a lisp where i can type the commant SET and it will prompt me what scale i want (1/8,1/4,ect) and i can type 8 for the 1/8" scale and it will set my Dimscale to 96, my LTscale to 48 and change the Style text BNA-CKT (style),romans.shx (my font) change my height to 8", Widith factor would stay at 0.8 for all of them and angle would always stay at 0.00.

 

Does anyone know of a lisp that will do this?

0 Likes
749 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor

what you're asking for is similar to my Dwg Setup (DDSetup) app that you can download from the AutoCAD Exchange Store (Link in my signature below).

The only item missing is with the Text Style settings.  The wild card is with the Text Style Name.  I assume you don't want the same Text Style name BNA-CKT properties like the Text Height to be changed everytime you SET the scale to something else.  The recommended method is to have a different Text style naming convention for different scales ie: BNA-CKT-1-4 for 1/4 scale or BNA-CKT-1-8 for 1/8 scale and etc.  The same would be the case for setting Dimension Styles which you have left out in your request.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

smaher12
Advocate
Advocate

This should help you get started...

 

 

(defun C:set (/ scl)
  (initget "8 4")
    (setq scl (getkword "\nSpecify scale [1|8\" 1|4\"]: "))

    (cond 
      ((= scl "8") (setvar 'dimscale 96) (setvar 'ltscale 48)
        (command "-style" "BNA-CKT" "romans.shx" "8" "0.8" "0" "N" "N" "N")
      )
      ((= scl "4") (setvar 'dimscale 48) (setvar 'ltscale 24)
        (command "-style" "BNA-CKT" "romans.shx" "4" "0.4" "0" "N" "N" "N")
      )
    )
 (princ)
)
0 Likes
Message 4 of 4

Kent1Cooper
Consultant
Consultant

smaher's suggestion can be made more generic, so that it can allow for more scale options:

 

(defun C:SET (/ scl)
  (initget "16 8 4 2 1")
  (setq scl (atoi (getkword "\nSpecify denominator of scale 1/x\"=1'-0\" [16 8 4 2 1]: ")))
  (setvar 'dimscale (* scl 12))
  (setvar 'ltscale (* scl 6))
  (command "_.style" "BNA-CKT" "romans.shx" scl "0.8" "0" "N" "N" "N")
  (princ)
)

 

With a more wordy prompt and a somewhat different approach, because the (distof) function can convert a number typed as a fraction to a real number, it can allow for all the scales available on standard Architectural and Engineering scales:

 

(defun C:SET (/ scl df)
  (initget "3 1-1/2 1 3/4 1/2 3/8 1/4 3/16 1/8 3/32 1/16 10 20 30 40 50 60")
  (setq
    scl
    (getkword
      (strcat
        "\nNumber for Scale [inches per foot for Architectural, feet per inch for Engineering]: "
        "\n{3 1-1/2 1 3/4 1/2 3/8 1/4 3/16 1/8 3/32 1/16 10 20 30 40 50 60}: "
      ); strcat
    ); getkword
    df ; = drawing factor [ratio between reality and drawing]
    (cond
      ((= (rem (atoi scl) 10) 0) (* (atoi scl) 12)); Engineering Scale
      ((/ 12 (distof scl))); Architectural Scale
    ); cond
  ); setq
  (setvar 'dimscale df)
  (setvar 'ltscale (/ df 2))
  (command "_.style" "BNA-CKT" "romans.shx" (/ df 12.0) "0.8" "0" "N" "N" "N")
  (princ)
)

 

You can shorten the (initget) string and the prompt by removing any of the ones representing scales you are sure your Users would never need.

Kent Cooper, AIA
0 Likes