Hey Jeff,
I hope all is well!
I've been using this for years now and it's been working great. I've just been adding the following.
((vl-string-search "R18.0" vrsn) (setq appstr "7.0"))
;;2010
((vl-string-search "R18.1" vrsn) (setq appstr "8.0"))
;;2011
((vl-string-search "R18.2" vrsn) (setq appstr "9.0"))
;;2012
((vl-string-search "R18.3" vrsn) (setq appstr "10.0"))
;;2013
((vl-string-search "R19.0" vrsn) (setq appstr "11.0"))
;;2014
(t (alert "This version of C3D not supported!"))
But it dosn't seem to be working any more.... Any ideas? Below is all of the code.... Thanks Again!!
;;
(defun jmm-resetunits (/ vrsn appstr acad-app civil-app civil-doc curunits
settings)
(vl-load-com)
(setq vrsn (vlax-product-key))
;;not sure if this command was available in earlier versions
(cond ((vl-string-search "R18.0" vrsn) (setq appstr "7.0"))
;;2010
((vl-string-search "R18.1" vrsn) (setq appstr "8.0"))
;;2011
((vl-string-search "R18.2" vrsn) (setq appstr "9.0"))
;;2012
((vl-string-search "R18.3" vrsn) (setq appstr "10.0"))
;;2013
((vl-string-search "R19.0" vrsn) (setq appstr "11.0"))
;;2014
(t (alert "This version of C3D not supported!"))
)
(if appstr
(progn
(setq acad-app (vlax-get-acad-object)
civil-app (vlax-invoke-method
acad-app
'Getinterfaceobject
(strcat "AeccXUiLand.AeccApplication." appstr)
) ;_ end of vlax-invoke-method
civil-doc (vla-get-ActiveDocument civil-app)
settings (vlax-get (vlax-get (vlax-get civil-doc 'settings)
'drawingsettings
)
'unitzonesettings
)
)
(setq curunits (vlax-get settings 'drawingunits))
(if (> curunits 2);;not feet or meters
(progn
(if (= 0 (getvar "measureinit"))
(vlax-put settings 'drawingunits 1);;feet
(vlax-put settings 'drawingunits 2);;meters
)
)
)
(vlax-put settings 'ScaleObjectsFromOtherDrawings 0)
(vlax-put settings 'matchautocadvariables :vlax-true)
)
)
)
(jmm-resetunits)
;;
Jeff:
Nevermind, I figured it out. I had an extra release and my R19 backwards.... Below is the update and it works...
Thanks Again for this Excelent Code!!
;;
(defun jmm-resetunits (/ vrsn appstr acad-app civil-app civil-doc curunits
settings)
(vl-load-com)
(setq vrsn (vlax-product-key))
;;not sure if this command was available in earlier versions
(cond ((vl-string-search "R18.0" vrsn) (setq appstr "7.0"))
;;2010
((vl-string-search "R18.1" vrsn) (setq appstr "8.0"))
;;2011
((vl-string-search "R18.2" vrsn) (setq appstr "9.0"))
;;2012
((vl-string-search "R19.0" vrsn) (setq appstr "10.0"))
;;2013
(t (alert "This version of C3D not supported!"))
)
(if appstr
(progn
(setq acad-app (vlax-get-acad-object)
civil-app (vlax-invoke-method
acad-app
'Getinterfaceobject
(strcat "AeccXUiLand.AeccApplication." appstr)
) ;_ end of vlax-invoke-method
civil-doc (vla-get-ActiveDocument civil-app)
settings (vlax-get (vlax-get (vlax-get civil-doc 'settings)
'drawingsettings
)
'unitzonesettings
)
)
(setq curunits (vlax-get settings 'drawingunits))
(if (> curunits 2);;not feet or meters
(progn
(if (= 0 (getvar "measureinit"))
(vlax-put settings 'drawingunits 1);;feet
(vlax-put settings 'drawingunits 2);;meters
)
)
)
(vlax-put settings 'ScaleObjectsFromOtherDrawings 0)
(vlax-put settings 'matchautocadvariables :vlax-true)
)
)
)
(jmm-resetunits)
;;
Hey Jeff,
I hope all is well!!
It looks like we still have some drawings set to inches floating around my company...
I'm having problems running this lisp in the latest version of C3D (It runs, but nothing happens...). I looked into it a bit and I found a command that would alter the embeded untis even if you're not running C3D. -DwgUnits and/or -AECDwgUnits. (I think they are the same command, not sure)
Is there any chance this can be re-writen to fix the -DwgUnits in (R) 2014 (19.1)?
Thanks!
Paul