The code supplied by Andrew in this thread http://forums.autodesk.com/t5/autocad-civil-3d-customization/code-to-extract-all-surface-boundaries/... worked great in 2014 but not in 2015.
I get the following message and then Civil crashes....:(
Does anyone have time to take a look at the source code and tweak for 2015 please?
Many thanks
Neil
neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Solved! Go to Solution.
Solved by tyronebk. Go to Solution.
Neil, I rewrote the code in lisp so it can be used in any version released to date (at least since the ability to extract the boundaries was added).
(defun c:extractallsurfaceboundaries (/ c3d c3ddoc surfs) (if (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) C3D (vl-registry-read C3D "Release") C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) ) C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) ) ) (progn (setq c3ddoc (vlax-get c3d 'activedocument) surfs (vlax-get c3ddoc 'surfaces) ) (vlax-for surf surfs (vlax-invoke surf 'extractborder 1) ) (vlax-release-object c3d) ) ) (princ) )
Just copy the code to a blank text document and save it as a .lsp file (or add it directly to your acaddoc.lsp).
Thanks Jeff - but it crashed when I tried to run it......:(
neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Still the same error message.....
neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Jeff just forgot to acquire the ACAD object. Replace *acad* with (vlax-get-acad-object) and it should work as expected.
Edit: Actually, here's the modified code so that people don't have to parse the entire thread to get it working.
(defun c:extractallsurfaceboundaries( / c3d c3ddoc surfs *acad* ) (if (setq *acad* (vlax-get-acad-object) c3d (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) c3d (vl-registry-read c3d "Release") c3d (substr c3d 1 (vl-string-search "." c3d (+ (vl-string-search "." c3d) 1) ) ) c3d (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." c3d) ) ) (progn (setq c3ddoc (vlax-get c3d 'activedocument) surfs (vlax-get c3ddoc 'surfaces) ) (vlax-for surf surfs (vlax-invoke surf 'extractborder 1) ) (if (not (vlax-object-released-p c3d) ) (vlax-release-object c3d) ) (if (not (vlax-object-released-p *acad*) ) (vlax-release-object *acad*) ) ) ) (princ) ) (vl-load-com)
neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.