littlepeterpan821 Posted April 8, 2017 Posted April 8, 2017 I founded that this lisp is just simple but great, anyone can help me edit a little bit more pls!? I have a list of handle ID like A;B;C;D.... I wanna use this lisp for single HandleID either for multiple HandleID too!! ^^ Thank You in Advance!!!! (defun c:zh ( / YourHandle ll ur ) (vl-load-com) (setq YourHandle (getstring "\nEnter Handle: ")) (if (handent YourHandle) (progn (vla-getboundingbox (vlax-ename->vla-object (handent YourHandle)) 'll 'ur) (vla-zoomwindow (vlax-get-acad-object) ll ur) (sssetfirst nil (ssadd (handent YourHandle))) ) (princ "\nHandle not in drawing") ) (princ) ) Quote
wkplan Posted April 9, 2017 Posted April 9, 2017 Loop through each member of your list and pass it as an argument to your function. (defun c:test (/ choice handle-list) (vl-load-com) (setq handle-list (list "111" "112" "A" "B" "C" "D")) [color=red];yust an example[/color] (foreach item handle-list [color=red]; start the loop[/color] (initget "Yes No") [color=red]; pause or exit zooming #1[/color] (if item (progn (c:zh item) [color=red]; call your function[/color] (setq choice (getkword "\nZoom to next object? (Yes/No)"))[color=red]; pause or exit zooming #2[/color] (if (= choice "Yes") [color=red]; continue or exit the loop[/color] (princ "\nzooming to next object") (exit) ) ) ) ) (princ) [color=red]; force clean exit[/color] ) (defun c:zh ([color=blue]YourHandle[/color][color=red] /[/color] ll ur) ; note that "YourHandle" is now global (vl-load-com) [color=red] ;[/color](setq YourHandle (getstring "\nEnter Handle: ")) [color=red]; comment or delete this line[/color] (if (handent YourHandle) (progn (vla-getboundingbox (vlax-ename->vla-object (handent YourHandle)) 'll 'ur ) (vla-zoomwindow (vlax-get-acad-object) ll ur) (sssetfirst nil (ssadd (handent YourHandle))) ) (princ "\nHandle not in drawing") ) (princ) ) (c:test)[color=red];autostart[/color] regards Wolfgang Quote
Grrr Posted April 9, 2017 Posted April 9, 2017 The best idea for this might be to utilise the LM:ListBox and LM:SSBoundingBox functions. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.