« T minus 1 Week... | Main | How it's Made Part 2 »

Tuesday, November 25, 2008

Fix Me....

Alright, I have been babbling a lot about non CAD things for a little while. Now it's time to talk about some AutoCAD Electrical stuff I used in the past. Basically the concept is to have a block named fix_me that you insert this symbol into your drawing where you know you need to do some rework. This symbol could have the intelligence that trims out your wires, has descriptions etc... Then when you use the next / previous drawing tools it automatically finds this block, then zooms in on it. Here is the information from the help file on how to do it.

You can set up to have an AutoLisp utility run each time you open a project drawing from the project manager or the "next/previous" toolbar button picks.

Steps:

  • Create and test the AutoLisp utility that you want to execute as each drawing opens.
    Open the "wd.env" file with a text editor, find the "WD_OPEN_DWG" line and un-comment it (remove the leading (*) character and insert a call to your self-starting AutoLisp routine.
    Save the wd.env file and restart AutoCAD Electrical.
    Make sure your utility loads (either automatically or through an explicit load included in the command string.
  • A simple example: you want to be able to insert a special "fix me" block on a drawing as a reminder that something needs further attention. If this block exists on a drawing when it is opened from the project manager window or from the next/previous toolbar buttons, then the drawing will zoom up on the block before anything else happens. Here's the AutoLisp utility you might create to do this (saved as file name "fix_me.lsp" and saved to a folder in the AutoCAD search path):


(defun c:fix_me ( / ss en ed xy)
  ; Look for any block insert on the drawing with a block name of "FIX_ME"
  (setq ss (ssget "_X" '((-4 . "<AND")(0 . "INSERT")(2 . "FIX_ME")(-4 . "AND>"))))
  (if (/= ss nil)
    (progn ; one or more found. Zoom up on the first one found
      (setq en (ssname ss 0)) ; entity name of first or only block
      (setq ss nil) ; release the selection set
      (setq ed (entget en))
      (setq xy (cdr (assoc 10 ed))) ; block insertion point
      (command "_.ZOOM" "_CENTER" xy 1.0)
      (princ "\nThis needs attention!!!\n")
  ) )   
  (princ)
)

Here's the uncommented line in the wd.env file (includes an explicit load of the above utility each time):


WD_OPEN_DWG,(if(not c:fix_me)(if(setq x(findfile "fix_me.lsp"))(load x)))(if c:fix_me (c:fix_me))


Let me know how it helps.

 

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83482650853ef0105361a4f04970b

Listed below are links to weblogs that reference Fix Me....:

Comments

The comments to this entry are closed.