Here is a sample AutoLisp utility that will generate a "fixed" wire number
based upon the tag name and pin number of devices connected at each end of a
wire segment. This only works for situations where there are two devices,
though you could probably enhance it to build wire numbers where there were
more than two connected devices. If you wanted to get fancy, you could make
this utilty work "drawing wide" or even "project wide".
To use: make sure AcadE is "awake". APPLOAD this utility. Type milnum
[Enter] at command line to execute.
(defun c:milnum ( / en ed x compconlst comp1_en comp2_en pin1 pin2
new_wireno
netlst str comp1_tag comp2_tag xterm1_en xterm2_en)
(while (setq x (entsel "\nSelect wire for special MIL wire number
format:"))
(setq en (car x))
(setq ed (entget en))
(if (= (cdr (assoc 0 ed)) "LINE")
(progn ; okay to continue
(if (setq netlst (c:wd_get_wire_netlst en 1))
(progn
(setq compconlst (nth 9 netlst))
(cond
((= (length compconlst) 2)
; two connected components, okay to continue
(setq comp1_en (car (car compconlst)))
(setq comp2_en (car (cadr compconlst)))
(setq xterm1_en (cadr (car compconlst)))
(setq xterm2_en (cadr (cadr compconlst)))
; Get the suffix of the first component's X?TERMxx attrib
(setq str (cdr (assoc 2 (entget xterm1_en))))
; Get PIN number of first component
(setq pin1 (c:wd_getattrval comp1_en (strcat "TERM" (substr
str 7))))
(if (AND (not pin1) (c:wd_getattrval comp1_en "TAGSTRIP"))
; Terminal symbol, just grab the TERM01 terminal number
(setq pin1 (c:wd_getattrval comp1_en "TERM01")))
; Get the suffix of the 2nd component's X?TERMxx attrib
(setq str (cdr (assoc 2 (entget xterm2_en))))
; Get PIN number of first component
(setq pin2 (c:wd_getattrval comp2_en (strcat "TERM" (substr
str 7))))
(if (AND (not pin2) (c:wd_getattrval comp2_en "TAGSTRIP"))
; Terminal symbol, just grab the TERM01 terminal number
(setq pin2 (c:wd_getattrval comp2_en "TERM01")))
; Get tag of the two components
(setq comp1_tag (c:wd_getattrval comp1_en
"TAG1*,TAG2*,TAGSTRIP,TAG,TAG_*"))
(setq comp2_tag (c:wd_getattrval comp2_en
"TAG1*,TAG2*,TAGSTRIP,TAG,TAG_*"))
(if (not comp1_tag)(setq comp1_tag ""))
(if (not comp2_tag)(setq comp2_tag ""))
(setq new_wireno comp1_tag)
(if (AND pin1 (/= pin1 ""))(setq new_wireno (strcat
new_wireno "-" pin1)))
(setq new_wireno (strcat new_wireno "/" comp2_tag))
(if (AND pin2 (/= pin2 ""))(setq new_wireno (strcat
new_wireno "-" pin2)))
(c:wd_putwnf en new_wireno) ; put the wire number on wire
)
(T (princ "\n other than two connected components\n"))
)
)
)
)
)
)
(princ)
)
"MReed" wrote in message
news:15217154.1088689239570.JavaMail.jive@jiveforum2.autodesk.com...
> Thanks for your help, at least it's just not me that couldn't figure a way
to do this. Have to convince everyone that is not a conventional method