Message 1 of 3
Changing "dimension break" variable with Autolisp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was trying to create a lisp that would help me create some new dimension styles, but noticed this particular variable, dimension break, automatically becomes 3.75 for unknown reasons. Everything else seems ok. So I would like to ask if there is any simple additional lines of code I could add to ensure that value remains the same throughout the conversion. I have already tried to google this once but the one potential solution was very complicated for a novice to follow.
;;;ADD DIM STYLE
;;;jon's edit
;;;this program works well but pending only until I figure out why the dimension break
;;;value under symbols and arrows is always stuck at 3.75
;--------------------------------------------------
; MAIN ROUTINE
;--------------------------------------------------
(defun c:ad (/ *error* scale1 scale2 stylename oldstylename temp)
(command "._undo" "end" "._undo" "begin")
(setq scale1 (getvar "DIMSCALE"))
(setq scale1
(cond
((getreal (strcat "\nEnter primary scale: <" (rtos scale1 2 2) ">:")))
(scale1)
);cond. this lets me specify the prevailing value if input is ignored
)
(setq scale2
(cond
((getreal (strcat "\nEnter secondary scale: <" (rtos scale1 2 2) ">:")))
(scale1)
);cond. this lets me specify the prevailing value if input is ignored
)
(setq oldstylename (getvar 'DIMSTYLE))
(if (= scale1 scale2)
(setq stylename (strcat (substr oldstylename 1 3) "-" (rtos scale1 2 2)))
(setq stylename (strcat (substr oldstylename 1 3) "-" (rtos scale1 2 2) "-" (rtos scale2 2 2)))
);if
(setq temp (tblsearch "dimstyle" stylename)) ;check if existing name exists
(if (/= temp nil) (command ".-dimstyle" "save" stylename "Y") (command ".-dimstyle" "save" stylename))
(setvar "DIMSCALE" scale1)
(setvar "DIMLFAC" (/ scale2 scale1))
;POTENTIAL SOLUTION WITHIN HERE!
(command ".-dimstyle" "save" stylename "Y")
(princ)
(*error* nil)
)