;~******************************************************************************
;~* FILE NAME:BLOCKSIN.lsp
;~* FUNCTION: INSERT BLOCKS WITH ATTRIBUTES INTO DRAWINGS AND FILL ATTRIBUTES
;~* WRITTEN BY: SOUI21
;~* REVISIONS: Version Alpha:
;~******************************************************************************
;#1a----------- layer layer & text & text settings settings ------------
;create and set ;create and set layer layer to blocks to blocks - create romans text style
(command "layer" "m" "BLOCKS" "FA" "T" "0,255,0" "" "L" "Continuous" "" "") (command "stil" "romans" "romans" "0.125" "1" "" "" "" "")
;#1b----------- DEFINING VARIABLE SETTINGS
; capture user settings
(setq atd
(getvar "attdia")) ;attribute dialog box
; change to what settings need to be
(setvar "osmode" 0) ;osnap to none (setvar "attreq" 1) ;ask for attribute values on insert (setvar "attdia" 0) ;issues command prompts for data
;set starting points for inserts and not nil
(setq xval
1.0) ;initial x (setq yval
30.0) ;initial y (setq eqdata
"notnil") ;dummy variable
;prompt user for the location of the data file
(princ "\n Please Enter Name of Data File - Include the path and extension")
;#3----------- *** while motor data ***
(setq eqdatal
(open eqdataf
"r")) ;open data file
(while (/= eqdata
nil) ;while data continue
(setq eqdat
(sparse eqdatac
";")) ;#3a---------- do not do not change anything 3 - 3a
(setq EQPID
(nth 0 eqdat
) ;EQUIPMENT ID NEWIO
(nth 2 eqdat
) ;DESCRIPTION BN
(nth 3 eqdat
) ;BLOCKNAME
) ;end setq
;insert tag & text
(setq blkinpnt
(list xval yval
)) ;create xy insert point for tag
(command "_insert" BN blkinpnt
"1" "" "" EQPID EQTAG NEWIO
) ;set new point
(setq yval
(- yval
30.0)) ;y Point
(setq xval
(+ xval
30.0)) )
) ;End if
) ;end while
(close "eqdataf") ;CLOSES THE OPEN DATA FILE
) ;end defun
;------------------------------
;SPARSE Function (from bryan)
(defun sparse
(s asep
/ slen ll temp cnt
) (< cnt slen)
(if (= (substr s cnt
1) asep
) ;test if character is a seperator (setq ll
(cons temp ll
) ;then adds var to list temp "")
) ;end if
) ;end while
) ;return list ll in order data was read
;------------------------------------