Hey All
I am trying to run a command to xref a list of files into a drawing but this is proving to be a little past my capabilities.
Here is the code ive gotten so far.
Any tips of better ways of achieving this would be appreciated, i think i may have taken a few long step to reach this point.
Code:(defun C:MMCoord (/) ;(command "filedia" "0") (setq dwgpath (getvar "dwgprefix") ;logs filepath dwgname (if (= (strlen (getvar "dwgname")) 20) ;logs drawing name (getvar "dwgname") (exit) ) discipline (substr dwgname 8 1) ;logs discipline level (substr dwgname 10 3) ;logs level namelist (vl-directory-files dwgpath (strcat "*-*-" level "-*.dwg") 0) ;logs list of drawings for matching level filter (strcat "*-" discipline "-*,*-H-*,*-E-*-2*,*-C-*") ;logs the drawing filter ) (foreach temp1 namelist ;refines drawing list with filter (if (wcmatch temp1 filter) (setq namelist (vl-remove temp1 namelist)) ) ) (setq reflist nil) (foreach temp1 namelist ;adds filepath to refined drawing list (setq reflist (cons (strcat dwgpath temp1) reflist)) ) (setq ListLength (length reflist)) ;logs list length (while (> listlength 0) ;begins xref creation loop (setq overlay (last reflist)) (vl-remove overlay reflist) (command "-xref" "o" overlay "0,0,0" "" "" "") (- listlength 1) ;fails miserably ) ;(command "filedia" "1") princ overlay )


Reply With Quote

