AutoCAD Civil 3D General Discussion

AutoCAD Civil 3D General Discussion

Reply
New Member
balvernaz
Posts: 2
Registered: ‎01-30-2014
Message 1 of 2 (284 Views)
Accepted Solution

Opening old DWG files in US Survey Foot

284 Views, 1 Replies
01-30-2014 04:01 PM

 

When I open drawing that we created using 2008 LDD on Civil 3D 2012, the drawings are opening as International Foot. I would like them to open as US Survey Foot. I understand that the current way to change this is got to the Drawings Settings and change it via the drop dropdown box. Due to the high number of drawings that my company has. This would be too cumbersome and hard for the employees to remember to do.  Does anybody know a way that would allow me to open every drawing using US Survey Foot instead of International Foot by default (either by lisp routines, macros, etc). Your help would be greatly appreciated.

You can add this to your acaddoc.lsp (create it if it doesn't exist with notepad and place it in the Acad support path). Once it's loaded you can either call it by the command name "SETUSFOOT" or add (c:setusfoot) immediately following the code in the acaddoc.lsp.

 

Limited testing done, but seems to do what you need.

(defun c:setusfoot (/ *acad* c3d c3ddoc code convflag doc dwgsettings prod
prodstr settings unitzone zone
)
(vl-load-com)
(setq prod (vlax-product-key))
(setq prodStr (strcat "AeccXUiLand.AeccApplication"
(cond ((vl-string-search "\\R17.0\\" prod)
".4.0"
)
;;2007
((vl-string-search "\\R17.1\\" prod)
".5.0"
)
;;2008
((vl-string-search "\\R17.2\\" prod)
".6.0"
)
;;2009
((vl-string-search "\\R18.0\\" prod)
".7.0"
)
;;2010
((vl-string-search "\\R18.1\\" prod)
".8.0"
)
;;2011
((vl-string-search "\\R18.2\\" prod)
".9.0"
)
;;2012
((vl-string-search "\\R19.0\\" prod)
".10.0"
)
;;2013
((vl-string-search "\\R19.1\\" prod)
".10.3"
)
;;2014
(t "")
)
)
)
(if (and (setq *acad* (vlax-get-acad-object))
(setq doc (vla-get-activedocument *acad*))
(setq C3D (vla-getinterfaceobject *acad* prodStr))
(setq C3Ddoc (vla-get-activedocument C3D))
(setq settings (vlax-get c3ddoc 'settings))
(setq dwgsettings (vlax-get settings 'drawingsettings))
(setq unitzone (vlax-get dwgsettings 'unitzonesettings))
(setq convflag (vlax-get unitzone 'foottometerconversionflag))
)
(progn
(if (= convflag 1)
(progn
(vlax-put unitzone 'foottometerconversionflag 2)
(princ "\n*****Drawing conversion changed from International Foot to US Survey foot!!*****")
)
)
(vlax-release-object C3D)
)
)
(princ)
)

 

*Expert Elite*
Jeff_M
Posts: 4,518
Registered: ‎07-22-2003
Message 2 of 2 (264 Views)

Re: Opening old DWG files in US Survey Foot

01-30-2014 07:06 PM in reply to: balvernaz

You can add this to your acaddoc.lsp (create it if it doesn't exist with notepad and place it in the Acad support path). Once it's loaded you can either call it by the command name "SETUSFOOT" or add (c:setusfoot) immediately following the code in the acaddoc.lsp.

 

Limited testing done, but seems to do what you need.

(defun c:setusfoot (/ *acad* c3d c3ddoc code convflag doc dwgsettings prod
		      prodstr settings unitzone zone
		   )
  (vl-load-com)
  (setq prod (vlax-product-key))
  (setq	prodStr	(strcat	"AeccXUiLand.AeccApplication"
			(cond ((vl-string-search "\\R17.0\\" prod)
			       ".4.0"
			      )
			      ;;2007
			      ((vl-string-search "\\R17.1\\" prod)
			       ".5.0"
			      )
			      ;;2008
			      ((vl-string-search "\\R17.2\\" prod)
			       ".6.0"
			      )
			      ;;2009
			      ((vl-string-search "\\R18.0\\" prod)
			       ".7.0"
			      )
			      ;;2010
			      ((vl-string-search "\\R18.1\\" prod)
			       ".8.0"
			      )
			      ;;2011
			      ((vl-string-search "\\R18.2\\" prod)
			       ".9.0"
			      )
			      ;;2012
			      ((vl-string-search "\\R19.0\\" prod)
			       ".10.0"
			      )
			      ;;2013
			      ((vl-string-search "\\R19.1\\" prod)
			       ".10.3"
			      )
			      ;;2014
			      (t "")
			)
		)
  )
  (if (and (setq *acad* (vlax-get-acad-object))
	   (setq doc (vla-get-activedocument *acad*))
	   (setq C3D (vla-getinterfaceobject *acad* prodStr))
	   (setq C3Ddoc (vla-get-activedocument C3D))
	   (setq settings (vlax-get c3ddoc 'settings))
	   (setq dwgsettings (vlax-get settings 'drawingsettings))
	   (setq unitzone (vlax-get dwgsettings 'unitzonesettings))
	   (setq convflag (vlax-get unitzone 'foottometerconversionflag))
      )
    (progn
      (if (= convflag 1)
	(progn
	  (vlax-put unitzone 'foottometerconversionflag 2)
	  (princ "\n*****Drawing conversion changed from International Foot to US Survey foot!!*****")
	  )
	)
      (vlax-release-object C3D)
    )
  )
  (princ)
)

 

Jeff_M, also a frequent Swamper
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.