Jump to content

help with routine to modify properties in all dimstyles


Recommended Posts

Posted

hello:

I found this on the internet 

(defun c:TEST ( / d e)
  (while (setq d (tblnext "DIMSTYLE" (null d)))
    (setq e (tblobjname "DIMSTYLE" (cdr (assoc 2 d))))
    (setpropertyvalue e "DIMCLRE" 10)
    (setpropertyvalue e "DIMCLRD" 15)
   ) 
  (command "_.-DIMSTYLE" "_Restore" (getvar 'dimstyle))
  (princ)
  )

 

modifies color in all existing dimstyles.

I would like everyone to have the type of text  "ARIAL NARROW".

 

CAN SOMEONE HELP?

 

thanks

 

 

Posted

Copying a list from within a LISP, so some of the setvar have variables applied from earlier in that LISP. However for your question, the variable names and descriptions are all below, you'll be wanting to use DIMTXSTY I think, perhaps with a preceding bit of code to check or otherwise load that the font you want is loaded, or an alternative is used instead.

 

The original source that I copied the list from is referenced at the top and this should be all the dimension variables

 

;;https://help.autodesk.com/view/ACDLTM/2016/ENU/?guid=GUID-30F44A49-4250-42D1-AEF2-5E2914ADB02B
;;         List     value    ;; Default       ;;Description
 (setvar "DIMADEC"  TxtPrecision)  ;; 0       ;;Angular Dimension Decimal Places
;  (setvar "DIMALT"    0)    ;; 0              ;;Control of alternative units 0 - Off 1 - On
  (setvar "DIMALTD"   TxtPrecision)    ;; 2 / 3          ;;Alternative Units Decimal Places
;  (setvar "DIMALTF" 0.0394) ;; 25.4 / 0.0394  ;;Alternative Units Scale Factor
;;(setvar "DIMALTMZF")      ;;                ;;Alternate sub-zero factor for metric dimensions - Unknown variable
;;(setvar "DIMALTMZS")      ;;                ;;Alternate sub-zero suffix for metric dimensions - Unknown variable
;  (setvar "DIMALTRND" 0.00) ;; 0.00           ;;Alternate units rounding value
;  (setvar "DIMALTTD"  3)    ;; 2 / 3          ;;Alternative Units Tolerance Decimal Places
;  (setvar "DIMALTTZ"  0)    ;; 0              ;;Alternate tolerance zero suppression
;  (setvar "DIMALTU"   2)    ;; 2              ;;Alternative Units Units
;  (setvar "DIMALTZ"   0)    ;; 0              ;;Alternate unit zero suppression
;  (setvar "DIMAPOST" "")    ;; ""             ;;Prefix and suffix for alternate text
;  (setvar "DIMARCSYM" 0)    ;; 0              ;;Arc Length Dimension Arc Symbol
  (setvar "DIMASZ" FontHeight) ;; 0.18 / 2.5  ;;Dimension Line and Leader Line Arrow Heads size
;  (setvar "DIMATFIT"  3)    ;; 3              ;;Arrow and text fit if distance is too narrow for both
;  (setvar "DIMAUNIT"  0)    ;; 0              ;;Angular unit format
;  (setvar "DIMAZIN"   0)    ;; 0              ;;Angular Dimension Depresses leading zeros
;  (setvar "DIMBLK"  ".")    ;; "."            ;;Arrow block name "." for closed flled else as properties
;  (setvar "DIMBLK1" ".")    ;; "."            ;;First arrow block name "." for closed flled else as properties
;  (setvar "DIMBLK2" ".")    ;; "."            ;;Second arrow block name "." for closed flled else as properties
  (setvar "DIMCEN" FontHeight) ;; 0.09 / 2.5  ;;Drawing centre mark for radius or diameter dimensions
  (setvar "DIMCLRD" LinCol) ;; 0              ;;Colours - Lines, ArrowHeads, Dimension Lines 0: ByLayer, 256 ByBlock
  (setvar "DIMCLRE" LinCol) ;; 0              ;;Colours - Extension Lines, Centre Marks Colours 0: ByLayer, 256 ByBlock
  (setvar "DIMCLRT" TxtCol) ;; 0              ;;Colours - Dimension Text Colour 0: ByLayer, 256 ByBlock
  (setvar "DIMDEC"  TxtPrecision)  ;; 0       ;;Dimension Decimal Places
;  (setvar "DIMDLE"    0)    ;; 0.0000         ;;Dimension Line extension with oblique strokes instead of arrows
;  (setvar "DIMDLI"    4)    ;; 3.75           ;;Dimension Baseline Dimension Spacing
  (setvar "DIMDSEP" ".")    ;; .              ;;Decimal separator
  (setvar "DIMEXE" (/ Fontheight 2)) ;; 0.18 / 1.25    ;;Extension Line Extension distance
  (setvar "DIMEXO" (/ Fontheight 4)) ;; 0.0625 / 0.625 ;;Extension Line Offset
;  (setvar "DIMFRAC"   0)    ;; 0              ;;Dimension Fraction Format
;  (setvar "DIMFXL" 1.00)    ;; 1              ;;Fixed Extension Line
;  (setvar "DIMFXLON"  0)    ;; 0              ;;Enable Fixed Extension Line 0 - Off 1 - On
  (setvar "DIMGAP" (/ FontHeight 4)) ;; 0.09 / 0.625   ;;Dimension gap between text and arrow 
  (setvar "DIMJOGANG" (* pi (/ 45 180.0))) ;; ;;Radius dimension jog angle.. radians?
;  (setvar "DIMJUST"   0)    ;; 0              ;;Justification of text on dimension line
  (setvar "DIMLDRBLK" ".")  ;; "."            ;;Leader block name "." for closed flled else as properties
;  (setvar "DIMLFAC" 1.00)   ;; 1              ;;Linear unit scale factor
;  (setvar "DIMLIM"    0)    ;; 0              ;;Generate dimension limits 0 - Off 1 - On
  (setvar "DIMLTEX1" "BYBLOCK")    ;;  "."    ;;Linetype extension line 1
  (setvar "DIMLTEX2" "BYBLOCK")    ;;  "."    ;;Linetype extension line 2
  (setvar "DIMLTYPE" "BYBLOCK")    ;;  "."    ;;Dimension linetype
;  (setvar "DIMLUNIT"  2)    ;; 2              ;;Dimension Units (except angular) - number type
;  (setvar "DIMLWD"   -2)    ;; -2             ;;Dimension Line Lineweights
;  (setvar "DIMLWE"   -2)    ;; -2             ;;Extension Line Line Weight
;;(setvar "DIMMZF")         ;;                ;;Sub-zero factor for metric dimensions - Unknown variable
;;(setvar "DIMMZS")         ;;                ;;Sub-zero suffix for metric dimensions - Unknown variable
;  (setvar "DIMPOST" "")     ;; ""             ;;Prefix and suffix for dimension text
;  (setvar "DIMRND"   0)     ;; 0              ;;Dimension Round distance to nearest n
;  (setvar "DIMSAH"   0)     ;; 0              ;;Separate arrow blocks 0 - Off 1 - On
;  (setvar "DIMSCALE" 1)     ;; 1              ;;Dimension Scale Factor
;  (setvar "DIMSD1"   0)     ;; 0              ;;Suppress the first dimension line 0 - Off 1 - On
;  (setvar "DIMSD2"   0)     ;; 0              ;;Suppress the second dimension line 0 - Off 1 - On
;  (setvar "DIMSE1"   0)     ;; 0              ;;Suppress the first extension line 0 - Off 1 - On
;  (setvar "DIMSE2"   0)     ;; 0              ;;Suppress the second extension line 0 - Off 1 - On
;  (setvar "DIMSOXD"  0)     ;; 0              ;;Suppress outside dimension lines
;  (setvar "DIMTAD"   0)     ;; 0              ;;Dimension Text Vertical distance
;  (setvar "DIMTDEC"  4)     ;; 4              ;;Tolerance decimal places
;  (setvar "DIMTFAC"  1)     ;; 1              ;;Dimension text scale factor of fractions relative to text height
;  (setvar "DIMTFILL" 0)     ;; 0              ;;Text background enabled
;  (setvar "DIMTFILLCLR" 0)  ;; 0              ;;Text background color 0: ByLayer, 256 ByBlock
;  (setvar "DIMTIH"   0)     ;; 0              ;;Text inside extensions is horizontal 0 - Off 1 - On
;  (setvar "DIMTIX"   0)     ;; 0              ;;Place text inside extensions 0 - Off 1 - On
;  (setvar "DIMTM"    0)     ;; 0              ;;Dimension Minus tolerance distance when used with dimtol, or dimlim
;  (setvar "DIMTMOVE" 0)     ;; 0              ;;Text movement
;  (setvar "DIMTOFL"  0)     ;; 0              ;;Force line inside extension lines 0 - Off 1 - On
;  (setvar "DIMTOH"   1)     ;; 1              ;;Text outside horizontal 0 - Off 1 - On
;  (setvar "DIMTOL"   0)     ;; 0              ;;Tolerance dimensioning 0 - Off 1 - On
;  (setvar "DIMTOLJ"  1)     ;; 0              ;;Tolerance vertical justification
;  (setvar "DIMTP"    0)     ;; 0              ;;Dimension Plus tolerance distance when used with dimtol, or dimlim
;  (setvar "DIMTSZ" 0.00)    ;; 0              ;;Tick size
;  (setvar "DIMTVP" 0.00)    ;; 0              ;;Text vertical position
  (setvar "DIMTXSTY" FontName)     ;; Font    ;;Text style
  (setvar "DIMTXT" FontHeight)     ;; 0.18 / 2.5   ;;Dimension text Height
;;(setvar "DIMTXTDIRECTIONOff" 0)  ;;         ;;Dimension text direction 1 or 0 - NOT SURE IF THIS WORKS
;  (setvar "DIMTZIN"  8)     ;; 8              ;;Suppresses leading zeros in tolerance values
;  (setvar "DIMUPT"   0)     ;; 0              ;;User positioned text 0 - Off 1 - On
;  (setvar "DIMZIN"   8)     ;; 8              ;;Suppresses leading zeroes

 

  • Thanks 1

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