Hi All,
I have borrowed from another lisp routine to create the following to zoom to a entity based on an user input handle:
(defun c:zh ( / hdl xy enttype ed en xy2)
(setq YourHandle (getstring "\nEnter Handle: "))
(if (handent YourHandle)
(command "._zoom" "_ob" (handent YourHandle) "")
(princ "\nHandle not in drawing")
)
)
I did use part of the code from Nate Holt's routine (
http://nateholt.wordpress.com/2009/10/15/zoom-to-handle-utility-autocad-electrical/), but I did not use all of it for a number of reasons:
1. For a line entity it zooms to an endpoint, while I wanted to zoom to the entire entity. Which my modified routine does better, but not completely (I see that blocks are not zoomed in very well).
2. I did not want to have the option of continuously adding to the selection set (?) as my users will be editing one entity at a time.
3. The highlighting (?) in Nate's routine is not as clear as actually selecting the entity. I have overlapping entities in my drawings. For Nate's original routine the user would need to either:
i) Press return to end the routine (which then unhighlights the entity, counter to my purpose of showing the user the entity in question);
ii) Press escape which ends the routine and allows the user to manually select the entity (but with overlapping entities and the less clear highlighting this is not always easy). The user would now have to manually select the entity and escape to unhighlight it.
4. I want the entity selected as well as zoomed to in order to enable users to start editing object data, and/or move endpoints or blocks. Manually selecting would introduce additional user error.
But I lack the knowldge and/or couldn't find (or make work) code I found to select the handle. I would like to be able to zoom to the entity (centered on the entity and showing the entire entity) and then have the entity selected (grips) so that the user knows which entity it is (there are overlapping entities in my drawings).
I am using AutoCAD Map 3D 2014 if that makes any difference.
Thanks,
David
<edit: code tags added>