This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
;;; $$ = Subfunction $$ ;;; $$ ---Search for the argument in the excel file in the first column $$ ;;; $$ ---and returns the value of that row into a list with the value $$ ;;; $$ ---of Row 1 (Title Name) in the equal column $$ ;;; $$ ----- Arguments: 1 $$ ;;; $$ ----- Excvalue = Value that is used to search in the excelfile $$ ;;; $$ --- Returns: $$ ;;; $$ --- A list with 2 integers: (("Name B147" "Title B1") $$ ;;; $$ ("Name C10" "Title C1") $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ CUSTOMPROPERTIES: $$ ;;; $$ = MAIN FUNCTION $$ ;;; $$ ---Put in custom properties according from the list name $$ ;;; $$ ----- Arguments: 0 $$ ;;; $$ --- Returns: $$ ;;; $$ --- A Named customproperties: PROJECTNAAM and DOSSIERNUMMER .... $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ DOSSIER: $$ ;;; $$ = MAIN FUNCTION $$ ;;; $$ ---Launch a Dialog with multiplay options to extract and import $$ ;;; $$ ---data from a specific excel File $$ ;;; $$ ---- Arguments: 8 $$ ;;; $$ ---- Projectnumber= Value that is used to search in the excelfile $$ ;;; $$ ---- Customproperties= check for a equal name and give value of custom $$ ;;; $$ ---- Setcustom= use Value projectnumber to search in the excelfile $$ ;;; $$ ---- And use that to fill in customprop $$ ;;; $$ ---- GetExcel= use Value projectnumber to retrive data in the excelfile $$ ;;; $$ ---- PutExOn= Toggle excel data on or off $$ ;;; $$ ---- ExtractCAD= if edit box are filled export data to excel $$ ;;; $$ ---- Createcustom= Make some customproperties with empty value $$ ;;; $$ ---- DeleteCustom= Delete every customproperties of this document $$ ;;; $$ ---- Toggle Excel: toggle editbox on/off $$ ;;; $$ --- Returns: $$ ;;; $$ --- A Named customproperties: PROJECTNAAM and DOSSIERNUMMER .... $$ ;;; $$ ---------------------- $$ ;;; $$ Sel-str $$ ;;; $$ ---Change type excelvalue $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ;;;
;;;--- Set column to 0 (setq col 0) ;;;--- to get the next columns cells (vlax-for x MaxRange (if (= (sel-str (vlax-variant-value (vlax-get-property x 'Value))) ExcValue) (repeat 30 (setq cellValue (sel-str (vlax-variant-value (vlax-get-property (vlax-variant-value (vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item (vlax-get-property x 'Row) (+ (setq col (1+ col)) (vlax-get-property x 'Column)) );GETPROP );VARIANT 'Value );GETPROP );VARIANT );SEL-STR );SETQ
;;;---Getting values of ROW 1 = Title; has to be correct with dwg prop (setq cellTitle (strcase (sel-str (vlax-variant-value (vlax-get-property (vlax-variant-value (vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item 1 (+ col 1) );GETPROP of id );VARIANT
(defun CUSTOMPROPERTIES (/ Default n a b suminfo proplst value prop name name1 Num prop1 proplstb)
;;;---Get objectintel of summary (setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object)) ) );SETQ (setq Default (vla-NumCustomInfo suminfo)) ;;;---if number of customintel is higher then 0 (if (> (setq n Default) 0)
;;;---repeat----> (repeat n
;;;---Repeat this for every last customintel;;;---Get Custom by highest index and lower every time with one;;;---'a = pKey = String that stands for the custom property NAME corresponding the index value;;;---'b = pValue = string that stands for the custom property VALUE corresponding the index value (vla-GetCustomByIndex suminfo (setq n (1- n)) 'a 'b)
;;;---List every index with pValue + Pkey till a big list according to the 3 variables (setq proplst (cons (list n a b) proplst))
(if (/= b "") (setq proplstb (cons b proplstb)) ) );REPEAT
(if (> Default 0);;; (foreach x name;;; (Setq value x) ;;;---For each list in "proplst" Compare "value" with The second element from that list and show the 3th element.
(progn (setq Num 0) (foreach x proplst (setq prop x) (setq prop1 (cadr x)) (if (member prop1 name) (progn (setq value (caddr prop)) (setq name1 (car (member prop1 name))) (set_tile name1 value) );Progn (progn (setq Num (+ Num 1)) ) );IF );FOREACH (if (= Default Num) (progn (Alert "The name of the properties isn't same as this dialog") (set_tile "OPMERKING" "The name of the properties isn't same as this dialog") );progn );if
);progn
(progn (Alert "There are no customproperties!") (set_tile "OPMERKING" "There are no customproperties!") ) );IF
(progn (Alert "The values of the customproperties are empty. ") (set_tile "OPMERKING" "The values of the customproperties are empty. ") ) ) (princ) );DEFUN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------;;;;;;---END OF CUSTOMPROPERTIES----;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (eq (findfile project) nil) (progn (if(not(setq dcl_id (load_dialog "PROJECTNUMBER.dcl"))) (progn (alert "The DCL file could not be loaded!")
Pagina 5
(exit) );PROGN (progn ;;;--- Load the definition inside the DCL file (if (not(new_dialog "PROJECTNUMBER" dcl_id)) (progn (alert "The DOSSIER definition could not be loaded!") (exit) );PROGN
(setq ddiag 4) (while (> ddiag 2) ;;;--- Load the dcl file from disk into memory (if(not(setq dcl_id (load_dialog "DOSSIER.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) );PROGN ;;;--- Else, the dcl file was loaded into memory
Pagina 6
(progn ;;;--- Load the definition inside the DCL file (if (not(new_dialog "DOSSIER" dcl_id)) (progn (alert "The DOSSIER definition could not be loaded!") (exit) );PROGN ;;;--- Else, the definition was loaded (progn (Creatingfiles);;;--- Put mode tile gray for excel data
;;; (Foreach x name ;;; (setq name@ (strcat x "@")) ;;; (mode_tile name@ 1) ;;; );FOREACH
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------;;;;;;----END OF Updateblock----;;;;;;--------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;----FUNCTION COUNTBLOCK----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(foreach x BlockList (setq NumBlock (rtos(atof(substr x (+ ProjectnumberL 1))) 2 0)) (foreach x gegevens (setq Gegx (strcat x NumBlock)) (setq TitleGegevens (cons Gegx TitleGegevens)) ) ) ) )
(repeat 22 (setq Num (+ Num 1)) (Foreach x gegevens (setq geg (strcat x (rtos Num 2 0))) (if (not(vl-position geg TitleGegevens)) (progn (mode_tile geg 1) ) ) ) )
Pagina 10
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;----END OF COUNTBLOCK----;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(progn (if(not(setq dcl_id (load_dialog "YESNO.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) );PROGN
(progn;;;--- Load the definition inside the DCL file (if (not(new_dialog "YESNO" dcl_id)) (progn (alert "The YESNO definition could not be loaded!") (exit) );PROGN (progn (setq opmerking (strcat "Projectnumber in this command ("Projectnumber1") isn't the same as the defined projectnumber("Projectnumber2").")) (set_tile "opmerking1" opmerking) (setq txt1 (strcat "Do you want to redefine the current projectnumber("Projectnumber2")?")) (set_tile "txt1" txt1) (action_tile "accept" "(RedefineProjectnumber) (done_dialog) (Alertforchange) " ) (action_tile "cancel" "(done_dialog) ")
(Alert "Please check every titleblockname and delete them if it isn't the same!") ) (defun RedefineProjectnumber ( / Projectnumber project dcl_id file)
(if(not(setq dcl_id (load_dialog "PROJECTNUMBER.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) );PROGN (progn;;;--- Load the definition inside the DCL file (if (not(new_dialog "PROJECTNUMBER" dcl_id)) (progn (alert "The DOSSIER definition could not be loaded!") (exit) );PROGN (progn (action_tile "DOSSIERNUMMER" "(setq Projectnumber $value)") (start_dialog) (unload_dialog dcl_id) (setq file (open project "W")) (write-line (strcat Projectnumber) file) (close file) ) ) ) ) );defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------;;;;;;----END OF CHECKPROJECTNUMBER----;;;;;;---------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----FUNCTION PLANLIJST--;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun PLANLIJST ( / dcl_id ddiag);;; ;;;;;;--- Load the dcl file from disk into memory;;; (if(not(setq dcl_id (load_dialog "DOSSIER.dcl")));;; (progn;;; (alert "The DCL file could not be loaded!");;; (exit);;; );PROGN;;; ;;;;;;--- Else, the dcl file was loaded into memory;;; (progn;;; ;;;;;;--- Load the definition inside the DCL file;;; (if (not(new_dialog "PLANLIJST" dcl_id));;; (progn;;; (alert "The PLANLIJST definition could not be loaded!");;; (exit);;; );PROGN;;; ;;;;;;--- Else, the definition was loaded;;; (progn
;;; ;;;;;;--- Display the dialog box;;; (setq ddiag(start_dialog))
;;; ;;;;;;--- Unload the dialog box;;; (unload_dialog dcl_id);;;;;;;;;--- If the user pressed the Cancel button;;; (if(= ddiag 0);;; (princ "\n DOSSIER cancelled!");;; );IF;;;
(foreach x toggle (setq togglex x) (setq name (vl-remove togglex name)) ) (setq lst2 (Doss dossvalue1))
;;;---For each listobject in name check it as variable x-> (foreach x name
;;;---set value 1 with the value of each x (Setq Value1 x)
;;;---Put at every end of Value 1 a "@" (setq Value2 (strcat Value1 "@"))
;;;---for each listobject in lst (Foreach x lst2
Pagina 13
;;;---If first element of listobject x in "lst2" is the same as each "value1" (x) in list "name" (if (= (car x) Value1)
;;;---Set 2 element of each objext in lst2 as Value3 (progn (setq Value3 (cadr x)) );PROGN );IF
;;; ) ;;; )
);FOREACH
;;;--- Set in tile with the key "value2" a value "value3" (Set_tile Value2 Value3) );FOREACH (set_tile "OPMERKING" "Excel properties Loaded") );PROGN
;;;--- Alert user of no projectnumber (progn (Alert "Fill in a Projectnumber for getting excelinfo!") (set_tile "OPMERKING" "Fill in a Projectnumber for getting excelinfo!") );PROGN );IF (princ) );DEFUN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----END OF GetExcel-----;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun TEXTDOSSIERGEGEVENS (/ name namex name@ data Dossiergegevenstext Externfolder DWGprefix Listdata file Txtline Dossiergeg )
;;;---if number of customintel is higher then 0 (if (> (setq n (vla-NumCustomInfo suminfo)) 0)
;;;---repeat----> (progn (repeat n
;;;---Repeat this for every last customintel;;;---Get Custom by highest index and lower every time with one;;;---'a = pKey = String that stands for the custom property NAME corresponding the index value;;;---'b = pValue = string that stands for the custom property VALUE corresponding the index value (vla-GetCustomByIndex suminfo (setq n (1- n)) 'a 'b)
;;;---List every index with pValue + Pkey till a big list according to the 3 variables (setq proplst (cons (list n a b) proplst)) );REPEAT ;;;--- make a list Name with those strings (setq name '( "DOSSIERNUMMER" "PROJECTNAAM" "AFK ELEMENT" "BETREFT1" "BETREFT2" "AANNEMER" "ADRESAANNEMER1" "ADRESAANNEMER2" "STRAATBOUWPLAATS" "POSTCODE" "BOUWPLAATS" "PROVINCIE" "BOUWHEER" "BOUWHEERADRES1" "BOUWHEERADRES2" "ARCHITECT" "ARCHITECTADRES1" "ARCHITECTADRES2" "BEK TEKENAAR" "WAP TEKENAAR" "VELLINGK. BALK.KOLOM" "VELLINGK. WAND" "KWALITEIT BETON" "GEBRUIKSDOMEIN" "OMGEVINGSKLASSE" "CONSISTENTIEKLASSE" "KORRELAFM NOM." "MIN. DEKKING"
Pagina 15
));SETQ
;;;--- Get The toggestatus of tile editexcel (setq toggle (Toggles)) (foreach x toggle (setq togglex x) (setq name (vl-remove togglex name)) );foreach (foreach x name (setq name1 x);;;---> Put a "@" After each object and set as name@ (setq name@ (strcat name1 "@")) ;;;--- get Value of a tile with key "name@" (setq data (get_tile name@))
;;;--- If the value in the edit box isn't nil (if (/= data "");data (progn (if (member name1 (mapcar 'cadr proplst)) (vla-SetCustomByKey suminfo name1 data)
(if (eq missingprop nil)
(setq missingprop name1) (setq missingprop (strcat missingprop ", " name1)) );if );if ;;;--- then launch the function Put2 with the values "data" "x" "dossval" (put2 data name1 dossval)
);progn (progn (setq data1 (get_tile name1)) (if (/= data1 "") (progn (put2 data name1 dossval) (if (member name1 (mapcar 'cadr proplst)) (vla-SetCustomByKey suminfo name1 data) (if (eq missingprop nil) (setq missingprop name1) (setq missingprop (strcat missingprop ", " name1)) );if );if );progn );IF );progn );if );FOREACH Name (if (eq missingprop nil) (Set_tile "OPMERKING" "ALL of the data in the boxes is uploaded to the excel file!") (progn (Set_tile "OPMERKING" "SOME of the data in the boxes is uploaded to the excel file!") (Alert (strcat "Dwgproperties " missingprop " hasn't been found in this drawing," "\nplease click \"create datalinks\" and redo this command!")) ) ) );PROGN
(alert "There are no Dwgproperties defined, please click \"create datalinks\" and redo this command!") );IF );progn
(Alert (strcat "The projectnumber that you filled in <" projectnumber "> " "\nisn't the same as the Dossiernummer <" DOSSIERNUMMER@ "> .")) );IF ;;;--- if no dossval alert user (Alert "Fill in a Projectnumber for setting custominfo!") );IF
Pagina 16
(princ) );DEFUN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------;;;;;;----END OF ExtractCAD---;;;;;;------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun Createcustom ( / name suminfo n TypeN proplst proplsta name2 onlyA Match Matchlst name1 name3 Match2 CompareN lengthname1)
;;;--- make a list Name with those strings (setq name '("DOSSIERNUMMER" "PROJECTNAAM" "AFK ELEMENT" "BETREFT1" "BETREFT2" "AANNEMER" "ADRESAANNEMER1" "ADRESAANNEMER2" "STRAATBOUWPLAATS" "POSTCODE" "BOUWPLAATS" "PROVINCIE" "BOUWHEER" "BOUWHEERADRES1" "BOUWHEERADRES2" "ARCHITECT" "ARCHITECTADRES1" "ARCHITECTADRES2" "BEK TEKENAAR" "WAP TEKENAAR" "VELLINGK. BALK.KOLOM" "VELLINGK. WAND" "KWALITEIT BETON" "GEBRUIKSDOMEIN" "OMGEVINGSKLASSE" "CONSISTENTIEKLASSE" "KORRELAFMNOM." "MIN. DEKKING" ));SETQ
;;;---Get all object in summary with intel and set as suminfo (setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object)) );VLAGET );SETQ ;;;---Get a number on how many custom prop
;;; Set the variable on how many custom there are as N and make it a string (setq n (vla-NumCustomInfo suminfo)) (setq TypeN (itoa n)) (if (> (setq n (vla-NumCustomInfo suminfo)) 0);;;---repeat----> (repeat n
;;;---Repeat this for every last customintel;;;---Get Custom by highest index and lower every time with one;;;---'a = pKey = String that stands for the custom property NAME corresponding the index value;;;---'b = pValue = string that stands for the custom property VALUE corresponding the index value
(vla-GetCustomByIndex suminfo (setq n (1- n)) 'a 'b) (setq proplst (cons (list n a b) proplst)) (setq proplsta (cons a proplsta))
;;;---List every index with pValue + Pkey till a big list according to the 3 variables );REPEAT );IF ;;;---if number of customintel is higher then 0 (if (= TypeN "0") (progn ;;;---if there isn't any customintel make a custom from each object in name (foreach x name (setq name2 x) (vla-addcustominfo suminfo name2 "") );FOREACH (Set_tile "OPMERKING" "All cells of excel are loaded as CustomProperties!!!" ) );PROGN, tested works
;;;---or compare every object,Variable only, in "proplsta" with list "name";;;---and if it match take the first element of the remainders and put those elements in a list (progn (Foreach x proplsta (Setq onlyA x)
(if (member onlyA name) (progn (setq Match (car (member onlyA name))) (setq Matchlst (cons Match Matchlst)) );PROGN );IF );Foreach
Pagina 17
;;;---if matchlst exist reverse the list Z-A -> A-Z (if Matchlst (setq Matchlst (reverse Matchlst)));IF ;;;--- Know list "name" as list "name1" now and for each element in list "Matchlst" Remove that element from "name1" and set it again under name1 (setq name1 name) (Foreach x Matchlst (setq Match2 x)
;;;--- For each element in name1 add that element to custom info
(Setq lengthname1 (length name1)) (if (= lengthname1 0) (progn (Set_tile "OPMERKING" "All Customproperties are already defined!!! No need to press again." )
;;; (Alert "All Customproperties Equal to Excel are already defined") );PROGN (progn (foreach x name1 (setq name3 x)
;;; (Alert name3) (vla-addcustominfo suminfo x "") );Foreach (Set_tile "OPMERKING" "Some of the Customproperties are loaded, others are already defined!!!" ) );progn );IF lengte );PROGN first ifargument of member );if (princ) );DEFUN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----END OF Createcustom----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(repeat (setq n (vla-NumCustomInfo suminfo)) (vla-RemoveCustomByIndex suminfo (setq n (1- n))) ) (Set_tile "OPMERKING" "All defined Custom properties are deleted." ) (Alert "All defined Custom properties are deleted.") (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----END of DeleteCustom----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----END of DeleteCustom----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq toggle (Toggles)) (foreach x toggle (setq togglex (strcat x "#")) (Set_tile togglex "1") )
Pagina 20
(set_tile "OPMERKING" "All selected") (mode_tile "SelectAll" 1) (princ) );DEFUn
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------;;;;;;-----End of Toggleselectall-----;;;;;;--------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------;;;;;;------End of Checkselect-------;;;;;;-------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------;;;;;;-----End of ToggleselectNone-----;;;;;;---------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow1-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow2-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow4-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow5-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow6-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow7-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(Defun ToggleRow7 ( / name name# num)
(setq name# '("BEK TEKENAAR#" "WAP TEKENAAR#" ));SETQ (setq num 0)
(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow7-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow8-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow9-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----End of Togglerow10-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----End of Togglerow11-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row1 "1") (progn (set_tile "Selectrow1" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow1" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow1-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row2 "1") (progn (set_tile "Selectrow2" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow2" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow2-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row3 "1") (progn (set_tile "Selectrow3" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow3" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow3-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row4 "1") (progn (set_tile "Selectrow4" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow4" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow4-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row5 "1") (progn (set_tile "Selectrow5" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow5" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow5-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row6 "1") (progn (set_tile "Selectrow6" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow6" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow6-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow7-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set_tile "Selectrow7" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow7" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow7-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row8 "1") (progn (set_tile "Selectrow8" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow8" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow8-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row9 "1") (progn (set_tile "Selectrow9" "1") (foreach x name# (setq name x) (set_tile name "1") ) )
Pagina 30
(progn (set_tile "Selectrow9" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Getrow9-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row10 "1") (progn (set_tile "Selectrow10" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow10" "0") (foreach x name# (setq name x) (set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----End of Getrow10-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= row11 "1") (progn (set_tile "Selectrow11" "1") (foreach x name# (setq name x) (set_tile name "1") ) ) (progn (set_tile "Selectrow11" "0") (foreach x name# (setq name x)
Pagina 31
(set_tile name "0") ) ) ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----End of Getrow11-----;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End if Hide-----------;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun GETEXCELPLANLIJST ( / sheetName dossval FileName DWGprefix Excelprefix Defaultfile ExcelfileName Excelapp Excelfile xlSheet PlanRange RepeatN Repeat2d PLANnr PLANnrlst NrT1 T2 SCHAAL OPMAAKDD A ADD B BDD C CDD D DDD E EDD F FDD Nrlst PlanRangeVal PlanRangeX CellValueLst CellValue CellValueLst PLANValueLst Nr PLANnr T1 T1x T2 T2x SCHAAL SCHAALx OPMAAKDD OPMAAKDDx OPMAAKDDstr A Ax ADD ADDx ADDstr B Bx BDD BDDx BDDstr C Cx CDD CDDx CDDstr D Dx DDD DDDx DDDstr E Ex EDD EDDx EDDstr F Fx FDD FDDx FDDstr)
;;;---Sheetname (setq sheetName "Dossierbeheer") (setq dossval (get_tile "Projectnumber")) (if (= dossval "") (Alert "You need a projectnumber to continue.") (progn
Pagina 32
;;;---if you fill in projectnumber you get the right filename (setq FileName (strcat "PLANLIJST_" dossval) DWGprefix (getvar "dwgprefix") Excelprefix (vl-string-trim "ACAD\\" DWGprefix) Defaultfile (strcat Excelprefix "\\PLANLIJST_0000.xlsx") ExcelfileName (strcat Excelprefix "\\" FileName ".xlsx" ))
(if (not (findfile ExcelfileName)) (progn (Alert (strcat "file " FileName " not found. Did you fill in the correct Projectnumber? \nOr there isn't a file? ")) (exit) ) (set_tile "OPMERKING" "Excel file founded") );IF );IF
(setq F(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x)))))))))))))))))) (setq Fx (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))))))) (Set_tile F Fx)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----End of GETEXCELPLANLIJST-------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;---Clean three times unused objects (repeat 3 (gc)) (princ) ) )
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------------;;;;;;-----END OF EXTRACTEXCELPLANLIJST-------;;;;;;------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----End of PUTEXCELPLANLIJST-------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun AT:ListDuplicates (lst) ;; Return all duplicates within list ;; lst - List to process ;; Alan J. Thompson, 11.01.09 (vl-remove-if-not (function (lambda (x) (member x (cdr (member x lst))))) lst))
(setq Listblock(AT:ListDuplicates Listblock)) (if (not(eq Listblock nil)) (Alert "There are blockduplicates, see prompt commandline") ) (princ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------------;;;;;;-----End of AlertEditedblocks -------;;;;;;-------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
);defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------;;;;;;-----End of ScriptBlock-------;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----End of GetVal-------;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------------------;;;;;;-----End of DISTRIBUTEEXCELPLANNLIJST------;;;;;;---------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of Getfiles---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;--- Load the dcl file from disk into memory (if(not(setq dcl_id (load_dialog "DOSSIER.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) );PROGN ;;;--- Else, the dcl file was loaded into memory (progn ;;;--- Load the definition inside the DCL file (if (not(new_dialog "DRAWING" dcl_id)) (progn (alert "The DRAWING definition could not be loaded!") (exit) );PROGN (progn
;;;--- Unload the dialog box (unload_dialog dcl_id)
;;;--- If the user pressed the Cancel button (if(= ddiag 2) (princ "\n Tekeningenlijst geannuleerd!") );IF
);PROGN
);IF );PROGN );IF );Defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of !! teken---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------------&&&;;;;;;&&&---End of Creatingfiles---&&&;;;;;;&&&----------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set and open file for reading (setq file (open TxtfileDir "R")) ;; each time you issue 'read-line' on a file, it will go to the next line, ;; so as long as it will allow me to read-line the file, it will define the value ;; to a variable... (while (setq Txtline (read-line file)) ;; value set as #Line, now I'll append it to a list eg. (list "A" "B" "C") (setq Listtxt (cons Txtline Listtxt)) ) ;_ while ;; close file (close file) ;; since I have to append from the front, my list is in reverse, so I just rearrange it. (setq Listtxt (reverse Listtxt)) ) ;_ defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of Getlines---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (/= LinesL nil) (repeat filesL (setq First (car files)) (if (member First Lines) (setq files (cdr files)) (progn (setq List1 (cons First List1)) (setq files (cdr files))
Pagina 47
) ) ) (progn (setq List1 files) ) ) List1 );Defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&--------------------------&&&;;;;;;&&&---End of GetValList1---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&--------------------------&&&;;;;;;&&&---End of GetValList2---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of Getfiles---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------&&&;;;;;;&&&---End of button<---&&&;;;;;;&&&----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(Foreach x txtval (write-line x open_file) ) (close open_file) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&------------------------&&&;;;;;;&&&---End of Getcancel---&&&;;;;;;&&&------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------------------------;;;;;;-----Functions of Autocad - Julian timeline-------;;;;;;--------------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (CTOJ <year> <month> <day> <hour> <minute> <second/fraction>);;;(defun ctoj (yr m d hh mm ss / y a b) (setq y yr) (if (<= m 2) (setq y (1- y) m (+ m 12) ) ) (if (or (< yr 1582) (and (= yr 1582) (or (< m 10) (and (= m 10) (< d 5))))) (setq b 0) ; Julian calendar (setq a (fix (/ y 100)) ; Gregorian calendar b (+ (- 2 a) (fix (/ a 4))) ) ) (+ (fix (+ (* 365.25 (+ y 4716)) (fix (* 30.6001 (+ m 1))))) d b -1524.0 (/ (+ (* (+ (* hh 60) mm) 60) ss) (* 24.0 60 60))));;;;;;----------------------------------------------------------------------------;;;
Pagina 51
;;; (DTOJ <calendar date>) -- convert calendar date/time to Julian;;;(defun dtoj (cdate / c f yr ys m d) (setq ys (if (< cdate 0) -1 1) ; Sign on year c (fix (abs cdate)) ; Date in unsigned digits yr (* (/ c 10000) ys) ; Get year m (rem (/ c 100) 100) ; Get month d (rem c 100) ; Get day f (rem (abs cdate) 1) ; Fraction of day ) (ctoj yr m d (fix (+ (* f 100) 0.1)) (rem (fix (+ (* f 10000) 0.1)) 100) (+ (rem (fix (+ (* f 1000000) 0.1)) 100) (/ (rem (fix (+ (* f 1000000000) 0.1)) 1000) 1000.0))));;;;;;----------------------------------------------------------------------------;;;;;; (JTOC <Julian date>) -- convert Julian date/time to calendar date list;;;(defun jtoc (td / time a b c d e alpha z m hh mm) (setq time (* 86400.0 (- td (setq z (fix td))))) (if (< z 2299161) (setq a z) ; Julian calendar (setq alpha (fix (/ (- z 1867216.25) 36524.25)) ; Gregorian calendar a (- (+ z 1 alpha) (fix (/ alpha 4))) ) ) (setq b (+ a 1524) c (fix (/ (- b 122.1) 365.25)) d (fix (* 365.25 c)) e (fix (/ (- b d) 30.6001)) ) (setq m (fix (if (< e 14) (1- e) (- e 13)))) ; Determine the clock time from the fraction of a day (setq hh (fix (/ time 3600.0)) time (- time (* hh 3600.0)) mm (fix (/ time 60.0)) ) ; Return calendar date as list (list (fix (- c (if (> m 2) 4716 4715))) m (fix (- b d (fix (* 30.6001 e)))) hh mm (- time (* mm 60)) ));;;;;;;;;----------------------------------------------------------------------------;;;;;; (JTOD <Julian date>) -- convert Julian date/time to calendar;;;(defun jtod (td / j) (setq j (jtoc td)) ; Return calendar date in form YYYYMMDD.HHMMSSmsec (* (+ (* (abs (car j)) 10000) ; year (* (cadr j) 100) ; month (caddr j) ; day (/ (cadddr j) 100.0) ; hour (/ (nth 4 j) 10000.0) ; minute (/ (nth 5 j) 1000000.0) ; seconds, milliseconds ) (if (< (car j) 0) -1 1) ; apply sign to year ));;;;;;----------------------------------------------------------------------------;;;;;; (JTOW <Julian date>) -- Convert a Julian date to day of week;;;(defun jtow (j) (fix (rem (1+ j) 7)));;;;;;----------------------------------------------------------------------------;;;;;; (c:JTEST) -- Internal test program for Julian date functions;;; Displays several lines of numbers. If none are;;; flagged with " Error ", all is okay.
Pagina 52
;;;;(defun c:JTEST (/ dl jl cjl cdl err eps); (setq dl '(20000101.12 19870127.0 19870619.12 19880127.0; 19880619.12 19000101.0 16000101.0 16001231.0; 8370410.0712 -10000712.12 -10000229.0 -10010817.2136; -47120101.12 -47120101.0 19930309.12 15821004.0; 15821015.0 19770426.0 19571004.0 19100420.0; 19860209.0 3330127.0 -5840528.0); jl '(2451545.5 2446823.0 2446966.5 2447188.0 2447332.5; 2415021.0 2305448.0 2305813.0 2026872.3 1356001.5; 1355867.0 1355671.9 0.5 0.0 2449056.5; 2299160.0 2299161.0 2443260.0 2436116.0 2418782.0; 2446471.0 1842713.0 1507900.0); eps 0.00005; );; ; Test DTOJ;; (setq cjl (mapcar 'dtoj dl); err (mapcar '- cjl jl)); (mapcar '(lambda (x y z w) (princ (rtos x 2 4)) (princ " "); (princ (rtos y 2 12)) (princ " "); (princ (rtos z 2 12)) (princ " "); (princ w); (if (> (abs w) eps) (princ " Error ")); (terpri)); dl jl cjl err); (terpri);; ; Test JTOD;; (setq cdl (mapcar 'jtod jl); err (mapcar '- cdl dl)); (mapcar '(lambda (x y z w) (princ (rtos x 2 4)) (princ " "); (princ (rtos y 2 12)) (princ " "); (princ (rtos z 2 12)) (princ " "); (princ w); (if (> (abs w) eps) (princ " Error ")); (terpri)); jl dl cdl err);; ; Test JTOW;; (if (or (/= (jtow (dtoj 19540630)) 3); (/= (jtow (dtoj 15821004)) 4); (/= (jtow (dtoj 15821015)) 5); ); (princ "\n Error in jtow.\n"); );; (princ););;;;;;----------------------------------------------------------------------------;;;;;; (C:DATE) -- Implement DATE command to display date/time;;;(defun c:date (/ j c cdate m d y hh mm ss msec) (setq cdate (jtod (setq j (getvar "date"))) c (fix cdate) y (/ c 10000) ; Get year m (rem (/ c 100) 100) ; Ger month d (rem c 100) ; Get day c (- cdate (fix cdate)) ; Strip date from date/time c (fix (* c 1000000000)) ; Scale time to get HHMMSSmmm integer hh (/ c 10000000) ; Get hours mm (rem (/ c 100000) 100) ; Get minutes ss (rem (/ c 1000) 100) ; Get seconds msec (rem c 1000) ; Get milliseconds ) ; Print the day of the week (princ (nth (jtow j) '("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"))) (princ " ") ; Print the date. YYYY/M/D (princ (strcat (itoa y) "/" (itoa m) "/" (itoa d)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------------------------------;;;;;;-----End of the function of Autocad - Julian timeline-------;;;;;;------------------------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (eq (open project "R") nil) (progn (if(not(setq dcl_id (load_dialog "PROJECTNUMBER.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) );PROGN (progn ;;;--- Load the definition inside the DCL file (if (not(new_dialog "PROJECTNUMBER" dcl_id)) (progn (alert "The DOSSIER definition could not be loaded!") (exit) );PROGN
;;;;;;;;;;;;;;;;;;;;;;Getting erased titleblocks;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;1. get textfile bin<dwgname>titleblock and read it, if not exist set listtxt nil (if (open TxtForDwgTitleblock "R") (progn; first argument 1.1.1 (setq file (open TxtForDwgTitleblock "R")) (while (setq Txtline (read-line file)) (setq Listtxt (cons Txtline Listtxt))) (close file) (setq Listtxt (reverse Listtxt)) ) (setq Listtxt nil) )
;;;;;;;;;;;;;;;;;;;;;getting existing blocks ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; if listtxt isn't nil, look for each element in listtxt and check if it exist in the ;;;;; drawing, if it exist add it to a list newlist. (if (not(eq Listtxt nil)) (progn (foreach x Listtxt (setq ListX x) (if (and (not (eq (tblsearch "block" ListX) nil)) (ssget "_X" '((0 . "INSERT")(66 . 1))) )