Author Topic: Setting dimscale with a reactor, error when setting dimscale  (Read 105 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 908
Setting dimscale with a reactor, error when setting dimscale
« on: January 10, 2017, 01:43:38 pm »
The title doesn't justify my issue but I'll explain.
The reactor routine works fine if I double clicked on paper space then double clicked on a view  port then double click on a different viewport. However, if I switched between viewports without switching to paperspace first, i get this error.
Code: [Select]
Command: ; error: AutoCAD variable setting rejected: "dimscale" 40.0
; error: AutoCAD variable setting rejected: "dimscale" 10.0
; error: AutoCAD variable setting rejected: "dimscale" 40.0

Code: [Select]
; reactor
(defun VPActivated_OnLoad ()
  (if *VPActivated_SysVarReactor*
    (vlr-remove *VPActivated_SysVarReactor*))
  (setq *VPActivated_sysVarReactor* (vlr-sysvar-reactor
     nil
     '((:vlr-sysVarChanged . VPActivated_CallBack))))
  (princ "\nVPActivated is running")
)

;callback
(defun VPActivated_CallBack (rea lst /)
  (if (and (= (car lst) "CVPORT")
   (>= (getvar "CVPORT") 2)
   )
    (setvar "dimscale" (/ 1.0 (getvar "CANNOSCALEVALUE"))))
)

; load
(VPActivated_OnLoad)
; unload function
(defun c:VPActivated_UnLoad ()
  (if *VPActivated_SysVarReactor*
    (vlr-remove *VPActivated_SysVarReactor*))
  (princ)
)