Applying scale to Dimension displayed in DCL

#1
My next problem!
So I've added a 'Metric/Imperial' Scaling toggle to my DCL & LSP files, RB24.
See image below, highlighted red.
This works in part, in that when the 'toggle' is selected (ticked) the scale is applied to the inserted blocks.
It also is applied to the Pipe creation/extrusion.
Image
.

Code: Select all


	(defun RB24_FLAG ()
	(setq sca "1")						;store metric / imperial scale
	);end RB24_FLAG
;-----------------------------------------------	
(defun SET_DIM ()
	(setvar 'dimzin 0)
    (setq
    N1 (nth 3 SIZE_DIMS)
    N2 (nth 4 SIZE_DIMS)
    N3 (nth 5 SIZE_DIMS)
    N4 (nth 6 SIZE_DIMS)
    N5 (nth 7 SIZE_DIMS)
    N6 (nth 8 SIZE_DIMS)
    N7 (nth 9 SIZE_DIMS)
    N8 (nth 10 SIZE_DIMS)
    N9 (nth 11 SIZE_DIMS)
    N10 (nth 12 SIZE_DIMS)
    ) ;end setq
;
  (set_tile "n1" (rtos N1 2 2))
  (set_tile "n2" (rtos N2 2 2))
  (set_tile "n3" (rtos N3 2 2))
  (set_tile "n4" (rtos N4 2 2))
  (set_tile "n5" (rtos N5 2 2))
  (set_tile "n6" (rtos N6 2 2))
  (set_tile "n7" (rtos N7 2 2))
  (set_tile "n8" (rtos N8 2 1))
  (set_tile "n9" (rtos N9 2 2))  
  (set_tile "n10" (rtos N10 2 2))
  (setvar 'dimzin 8)
;
  (if (= SCA "1")(SCA_TO_IMP)) ;_ end of if	;NEW LINE ADDED FOR SCALING	
;
) ;End SET_DIM
 ;------------------------------------------------------------------------;
	(defun SCA_TO_IMP ()
	   (setq scal "0.03937")
	  (setq
      N1  (* N1 0.03937)
      N2  (* N2 0.03937)
      N3  (* N3 0.03937)
      N4  (* N4 0.03937)
      N5  (* N5 0.03937)
      N6  (* N6 0.03937)
      N7  (* N7 0.03937)
      N8  (* N8 0.03937)
      N9  (* N9 0.03937)
      N10  (* N10 0.03937)
	 );end of setq
) ;End SCA_TO_IMP
My next goal is to apply the scaling factor to the displayed dimensions, highlighted blue in the image.
Here I'm struggling, can anyone give me a few pointers?
Full code attached.
SteveN
Attachments
SLN_PIPING-REV 2-0-4-9A-ICAD9-0.zip
(6.33 KiB) Downloaded 193 times

Re: Applying scale to Dimension displayed in DCL

#2
Solved :)

For anyone following:
Revised code for RB24 (also renamed as TB24, as it's a 'toggle')

Code: Select all

	(defun TB24_FLAG ()
	(setq sca $value)	;store metric / imperial scale
	);end TB24_FLAG
Then the code for SCALE_TO_IMP was modified to:

Code: Select all

(defun SCA_TO_IMP ()
  (cond ((= SCA "1")(setq scal "0.039370"))
		(T (setq scal "25.40000"))
		) ;end of cond
;		
	  (cond ((= SCA "1")(setq insertscal "0.039370"))
		(T (setq insertscal "1.000000"))
		) ;end of cond
;  
  (setq
      N1  (* N1 (atof scal))
      N2  (* N2 (atof scal))
      N3  (* N3 (atof scal))
      N4  (* N4 (atof scal))
      N5  (* N5 (atof scal))
      N6  (* N6 (atof scal))
      N7  (* N7 (atof scal))
      N8  (* N8 (atof scal))
      N9  (* N9 (atof scal))
      N10  (* N10 (atof scal))
	 );end of setq
;
  (set_tile "n1" (rtos N1 2 2))
  (set_tile "n2" (rtos N2 2 2))
  (set_tile "n3" (rtos N3 2 2))
  (set_tile "n4" (rtos N4 2 2))
  (set_tile "n5" (rtos N5 2 2))
  (set_tile "n6" (rtos N6 2 2))
  (set_tile "n7" (rtos N7 2 2))
  (set_tile "n8" (rtos N8 2 1))
  (set_tile "n9" (rtos N9 2 2))  
  (set_tile "n10" (rtos N10 2 2))	 
;
) ;End SCA_TO_IMP
.

S.