Surface elevation -- Jeff Michler et al

Surface elevation -- Jeff Michler et al

Anonymous
Not applicable
245 Views
2 Replies
Message 1 of 3

Surface elevation -- Jeff Michler et al

Anonymous
Not applicable
LDT2004
The attached is a boiled-down and augmented version of Jeff's original. Works fine, but
does damage to the stability of Acad; after using it and running a few commands, the
program terminates abruptly; no invitation to save, just wham! I have an ungrounded
suspicion that there is a conflict with autosave but who knows? Saving immediately after
use is a good idea but does not forestall ultimate doom. Maybe I cut out some important
stuff? Maybe repeated invocation of (vlax-get-acad-object) and the other starter items
confuses the program?

rs
0 Likes
246 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
When using VLA-OBJECTS that are not native to Autocad they usually need to
be released or these type of problems arise.

I just ran this about 30 times, sometimes by cancelling, others by erroring
(i don't have all of the subroutines....), without having a melt down occur.

I've heard that the method I use to set the AeccApplication fails in
LDT2008. I'll post an update once I have it installed to verify.

[code]
;elev. point on surface and optional mark.
;thanks, Jeff Mishler.
(defun C:sue ( / acadObj aecApp aecSurfs aecSurf aecUtil pno e-n selev nelev
*error* aecsurfnm newpoint pt3d appstr) ;
(defun *error* (msg)
(if msg
(progn
(princ msg)
(princ "\nProgram \"sue\" aborted...")
)
)
(vl-catch-all-apply
'(lambda ()
(mapcar 'vlax-release-object (reverse (list aecApp aecSurfs aecSurf
aecUtil)))
)
)
(princ)
)
(setq
appstr (cond
((= (setq versn (atoi (substr (getvar "acadver") 1 2)))
15
)
"2"
)
((= versn 16) "4")
((= versn 17) "6")
)
)
(setq aecApp(vla-getinterfaceobject(vlax-get-acad-object) (strcat
"Aecc.Application." appstr))
aecSurfs(vlax-get(vlax-get aecApp "Activeproject") "Surfaces")
aecUtil(vlax-get(vlax-get aecApp "activedocument") "Utility"))
(setq aecSurfnm(vlax-get aecSurfs "Currentsurface")) ;the name
(setq aecSurf(vlax-invoke aecSurfs "item" aecSurfnm)) ;the surface object
(while (setq pno(getpoint "\nPoint within Surface: "))
(setq e-n (vlax-invoke aecUtil "xytoeastnorth" pno))
(setq selev
(VL-CATCH-ALL-APPLY 'vlax-invoke (list aecSurf "getelevation" (car e-n)
(cadr e-n))))
(if (numberp selev) ;we have an elevation
(progn
(princ(setq nelev(rtos selev 2 2))) ;show the elev at command line
(if(member (getstring "\nMark? ") '("Y" "y" "")) ;user option to
insert to dwg.
(progn
(command "undo" "begin") ;set undo
(setq pt3d(list (car pno)(cadr pno) selev))
(setq newpoint(#mkpoint pt3d))
;lay ins hgt strg rot hjust vjust
(#mktext(getvar "clayer") (getpoint "\nLABEL LOCATION: ") 0 (strcat "
" nelev) 0 0 2) ;make a label
(acet-group-make-anon (list newpoint (entlast)) "") ; make the text
and wipeout a group
(command "undo" "end")
) ;progn
) ;if
) ;progn
;;if no
(princ (vl-catch-all-error-message selev))
) ;if
) ;while
(*error* nil)
(princ)) ;defun
[/code]
"tcebob" wrote in message
news:5572985@discussion.autodesk.com...
LDT2004
The attached is a boiled-down and augmented version of Jeff's original.
Works fine, but
does damage to the stability of Acad; after using it and running a few
commands, the
program terminates abruptly; no invitation to save, just wham! I have an
ungrounded
suspicion that there is a conflict with autosave but who knows? Saving
immediately after
use is a good idea but does not forestall ultimate doom. Maybe I cut out
some important
stuff? Maybe repeated invocation of (vlax-get-
acad-object) and the other starter items
confuses the program?

rs
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thank you, sir. I will try it. If it fails I will know that my third suspicion was valid:
my computer hates me.

Had I known that someone was actually going to run the routine I would have included
#mktext and #mkpoint.

rs


"Jeff Mishler" wrote in message
news:5573079@discussion.autodesk.com...
When using VLA-OBJECTS that are not native to Autocad they usually need to
be released or these type of problems arise.

I just ran this about 30 times, sometimes by cancelling, others by erroring
(i don't have all of the subroutines....), without having a melt down occur.

I've heard that the method I use to set the AeccApplication fails in
LDT2008. I'll post an update once I have it installed to verify.

[code]
;elev. point on surface and optional mark.
;thanks, Jeff Mishler.
(defun C:sue ( / acadObj aecApp aecSurfs aecSurf aecUtil pno e-n selev nelev
*error* aecsurfnm newpoint pt3d appstr) ;
(defun *error* (msg)
(if msg
(progn
(princ msg)
(princ "\nProgram \"sue\" aborted...")
)
)
(vl-catch-all-apply
'(lambda ()
(mapcar 'vlax-release-object (reverse (list aecApp aecSurfs aecSurf
aecUtil)))
)
)
(princ)
)
(setq
appstr (cond
((= (setq versn (atoi (substr (getvar "acadver") 1 2)))
15
)
"2"
)
((= versn 16) "4")
((= versn 17) "6")
)
)
(setq aecApp(vla-getinterfaceobject(vlax-get-acad-object) (strcat
"Aecc.Application." appstr))
aecSurfs(vlax-get(vlax-get aecApp "Activeproject") "Surfaces")
aecUtil(vlax-get(vlax-get aecApp "activedocument") "Utility"))
(setq aecSurfnm(vlax-get aecSurfs "Currentsurface")) ;the name
(setq aecSurf(vlax-invoke aecSurfs "item" aecSurfnm)) ;the surface object
(while (setq pno(getpoint "\nPoint within Surface: "))
(setq e-n (vlax-invoke aecUtil "xytoeastnorth" pno))
(setq selev
(VL-CATCH-ALL-APPLY 'vlax-invoke (list aecSurf "getelevation" (car e-n)
(cadr e-n))))
(if (numberp selev) ;we have an elevation
(progn
(princ(setq nelev(rtos selev 2 2))) ;show the elev at command line
(if(member (getstring "\nMark? ") '("Y" "y" "")) ;user option to
insert to dwg.
(progn
(command "undo" "begin") ;set undo
(setq pt3d(list (car pno)(cadr pno) selev))
(setq newpoint(#mkpoint pt3d))
;lay ins hgt strg rot hjust vjust
(#mktext(getvar "clayer") (getpoint "\nLABEL LOCATION: ") 0 (strcat "
" nelev) 0 0 2) ;make a label
(acet-group-make-anon (list newpoint (entlast)) "") ; make the text
and wipeout a group
(command "undo" "end")
) ;progn
) ;if
) ;progn
;;if no
(princ (vl-catch-all-error-message selev))
) ;if
) ;while
(*error* nil)
(princ)) ;defun
[/code]
"tcebob" wrote in message
news:5572985@discussion.autodesk.com...
LDT2004
The attached is a boiled-down and augmented version of Jeff's original.
Works fine, but
does damage to the stability of Acad; after using it and running a few
commands, the
program terminates abruptly; no invitation to save, just wham! I have an
ungrounded
suspicion that there is a conflict with autosave but who knows? Saving
immediately after
use is a good idea but does not forestall ultimate doom. Maybe I cut out
some important
stuff? Maybe repeated invocation of (vlax-get-
acad-object) and the other starter items
confuses the program?

rs
0 Likes