dossier.lsp - kladblok · ;;; $$ = subfunction $$ ;;; $$ ---search for the argument in the excel...

56
;;; ;;; ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$|-----------------------------|$$ ;;; $$|-- --|$$ ;;; $$|-- Made by Subje --|$$ ;;; $$|-- Dieter Bevernage --|$$ ;;; $$|-- Abicon NV --|$$ ;;; $$|-- Belgium --|$$ ;;; $$|-- --|$$ ;;; $$|-- Shared wisdom of --|$$ ;;; $$|-- hmsilva - Henrique --|$$ ;;; $$|-- Afralisp --|$$ ;;; $$|-- Terry Miller --|$$ ;;; $$|-- Lee Mac --|$$ ;;; $$|-- Hallex --|$$ ;;; $$|-- JefferyPSanders --|$$ ;;; $$|-- --|$$ ;;; $$|-- --|$$ ;;; $$|_____________________________|$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ;;; ;;; ----------------------------------------------------------------------- ;;; | ©copyright 2015 Dieter Bevernage, Abicon nv, West-Vlaanderen, Belgium | ;;; | | ;;; | Permission is granted to use this code for personal reasons, but | ;;; | this code may not be sold or used in any for-sale software . | ;;; | It is the responsibility of the user to verify the accuracy | ;;; | of the program and suitability for your own use. | ;;; | Always respect and mention the creator when distrubuting | ;;; ----------------------------------------------------------------------- ;;; ;;; ;;; Program Name: FindCells 1.02 ;;; First creation on 13/01/2015 ;;; Function: Know the value on Column B and find next the values on the next ;;; columns related to previeus value ;;; ;;; ------EDIT2: Get a Dialog with options: ;;; - Put custompropties is if not so with button, ;;; - Field for Projectnumber ;;; - Get value's of customproperties ;;; - Extract Data from excel into dialog ;;; - Extract Data from excel Into customprop ;;; - Toggle for Changing Edit box editable or not ;;; - Possible to put in Data in edit box for extract to excel ;;; ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ Revision History $$ ;;; $$ Rev By Date Description $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ 1 DB 13-01-2015 Initial version $$ ;;; $$ -> First creation $$ ;;; $$ 2 DB 30-01-2015 current version $$ ;;; $$ -> Added DCL + Extract to Excel + Load custom $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ Overvieuw functions: $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ Sel-str: $$ ;;; $$ = Subfunction $$ ;;; $$ ---Change type of a variable $$ ;;; $$ ----- Arguments: 1 $$ ;;; $$ ----- Excvalue = Real number to convert to a short string real number $$ ;;; $$ --- Returns: $$ ;;; $$ --- Excvalue; A living and kicking string $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ rtosr: $$ ;;; $$ = Subfunction $$ ;;; $$ -- Used to change a real number into a short real number string $$ ;;; $$ -- Created by terry miller $$ ;;; $$ ----- Arguments: 1 $$ ;;; $$ ----- RealNum~ = Real number to convert to a short string real number $$ ;;; $$ --- Returns: $$ ;;; $$ --- ShortReal$ the short string real number value of the real number $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ Doss: $$ Pagina 1

Upload: others

Post on 14-Mar-2020

4 views

Category:

Documents


1 download

TRANSCRIPT

;;; ;;; ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$|-----------------------------|$$ ;;; $$|-- --|$$ ;;; $$|-- Made by Subje --|$$ ;;; $$|-- Dieter Bevernage --|$$ ;;; $$|-- Abicon NV --|$$ ;;; $$|-- Belgium --|$$ ;;; $$|-- --|$$ ;;; $$|-- Shared wisdom of --|$$ ;;; $$|-- hmsilva - Henrique --|$$ ;;; $$|-- Afralisp --|$$ ;;; $$|-- Terry Miller --|$$ ;;; $$|-- Lee Mac --|$$ ;;; $$|-- Hallex --|$$ ;;; $$|-- JefferyPSanders --|$$ ;;; $$|-- --|$$ ;;; $$|-- --|$$ ;;; $$|_____________________________|$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ;;; ;;; ----------------------------------------------------------------------- ;;; | ©copyright 2015 Dieter Bevernage, Abicon nv, West-Vlaanderen, Belgium | ;;; | | ;;; | Permission is granted to use this code for personal reasons, but | ;;; | this code may not be sold or used in any for-sale software . | ;;; | It is the responsibility of the user to verify the accuracy | ;;; | of the program and suitability for your own use. | ;;; | Always respect and mention the creator when distrubuting | ;;; ----------------------------------------------------------------------- ;;; ;;; ;;; Program Name: FindCells 1.02 ;;; First creation on 13/01/2015 ;;; Function: Know the value on Column B and find next the values on the next ;;; columns related to previeus value ;;; ;;; ------EDIT2: Get a Dialog with options: ;;; - Put custompropties is if not so with button, ;;; - Field for Projectnumber ;;; - Get value's of customproperties ;;; - Extract Data from excel into dialog ;;; - Extract Data from excel Into customprop ;;; - Toggle for Changing Edit box editable or not ;;; - Possible to put in Data in edit box for extract to excel ;;; ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ Revision History $$ ;;; $$ Rev By Date Description $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ 1 DB 13-01-2015 Initial version $$ ;;; $$ -> First creation $$ ;;; $$ 2 DB 30-01-2015 current version $$ ;;; $$ -> Added DCL + Extract to Excel + Load custom $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$ $$ ;;; $$ Overvieuw functions: $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ Sel-str: $$ ;;; $$ = Subfunction $$ ;;; $$ ---Change type of a variable $$ ;;; $$ ----- Arguments: 1 $$ ;;; $$ ----- Excvalue = Real number to convert to a short string real number $$ ;;; $$ --- Returns: $$ ;;; $$ --- Excvalue; A living and kicking string $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ rtosr: $$ ;;; $$ = Subfunction $$ ;;; $$ -- Used to change a real number into a short real number string $$ ;;; $$ -- Created by terry miller $$ ;;; $$ ----- Arguments: 1 $$ ;;; $$ ----- RealNum~ = Real number to convert to a short string real number $$ ;;; $$ --- Returns: $$ ;;; $$ --- ShortReal$ the short string real number value of the real number $$ ;;; $$ ---------------------- $$ ;;; $$ $$ ;;; $$ Doss: $$

Pagina 1

;;; $$ = 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 $$ ;;; $$ $$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;; ;;;

(vl-load-com)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------;;;;;;---Function sel-str----;;;;;;-----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun sel-str (ExcValue / rtosr DimZin# ShortReal$);;http://forums.autodesk.com/t5/visual-lisp-autolisp?-and-general/getexcel-lsp-changing-cell-color-of-c?... (defun rtosr (RealNum~ / DimZin# ShortReal$) (setq DimZin# (getvar "DIMZIN")) (setvar "DIMZIN" 8) (setq ShortReal$ (rtos RealNum~ 2 8)) (setvar "DIMZIN" DimZin#) ShortReal$ );defun rtosr (setq ExcValue (cond

;;;---Returns the conversion of an integer into a string ((= (type ExcValue) 'INT) (itoa ExcValue))

;;;--- Do function Rtorsr See above ((= (type ExcValue) 'REAL) (rtosr ExcValue))

;;;---Remove the space in variable ((= (type ExcValue) 'STR) (vl-string-trim " " ExcValue))

;;;--- Can't be a empty string ((/= (type ExcValue) 'STR) "") );cond );setq );;sel-str

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Pagina 2

;;;------------------------;;;;;;-----END of sel-str-----;;;;;;------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------;;;;;;-----Function DOSS-----;;;;;;-----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Doss ( ExcValue / xlfilename sheetName Excelapp xlSheet OpenExFile Excelfile MaxRange Datarange cellTitle cellValue values) ;;;---Sheetname (setq sheetName "Dossiergegevens") ;;;---filelocation (setq xlfilename "R:\\Autodesk Standards\\test excel\\dossier.xlsx") ;;;---function to start excel (setq Excelapp (vlax-get-or-create-object "Excel.Application")) (if (not Excelapp) (progn (alert "Can't start Excel") (exit) ) ) ;;;---Put excel invisible (vla-put-visible Excelapp :vlax-false) ;;;---ignore alerts excel (vlax-put-property Excelapp 'DisplayAlerts :vlax-False) ;;;---Open file with excel (setq Excelfile (vl-catch-all-apply 'vla-open (list (vlax-get-property Excelapp "WorkBooks") xlfileName))) ;;;---look for sheets (setq xlSheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property Excelfile "Sheets") "Item" sheetName))) ;;;---Make the selected worksheet active (vlax-invoke-method xlSheet "Activate") ;;;--- cellrange in sheet (setq MaxRange (vlax-get-property (vlax-get-property xlSheet 'Cells) "range" "A2:A8000"))

;;;--- 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

Pagina 3

'Value );GETPROP );VARIANT );SEL-STR );STRCAT );SETQ

(setq values (cons (list cellTitle cellValue) values)) );repeat );IF );Vlax for

;;;---close, quit and releases VLAobjects (vlax-invoke-method Excelfile 'Close) (vlax-invoke-method Excelapp 'Quit) (mapcar 'vlax-release-object (list Excelapp Excelfile xlSheet MaxRange))

;;;---Clean three times unused objects (repeat 3 (gc))

;;;---If list "Values isn't empty put objectintel backwards in the list(if values (progn (reverse values) ) (princ) );IF);DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------;;;;;;-----END DOSS-----;;;;;;------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----FUNCTION CUSTOMPROPERTIES-----;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(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 (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" ));SETQ Name

(if (/= proplstb nil)

Pagina 4

(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----;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------;;;;;;----FUNCTION DOSSIER----;;;;;;------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:DOSSIER ( / value3 name Name1 Name2 Name3 Name4 ddiag activedocument acadobject dcl_id name@ name# string Projectnumber Remember)

;;;--- Set Active document (setq acadobject (vlax-get-acad-object) activedocument (vla-get-activedocument acadobject) DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") DWGprefixL (strlen DWGprefix) Last4letters (substr DWGprefix (- DWGprefixL 4) 4))

(if (eq Last4letters "ACAD") (progn

(setq project (strcat Externfolder "\\BinProjectBlock.txt") Activedoc (vla-get-activedocument (vlax-get-acad-object)))

(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

(progn (action_tile "DOSSIERNUMMER" "(setq Projectnumber $value)") (start_dialog) (unload_dialog dcl_id) (if (not (eq Projectnumber "")) (progn (if (not (vl-file-directory-p Externfolder)) (vl-mkdir Externfolder) ) (setq file (open project "W")) (write-line (strcat Projectnumber) file) (close file) ) ) ) ) ) ) )

(progn (setq file (open project "R")) (setq Projectnumber (read-line file)) (close file) (if (eq Projectnumber nil) (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) ) ) ) ) ) ) )

;;;--- Make list Name (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" ));SETQ

(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

(set_tile "Projectnumber" Projectnumber) (CUSTOMPROPERTIES) (GetExcel)

(if (eq (get_tile "DOSSIERNUMMER") (get_tile "DOSSIERNUMMER@")) (GETEXCELPLANLIJST) (Alert "Planlijst not loaded because the projectnumbers aren't the same. Check this outand press < Get planlijst >!") ) (CHECKTITLEBLOCK) (COUNTBLOCKS) (mode_tile "OPMERKING" 1) (mode_tile "SelectAll" 1) (mode_tile "SelectNone" 0)

(foreach x name (setq name# (strcat x "#")) (action_tile name# "(CheckSelect) (ToggleRow1) (ToggleRow2) (ToggleRow3) (ToggleRow4) (ToggleRow5) (ToggleRow6) (ToggleRow7) (ToggleRow8) (ToggleRow9) (ToggleRow10) (ToggleRow11)") )

(action_tile "Projectnumber" "(setq Projectnumber $value)") (action_tile "Selectrow1" "(GetRow1) (CheckSelect)") (action_tile "Selectrow2" "(GetRow2) (CheckSelect)") (action_tile "Selectrow3" "(GetRow3) (CheckSelect)") (action_tile "Selectrow4" "(GetRow4) (CheckSelect)") (action_tile "Selectrow5" "(GetRow5) (CheckSelect)") (action_tile "Selectrow6" "(GetRow6) (CheckSelect)") (action_tile "Selectrow7" "(GetRow7) (CheckSelect)") (action_tile "Selectrow8" "(GetRow8) (CheckSelect)") (action_tile "Selectrow9" "(GetRow9) (CheckSelect)") (action_tile "Selectrow10" "(GetRow10) (CheckSelect)") (action_tile "Selectrow11" "(GetRow11) (CheckSelect)")

(if Remember (progn (foreach x Remember (setq Name1 (car x)) ;;name customprop (if (= (cadr x) "None") (setq Name2 "") (setq Name2 (cadr x)) );; custompropvalue (if (= (caddr x) "None") (setq Name3 "") (setq Name3 (caddr x)) ;;excel value ) (setq Name4 (strcat Name1 "@"));; name excel value (set_tile Name1 Name2) (Set_tile Name4 Name3) );foreach );progn );If

;;;--- If an action event occurs, do this function (mode_tile "Projectnumber" 2)

Pagina 7

(action_tile "Planlijst" "(Updatebutton)") (action_tile "Dossiergegevens" "(Updatebutton)") (action_tile "Deletecustom" "(Deletecustom) (CUSTOMPROPERTIES) (CheckSelect)") (action_tile "Createcustom" "(Createcustom) (CUSTOMPROPERTIES) (CheckSelect)") (action_tile "loadexcel" "(GetExcel) (CheckSelect)") (action_tile "Putexcel" "(ExtractCAD) (CUSTOMPROPERTIES) (CheckSelect) ") (action_tile "cancel" "(CHECKPROJECTNUMBER) (done_dialog 0)") (action_tile "SelectAll" "(Toggleselectall)(CheckSelect)" ) (action_tile "SelectNone" "(ToggleselectNone)(CheckSelect)" ) (action_tile "SelectNone" "(ToggleselectNone)(CheckSelect)" ) (action_tile "hide" "(Hide)" ) (action_tile "PutTitleblock" "(done_dialog 2)" ) (action_tile "GETDRAWING" "(teken)" ) (action_tile "GETEXCELPLANLIJST" "(GETEXCELPLANLIJST)" ) (action_tile "PUTEXCELPLANLIJST" "(BLOCKTEXT) (EXTRACTEXCELPLANLIJST) (DISTRIBUTEEXCELPLANNLIJST)" ) (action_tile "UPDATE" "(CHECKDWG)")

;;; (action_tile "PUTEXCELPLANLIJST" "(BLOCKTEXT) (EXTRACTEXCELPLANLIJST) (PUTEXCELPLANLIJST)(done_dialog 1)" ) ;;;--- Display the dialog box (setq ddiag(start_dialog))

(if (= ddiag 4) (progn (progn (setq string (getstring "\nPress anything if ready")) );progn );Progn );IF ;;;--- Unload the dialog box (unload_dialog dcl_id)

;;;--- If the user pressed the Cancel button (if(= ddiag 0) (progn (command "AUDIT" "Y") (princ "\n DOSSIER cancelled!") ) );IF

(if(= ddiag 1) (progn (command "AUDIT" "Y") (ScriptBlock) ) );IF

(if(= ddiag 2) (progn (FUNCTIONTITLEBLOCK) (command "AUDIT" "Y") ) );IF

);PROGN );IF );PROGN );IF );while ) (progn (Alert "You're not working in a ACAD folder! You can't use this command.") ) )

;;;---Regenerate CAD (vla-regen activedocument 1) ;;;---Clean 5 times unused objects (repeat 5 (gc)) (princ) );DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------;;;;;;----END OF DOSSIER----;;;;;;----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Pagina 8

(defun CHECKDWG ( / DWGprefix ThisDwg Drawings Count Drawing fileH Count) (setq DWGprefix (getvar "dwgprefix")) (setq ThisDwg (strcat DWGprefix (getvar "dwgname"))) (setq Drawings (GetValList1)) (setq Count 0)

(foreach x Drawings (setq Drawing (strcat DWGprefix x ".dwg")) (if (not(= Drawing ThisDwg)) (if (eq (setq fileH (open Drawing "a")) nil) (progn (Alert (strcat Drawing " is open. Close the file!")) (setq Count 1) ) (close fileH) ) ) ) (if (= Count 1) (Alert (strcat "Command cancelled. Close alerted DWG's and redo the command!")) (progn (EXTRACT) (PUTEXCELPLANLIJST) (done_dialog 1) ) ) );defun

(defun EXTRACT (/)

(if (eq (get_tile "Planlijst") "1") (progn (EXTRACTEXCELPLANLIJST) (BLOCKTEXT) ) ) (if (eq (get_tile "Dossiergegevens") "1") (progn (ExtractCAD) (TEXTDOSSIERGEGEVENS) ) ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;----FUNCTION Updateblock----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun Updatebutton (/)

(if (and (eq (get_tile "Planlijst") "0") (eq (get_tile "Dossiergegevens") "0") ) (mode_tile "UPDATE" 1) (mode_tile "UPDATE" 0) ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------;;;;;;----END OF Updateblock----;;;;;;--------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;----FUNCTION COUNTBLOCK----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun COUNTBLOCKS (/ DWGprefix Externfolder BlockUsed project file BlockList BlockListL Projectnumber ProjectnumberL TitleGegevens Num gegevens

Pagina 9

geg NumBlock Gegx dcl_id )

(setq DWGprefix (getvar "dwgprefix"); Externfolder (strcat DWGprefix "\#Library-Do Not Edit#"); BlockUsed (strcat Externfolder "\\BinTitleBlock.txt"); project (strcat Externfolder "\\BinProjectBlock.txt") Num 0 BlockListL nil)

(setq gegevens (list "NR" "T1." "T2." "SCHAAL" "OPMDD." "A." "ADD." "B." "BDD." "C." "CDD." "D." "DDD." "E." "EDD." "F." "FDD.")) (if (open BlockUsed "R") (progn (setq file (open BlockUsed "R")) (while (setq Txtline (read-line file)) (setq BlockList (cons Txtline BlockList))) (close file) (setq BlockListL (length BlockList)) ) )

(if (eq (findfile project) 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 PROJECTNUMBER definition could not be loaded!") (exit) );PROGN (progn (action_tile "DOSSIERNUMMER" "(setq Projectnumber2 $value)") (start_dialog) (unload_dialog dcl_id) (setq file (open project "W")) (write-line (strcat Projectnumber) file) (close file) ) ) ) ) )

(progn (setq file (open project "R")) (setq Projectnumber (read-line file)) (close file) ) )

(setq ProjectnumberL (strlen Projectnumber))

(if (not(eq BlockListL nil)) (progn

(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----;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------------;;;;;;-----FUNCTION CHECKPROJECTNUMBER--;;;;;;----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun CHECKPROJECTNUMBER ( / Projectnumber1 file Projectnumber2 DWGprefix Externfolder project opmerking txt1)

(Setq Projectnumber1 (get_tile "Projectnumber") DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") project (strcat Externfolder "\\BinProjectBlock.txt"))

(if (eq (findfile project) 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 PROJECTNUMBER definition could not be loaded!") (exit) );PROGN (progn (action_tile "DOSSIERNUMMER" "(setq Projectnumber2 $value)") (start_dialog) (unload_dialog dcl_id) (setq file (open project "W")) (write-line (strcat Projectnumber2) file) (close file) ) ) ) ) )

(progn (setq file (open project "R")) (setq Projectnumber2 (read-line file)) (close file) ) )

(if (not(eq Projectnumber1 Projectnumber2))

(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) ")

Pagina 11

(start_dialog) (unload_dialog dcl_id) ) ) ) ) ) ) );defun

(defun Alertforchange ()

(Alert "Please check every titleblockname and delete them if it isn't the same!") ) (defun RedefineProjectnumber ( / Projectnumber project dcl_id file)

(Setq DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") project (strcat Externfolder "\\BinProjectBlock.txt"))

(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

;;; (action_tile "Dossiergegevens" "(PlanlijstToDossier)") ;;;;;; (action_tile "Planlijst" "(PLANLIJST)")

;;; (mode_tile "Planlijst" 1) ;;; (action_tile "cancel" "(done_dialog 0)")

Pagina 12

;;; ;;;;;;--- 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;;;

;;; );PROGN;;; );IF;;; );PROGN;;; );IF;;;;;;;;;---Regenerate CAD;;;;;; (vla-regen activedocument 1);;; ;;;;;;---Clean 5 times unused objects;;; ;;; (princ);;; );DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------;;;;;;------PLANLIJST-------;;;;;;----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------;;;;;;-----FUNCTION GetExcel--;;;;;;------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun GetExcel ( / dossvalue1 lst2 name Value1 Value2 Value3 name@ toggle togglex)

;;;--- Get projectnumber (setq dossvalue1 (get_tile "Projectnumber")) (if (/= (type dossvalue1) 'STR ) (Setq dossvalue1 (sel-str dossvalue1)) )

;;;---If dossvalue has a string (if (/= dossvalue1 "")

;;;---Set lst2 wit function doss (progn (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" ));SETQ (setq toggle (Toggles))

(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 )

(Setq DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") Dossiergegevenstext (strcat Externfolder "\\BinDossiergegevens.txt"))

(setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))));SETQ

(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" ));SETQ (setq file (open Dossiergegevenstext "W")) (foreach x name (setq namex x) (write-line namex file);;;---> Put a "@" After each object and set as name@ (setq name@ (strcat namex "@")) ;;;--- get Value of a tile with key "name@" (setq data (get_tile name@)) (if (eq data "") (setq data "----") ) (write-line data file) ) (close file) (princ) )

(defun GETTEXTDOSSIERGEGEVEN ( / DWGprefix Externfolder Dossiergegevenstext file Txtline DossiergegDossiergegL Custom Val suminfo)

Pagina 14

(Setq DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") Dossiergegevenstext (strcat Externfolder "\\BinDossiergegevens.txt")) (setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))));SETQ

(setq file (open Dossiergegevenstext "R")) (while (setq Txtline (read-line file)) (setq Dossiergeg (cons Txtline Dossiergeg)) ) (close file)

(if Dossiergeg (setq Dossiergeg(reverse Dossiergeg))) (setq DossiergegL (/ (Length Dossiergeg) 2))

(repeat DossiergegL (setq Custom (car Dossiergeg)) (setq Val (car (setq Dossiergeg (cdr Dossiergeg)))) (vla-SetCustomByKey suminfo Custom Val) (setq Dossiergeg (cdr Dossiergeg)) ) (princ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;---FUNCTION ExtractCAD---;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun ExtractCAD ( / dossval name Excelon name@ data name1 projectnumber DOSSIERNUMMER@ togglex suminfo n proplst a b missingprop data1)

(setq DOSSIERNUMMER@ (get_tile "DOSSIERNUMMER@") projectnumber (get_tile "Projectnumber") missingprop nil)

;;;--- If tile "Projectnumber" isn't nil or the same as filled in (if (/= projectnumber "" )

(if (= DOSSIERNUMMER@ projectnumber)

;;;--- For each object in name-> (progn

;;;---get value of tile projectnumber and set as dossval (setq dossval (Rtos(+ 1(atof(get_tile "Projectnumber"))) 2 0 ));SETQ

(setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))));SETQ

;;;---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---;;;;;;------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------;;;;;;-----FUNCTION Createcustom----;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(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)

;;; (Alert Match2);;;;;;;;;;;;;;;;;;;;;;; (Setq name1 (vl-remove Match2 name1)) );FOREACH

;;;--- 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----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------;;;;;;-----FUNCTION Put2----;;;;;;----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun put2 ( data int dossval / sheetName xlfilename Excelapp Excelfile xlSheet cellValue MaxRangecol values values1 column column1 value rangx )

;;;---Sheetname (setq sheetName "Dossiergegevens") ;;;---filelocation (setq xlfilename "R:\\Autodesk Standards\\test excel\\dossier.xlsx") ;;;---function to start excel (setq Excelapp (vlax-get-or-create-object "Excel.Application")) (if (not Excelapp) (progn (alert "Can't start Excel") (exit) );PROGN );IF ;;;---Put excel invisible (vla-put-visible Excelapp :vlax-false) ;;;---ignore alerts excel (vlax-put-property Excelapp 'DisplayAlerts :vlax-False) ;;;---Open file with excel (setq Excelfile (vlax-invoke-method (vlax-get-property Excelapp 'Workbooks)'Open xlfileName)) ;;;---look for sheets (setq xlSheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property Excelfile "Sheets") "Item" sheetName))) ;;;---Make the selected worksheet active

Pagina 18

(vlax-invoke-method xlSheet "Activate")

;;;--- cellrange in sheet and range for row1

;;; (setq excelrange (vlax-get-property ExcelApp "Cells")) (setq MaxRange (vlax-get-property (vlax-get-property xlSheet 'Cells) "range" "A1"))

(setq col 0) (vlax-for x MaxRange (repeat 28 (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 column(+ (setq col (1+ col)) (vlax-get-property x 'Column))) );GET PROP );VLAX VARIANT 'Value );GET PROP );VLAX VARIANT );SELSTR );SETQ (setq values (cons (list cellValue column) values)) );repat );vlax (if values (setq values1(reverse values) ));IF

(if (> (Atof dossval) 1 ) (foreach x values1 (setq column1 (cadr x)) (setq value (car x)) (if (= value int ) (progn

(setq rangx (variant-value(vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item (atoidossval) column1 )))

(vlax-put-property rangx 'value2 data) );PROGN );IF

);foreach (Alert (strcat "Projectnumber is to low <" dossval "> .")) )

;;;---close, quit and releases VLAobjects (vlax-invoke-method Excelfile 'Close :vlax-true) (vlax-invoke-method Excelapp 'Quit) (mapcar 'vlax-release-object (list Excelapp Excelfile xlSheet MaxRange))

;;;---Clean three times unused objects (repeat 3 (gc)) (princ) );defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------;;;;;;-----End of Put2----;;;;;;--------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------;;;;;;-----FUNCTION DeleteCustom----;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Pagina 19

(Defun DeleteCustom (/ suminfo n)

(setq suminfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))) );SETQ

(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----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------;;;;;;-----Function Toggles ----;;;;;;--------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Toggles ( / name name1 name2 name3 name4 name5 name6 name# nameOn)

(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

(Foreach x name (setq name# (strcat x "#")) (Setq name1 (cons name# name1)) )

(foreach x name1 (setq name2 x) (setq nameOn(get_tile name2)) (if (/= nameon "1") (progn (setq name3 (cons name2 name3)) )

);if );foreach

(foreach x name3 (setq name6 x) (setq name4 (vl-string-trim "#" name6)) (setq name5 (cons name4 name5)) ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----END of DeleteCustom----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------------;;;;;;-----Function Toggleselectall ----;;;;;;----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Toggleselectall ( / toggle togglex )

(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-----;;;;;;--------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------;;;;;;-----Function Checkselect------;;;;;;-------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun CheckSelect (/ Numlst Num name# name)

(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" ));SETQ

(Foreach x name (Setq name# (strcat x "#")) (Setq Num (get_tile name#)) (Setq Numlst (cons Num Numlst)) )

(if (member "0" Numlst) (progn (progn (mode_tile "SelectAll" 0)

) (if (member "1" Numlst) (mode_tile "SelectNone" 0)

(progn (mode_tile "SelectNone" 1) (Set_tile "Selectrow1" "0") (Set_tile "Selectrow2" "0") (Set_tile "Selectrow3" "0") (Set_tile "Selectrow4" "0") (Set_tile "Selectrow5" "0") (Set_tile "Selectrow6" "0") (Set_tile "Selectrow7" "0") (Set_tile "Selectrow8" "0") (Set_tile "Selectrow9" "0") (Set_tile "Selectrow10" "0") (Set_tile "Selectrow11" "0") ) ) )

(progn (progn (mode_tile "SelectAll" 1) (Set_tile "Selectrow1" "1") (Set_tile "Selectrow2" "1") (Set_tile "Selectrow3" "1") (Set_tile "Selectrow4" "1") (Set_tile "Selectrow5" "1") (Set_tile "Selectrow6" "1") (Set_tile "Selectrow7" "1") (Set_tile "Selectrow8" "1") (Set_tile "Selectrow9" "1") (Set_tile "Selectrow10" "1") (Set_tile "Selectrow11" "1") ) (if (member "1" Numlst) (mode_tile "SelectNone" 0) (progn (mode_tile "SelectNone" 1) (Set_tile "Selectrow1" "0") (Set_tile "Selectrow2" "0")

Pagina 21

(Set_tile "Selectrow3" "0") (Set_tile "Selectrow4" "0") (Set_tile "Selectrow5" "0") (Set_tile "Selectrow6" "0") (Set_tile "Selectrow7" "0") (Set_tile "Selectrow8" "0") (Set_tile "Selectrow9" "0") (Set_tile "Selectrow10" "0") (Set_tile "Selectrow11" "0") ) ) ) ) (princ) ); DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------;;;;;;------End of Checkselect-------;;;;;;-------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function ToggleselectNone ----;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun ToggleselectNone ( / name name# toggle togglex )

(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" ));SETQ

(setq toggle (Toggles)) (Foreach x toggle (setq togglex x) (setq name (vl-remove togglex name)) ) (Foreach x name (setq name# (strcat x "#")) (Set_tile name# "0") ) (set_tile "OPMERKING" "None selected") (mode_tile "SelectNone" 1) (Set_tile "Selectrow1" "0") (Set_tile "Selectrow2" "0") (Set_tile "Selectrow3" "0") (Set_tile "Selectrow4" "0") (Set_tile "Selectrow5" "0") (Set_tile "Selectrow6" "0") (Set_tile "Selectrow7" "0") (Set_tile "Selectrow8" "0") (Set_tile "Selectrow9" "0") (Set_tile "Selectrow10" "0") (Set_tile "Selectrow11" "0")

(princ)

);DEFUn

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------;;;;;;-----End of ToggleselectNone-----;;;;;;---------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow1-----------;;;

Pagina 22

;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow1 ( / name name# num)

(setq name# '("DOSSIERNUMMER#" "PROJECTNAAM#" "AFK ELEMENT#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3) (set_tile "Selectrow1" "1") (set_tile "Selectrow1" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow1-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow2-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow2 ( / name name# num)

(setq name# '("BETREFT1#" "BETREFT2#" "PROVINCIE#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3) (set_tile "Selectrow2" "1") (set_tile "Selectrow2" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow2-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow3-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow3 ( / name name# num)

(setq name# '("AANNEMER#" "ADRESAANNEMER1#" "ADRESAANNEMER2#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3) (set_tile "Selectrow3" "1") (set_tile "Selectrow3" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;

Pagina 23

;;;-----End of Togglerow3-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow4-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow4 ( / name name# num)

(setq name# '("STRAATBOUWPLAATS#" "POSTCODE#" "BOUWPLAATS#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3) (set_tile "Selectrow4" "1") (set_tile "Selectrow4" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow4-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow5-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow5 ( / name name# num)

(setq name# '("BOUWHEER#" "BOUWHEERADRES1#" "BOUWHEERADRES2#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3) (set_tile "Selectrow5" "1") (set_tile "Selectrow5" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow5-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow6-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow6 ( / name name# num)

(setq name# '("ARCHITECT#" "ARCHITECTADRES1#" "ARCHITECTADRES2#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 3)

Pagina 24

(set_tile "Selectrow6" "1") (set_tile "Selectrow6" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----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)) ) )

(if (= num 2) (set_tile "Selectrow7" "1") (set_tile "Selectrow7" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow7-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow8-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow8 ( / name name# num)

(setq name# '("VELLINGK. BALK.KOLOM#" "VELLINGK. WAND#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 2) (set_tile "Selectrow8" "1") (set_tile "Selectrow8" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow8-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Togglerow9-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow9 ( / name name# num)

(setq name# '("KWALITEIT BETON#" "GEBRUIKSDOMEIN#" ));SETQ (setq num 0)

(foreach x name#

Pagina 25

(setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 2) (set_tile "Selectrow9" "1") (set_tile "Selectrow9" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End of Togglerow9-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----Function Togglerow10-----------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow10 ( / name name# num)

(setq name# '( "OMGEVINGSKLASSE#" "CONSISTENTIEKLASSE#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 2) (set_tile "Selectrow10" "1") (set_tile "Selectrow10" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----End of Togglerow10-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----Function Togglerow11-----------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun ToggleRow11 ( / name name# num)

(setq name# '( "KORRELAFM NOM.#" "MIN. DEKKING#" ));SETQ (setq num 0)

(foreach x name# (setq name x) (if (=(get_tile name) "1") (setq num (+ num 1)) ) )

(if (= num 2) (set_tile "Selectrow11" "1") (set_tile "Selectrow11" "0") ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;----------------------------;;;;;;-----End of Togglerow11-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function getrow1-----------;;;;;;--------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Pagina 26

(Defun GetRow1 ( / name name# row1)

(setq name# '("DOSSIERNUMMER#" "PROJECTNAAM#" "AFK ELEMENT#" ));SETQ (setq row1 (get_tile "Selectrow1"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow2-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow2 ( / name name# row2)

(setq name# '("BETREFT1#" "BETREFT2#" "PROVINCIE#" ));SETQ (setq row2 (get_tile "Selectrow2"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow3-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow3 ( / name name# row3)

Pagina 27

(setq name# '("AANNEMER#" "ADRESAANNEMER1#" "ADRESAANNEMER2#"));SETQ (setq row3 (get_tile "Selectrow3"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow4-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow4 ( / name name# row4)

(setq name# '("STRAATBOUWPLAATS#" "POSTCODE#" "BOUWPLAATS#" ));SETQ (setq row4 (get_tile "Selectrow4"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow5-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow5 ( / name name# row5)

(setq name# '("BOUWHEER#" "BOUWHEERADRES1#" "BOUWHEERADRES2#" ));SETQ (setq row5 (get_tile "Selectrow5"))

Pagina 28

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow6-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow6 ( / name name# row6)

(setq name# '("ARCHITECT#" "ARCHITECTADRES1#" "ARCHITECTADRES2#" ));SETQ (setq row6 (get_tile "Selectrow6"))

(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-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow7 ( / name name# row7)

(setq name# '("BEK TEKENAAR#" "WAP TEKENAAR#" ));SETQ (setq row7 (get_tile "Selectrow7"))

(if (= row7 "1") (progn

Pagina 29

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow8-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow8 ( / name name# row8)

(setq name# '("VELLINGK. BALK.KOLOM#" "VELLINGK. WAND#" ));SETQ (setq row8 (get_tile "Selectrow8"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------------;;;;;;-----Function Getrow9-----------;;;;;;-----------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow9 ( / name name# row9)

(setq name# '("KWALITEIT BETON#" "GEBRUIKSDOMEIN#" ));SETQ (setq row9 (get_tile "Selectrow9"))

(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-----;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----Function Getrow10-----------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow10 ( / name name# row10)

(setq name# '("OMGEVINGSKLASSE#" "CONSISTENTIEKLASSE#" ));SETQ (setq row10 (get_tile "Selectrow10"))

(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-----;;;;;;----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------;;;;;;-----Function Getrow11-----------;;;;;;---------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetRow11 ( / name name# row11)

(setq name# '("KORRELAFM NOM.#" "MIN. DEKKING#" ));SETQ (setq row11 (get_tile "Selectrow11"))

(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-----;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------------;;;;;;-----Function Hide-----------;;;;;;-----------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Hide ( / name name1 namex name@x name@)

(if Remember (setq Remember nil) )

(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 (foreach x name (setq namex x) (if (/= (get_tile namex) "") (setq name1 (get_tile namex)) (setq name1 "None") ) (Setq name@x (strcat x "@")) (if (/= (get_tile name@x) "") (setq name@ (get_tile name@x)) (setq name@ "None") ) (setq Remember (cons (list namex name1 name@) Remember)) ) (done_dialog 4) (princ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----End if Hide-----------;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------------;;;;;;-----Function GETEXCELPLANLIJST-------;;;;;;--------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(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 (findfile Defaultfile) (progn (vl-file-rename Defaultfile ExcelfileName) (Alert (strcat "Changed " Defaultfile " to " ExcelfileName ".")) )

(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

;;;---function to start excel (setq Excelapp (vlax-get-or-create-object "Excel.Application")) (if (not Excelapp) (progn (alert "Can't start Excel") (exit) );PROGN );IF

;;;---Put excel invisible (vla-put-visible Excelapp :vlax-false)

;;;---ignore alerts excel (vlax-put-property Excelapp 'DisplayAlerts :vlax-False)

;;;---Open file with excel (setq Excelfile (vl-catch-all-apply 'vla-open (list (vlax-get-property Excelapp "WorkBooks") ExcelfileName)))

;;;---look for sheets (setq xlSheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property Excelfile "Sheets") "Item" sheetName)))

;;;---Make the selected worksheet active (vlax-invoke-method xlSheet "Activate")

(setq PlanRange (vlax-get-property (vlax-get-property xlSheet 'Cells) "range" "A17:A45"))

(setq RepeatN 0)

(repeat 23

(setq RepeatN (+ RepeatN 1))

(setq Repeat2d RepeatN)

(Setq PLANnr (strcat dossval "/" (add0 Repeat2d))) (setq PLANnrlst (cons PLANnr PLANnrlst)) (Setq Nr (strcat "NR" (rtos RepeatN 2 0))) (Setq T1 (strcat "T1." (rtos RepeatN 2 0))) (Setq T2 (strcat "T2." (rtos RepeatN 2 0))) (Setq SCHAAL (strcat "SCHAAL" (rtos RepeatN 2 0))) (Setq OPMAAKDD (strcat "OPMDD." (rtos RepeatN 2 0))) (Setq A (strcat "A." (rtos RepeatN 2 0))) (Setq ADD (strcat "ADD." (rtos RepeatN 2 0))) (Setq B (strcat "B." (rtos RepeatN 2 0))) (Setq BDD (strcat "BDD." (rtos RepeatN 2 0))) (Setq C (strcat "C." (rtos RepeatN 2 0))) (Setq CDD (strcat "CDD." (rtos RepeatN 2 0))) (Setq D (strcat "D." (rtos RepeatN 2 0))) (Setq DDD (strcat "DDD." (rtos RepeatN 2 0))) (Setq E (strcat "E." (rtos RepeatN 2 0))) (Setq EDD (strcat "EDD." (rtos RepeatN 2 0))) (Setq F (strcat "F." (rtos RepeatN 2 0))) (Setq FDD (strcat "FDD." (rtos RepeatN 2 0)))

(setq Nrlst (cons (list PLANnr Nr T1 T2 SCHAAL OPMAAKDD A ADD B BDD C CDD D DDD E EDD F FDD) Nrlst)) )

(setq Nrlst (reverse Nrlst))

Pagina 33

(vlax-for x PlanRange

(setq PlanRangeVal (sel-str (vlax-variant-value (vlax-get-property x 'Value))))

(if (member PlanRangeVal PLANnrlst) (progn (setq PlanRangeX x) (if (= (GetVal PlanRangeX) "yes") (progn (setq col -1) (setq CellValueLst nil) (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 (+ col 1)) (vlax-get-property x 'Column)) );GETPROP );VARIANT 'Value );GETPROP );VARIANT );SEL-STR );setq (setq CellValueLst (cons CellValue CellValueLst)) );Repeat (setq CellValueLst (reverse CellValueLst)) (setq PLANValueLst (cons CellValueLst PLANValueLst)) );progn ) );PROGN

);IF );VLAX

(if PLANValueLst (setq PLANValueLst (reverse PLANValueLst)) )

(foreach x PLANValueLst (setq PlanValue x) (foreach x Nrlst (if (member (car PlanValue) x) (progn

(setq Nr (cadr x)) (setq PLANnr (car x)) (Set_tile Nr PLANnr) (setq T1(caddr x));car(cdr(cdr (setq T1x (cadr PlanValue));car(cdr (Set_tile T1 T1x)

(setq T2(car(cdr(cdr(cdr x))))) (setq T2x (car(cdr(cdr PlanValue)))) (Set_tile T2 T2x) (setq SCHAAL(car(cdr(cdr(cdr(cdr x)))))) (setq SCHAALx (car(cdr(cdr(cdr PlanValue))))) (Set_tile SCHAAL SCHAALx)

(setq OPMAAKDD(car(cdr(cdr(cdr(cdr(cdr x))))))) (setq OPMAAKDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr PlanValue))))))) )) )) ) (if (/= "18991230" OPMAAKDDx) (Setq OPMAAKDDstr (strcat (substr OPMAAKDDx 1 4) "/" (substr OPMAAKDDx 5 2) "/" (substr OPMAAKDDx 7 2) )) (Setq OPMAAKDDstr "") )

Pagina 34

(Set_tile OPMAAKDD OPMAAKDDstr)

(setq A(car(cdr(cdr(cdr(cdr(cdr(cdr x)))))))) (setq Ax (car(cdr(cdr(cdr(cdr(cdr PlanValue))))))) (Set_tile A Ax)

(setq ADD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))) (setq ADDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))) )) )) ) (if (/= "18991230" ADDx) (Setq ADDstr (strcat (substr ADDx 1 4) "/" (substr ADDx 5 2) "/" (substr ADDx 7 2) )) (Setq ADDstr "") ) (Set_tile ADD ADDstr)

(setq B(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x)))))))))) (setq Bx (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))) (Set_tile B Bx)

(setq BDD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))))) (setq BDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))) )) )) ) (if (/= "18991230" BDDx) (Setq BDDstr (strcat (substr BDDx 1 4) "/" (substr BDDx 5 2) "/" (substr BDDx 7 2) )) (Setq BDDstr "") ) (Set_tile BDD BDDstr)

(setq C(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x)))))))))))) (setq Cx (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))) (Set_tile C Cx)

(setq CDD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))))))) (setq CDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))) )) )) ) (if (/= "18991230" CDDx) (Setq CDDstr (strcat (substr CDDx 1 4) "/" (substr CDDx 5 2) "/" (substr CDDx 7 2) )) (Setq CDDstr "") ) (Set_tile CDD CDDstr)

(setq D(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x)))))))))))))) (setq Dx (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))) (Set_tile D Dx)

(setq DDD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))))))))) (setq DDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))))) )) )) ) (if (/= "18991230" DDDx) (Setq DDDstr (strcat (substr DDDx 1 4) "/" (substr DDDx 5 2) "/" (substr DDDx 7 2) )) (Setq DDDstr "") ) (Set_tile DDD DDDstr)

(setq E(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x)))))))))))))))) (setq Ex (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue)))))))))))))))

Pagina 35

(Set_tile E Ex)

(setq EDD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))))))))))) (setq EDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))))))) )) )) ) (if (/= "18991230" EDDx) (Setq EDDstr (strcat (substr EDDx 1 4) "/" (substr EDDx 5 2) "/" (substr EDDx 7 2) )) (Setq EDDstr "") ) (Set_tile EDD EDDstr)

(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)

(setq FDD(car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr x))))))))))))))))))) (setq FDDx (itoa(fix (jtod(fix (+ 2415019 (atof (car(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr(cdr PlanValue))))))))))))))))))) )) )) ) (if (/= "18991230" FDDx) (Setq FDDstr (strcat (substr FDDx 1 4) "/" (substr FDDx 5 2) "/" (substr FDDx 7 2) )) (Setq FDDstr "") ) (Set_tile FDD FDDstr)

);PROGN );IF );FOREACH );FOREACH (vlax-invoke-method Excelfile 'Close) (vlax-invoke-method Excelapp 'Quit) (mapcar 'vlax-release-object (list Excelapp Excelfile xlSheet PlanRange)) (repeat 3 (gc)) );PRoGN );IF );DEFUN----------------

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----End of GETEXCELPLANLIJST-------;;;;;;------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------------;;;;;;-----Function EXTRACTEXCELPLANLIJST-------;;;;;;------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun EXTRACTEXCELPLANLIJST ( / gegevens Num Listgeg geg listdata data Numgeg Numdata)

(setq gegevens (list "NR" "T1." "T2." "SCHAAL" "OPMDD." "A." "ADD." "B." "BDD." "C." "CDD." "D." "DDD." "E." "EDD." "F." "FDD."))

(setq Num 0) (repeat 22 (setq Numgeg nil) (setq Num (+ Num 1)) (foreach x gegevens (setq geg (strcat x (rtos Num 2 0))) (setq Numgeg (cons geg Numgeg)) ) (setq Listgeg (cons Numgeg Listgeg)) )

Pagina 36

;;; (setq Listgeg (reverse Listgeg))

(foreach x Listgeg (setq Numgeg x) (setq Numdata nil) (foreach x Numgeg (setq geg x) (setq data (get_tile geg)) (if (eq data "") (setq Numdata (cons (list geg "----") Numdata)) (setq Numdata (cons (list geg data) Numdata)) ) ) (setq listdata (cons Numdata listdata)) )

;;;---Sheetname (setq sheetName "Dossierbeheer") (setq dossval (get_tile "Projectnumber")) (if (= dossval "") (Alert "You need a projectnumber to continue.") (progn

;;;---if you fill in projectnumber you get the right filename (setq FileName (strcat "PLANLIJST_" dossval)) (setq DWGprefix (getvar "dwgprefix"))

(setq Excelprefix (vl-string-trim "ACAD\\" DWGprefix))

(setq Defaultfile (strcat Excelprefix "\\PLANLIJST_0000.xlsx")) (setq ExcelfileName (strcat Excelprefix "\\" FileName ".xlsx" ))

(if (findfile Defaultfile) (progn (vl-file-rename Defaultfile ExcelfileName) (Alert (strcat "Changed " Defaultfile " to " ExcelfileName ".")) )

(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 ;;;---function to start excel (setq Excelapp (vlax-get-or-create-object "Excel.Application")) (if (not Excelapp) (progn (alert "Can't start Excel") (exit) );PROGN );IF

;;;---Put excel invisible (vla-put-visible Excelapp :vlax-false)

;;;---ignore alerts excel (vlax-put-property Excelapp 'DisplayAlerts :vlax-False)

;;;---Open file with excel (setq Excelfile (vl-catch-all-apply 'vla-open (list (vlax-get-property Excelapp "WorkBooks") ExcelfileName)))

;;;---look for sheets (setq xlSheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property Excelfile "Sheets") "Item" sheetName))) ;;;---Make the selected worksheet active (vlax-invoke-method xlSheet "Activate")

;;;--- cellrange in sheet and range for row1

;;; (setq excelrange (vlax-get-property ExcelApp "Cells")) (setq PlanRange (vlax-get-property (vlax-get-property xlSheet 'Cells) "range" "A17:A45"))

Pagina 37

;;; (setq MaxRange (vlax-get-property (vlax-get-property xlSheet 'Cells) "range" "A1"));;;

(foreach x listdata (setq title x)

(setq titleL (- (length title) 1)) ;;; (princ titleL)

(vlax-for x PlanRange (setq row (vlax-get-property x 'row)) (setq PlanRangeVal (sel-str (vlax-variant-value (vlax-get-property x 'Value)))) (if (eq PlanRangeVal (cadr (car title))) (progn (setq col 1) (repeat titleL (setq title (vl-remove (car title) title)) (if (eq (vl-string-search "DD" (strcat(car(car title)))) nil) (progn (setq first (strcat (cadr (car title))))

) (progn (setq first (cadr (car title))) )

) (setq col (+ col 1)) (if (eq first "----") (Setq first "") ) (setq rangx (variant-value(vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item row col ))) (vlax-put-property rangx 'value2 first) ) ) ) ) )

;;;;;;---close, quit and releases VLAobjects (vlax-invoke-method Excelfile 'Close :vlax-true) (vlax-invoke-method Excelapp 'Quit) (mapcar 'vlax-release-object (list Excelapp Excelfile xlSheet PlanRange))

;;;---Clean three times unused objects (repeat 3 (gc)) (princ) ) )

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------------;;;;;;-----END OF EXTRACTEXCELPLANLIJST-------;;;;;;------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------------;;;;;;-----Function PUTEXCELPLANLIJST-------;;;;;;--------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;(defun EXTRACT (/);;;;;; (if ;;; (eq (get_tile "Planlijst") "1");;; (progn;;; (EXTRACTEXCELPLANLIJST);;; (BLOCKTEXT);;; );;; );;; (if ;;; (eq (get_tile "Dossiergegevens") "1");;; (progn;;; (ExtractCAD);;; );;; );;; )

Pagina 38

(defun PUTEXCELPLANLIJST ( / dossval DWGprefix Externfolder script Drawings Drawing Files sf dossfile TextDoss ThisDwg Countblock CoFile Activefile AcFile Lokaalfolder)

(setq DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#") Countblock (strcat Externfolder "\\BinCountBlock.txt") ThisDwg (strcat DWGprefix (getvar "dwgname")) version (ASDCHECK) dossval (get_tile "Projectnumber") Countblock (strcat Externfolder "\\BinCountBlock.txt"))

(setq CoFile (open Countblock "W")) (close CoFile) (setq version (ASDCHECK))

(setq Drawings (GetValList1)) (setq script (strcat Externfolder "\\BinOpenDWGforTitleblock.SCR")) (foreach x Drawings (setq Drawing (strcat DWGprefix x ".dwg")) (if (not(= Drawing ThisDwg)) (setq Files (cons Drawing Files)) ) )

(if (> (length Files) 0) (progn (setq sf (open script "w")) (write-line "Filedia" sf) (write-line "0" sf) (write-line "qsave" sf) (write-line "close" sf) (if (eq version "ASD") (write-line "N" sf) ) (foreach dwg Files (write-line "_.open" sf) (write-line (strcat "\""dwg "\"") sf) (write-line "(load \"Dossier\")" sf) (if (eq (get_tile "Planlijst") "1") (progn (write-line "(DISTRIBUTEEXCELPLANNLIJST)" sf) ) ) (if (eq (get_tile "Dossiergegevens") "1") (progn (write-line "(Createcustom)" sf) (write-line "(GETTEXTDOSSIERGEGEVEN)" sf) ) ) (write-line "_.qsave" sf) (write-line "close" sf) )

(write-line "_.open" sf) (write-line (strcat "\"" ThisDwg "\"") sf) (write-line "Filedia" sf) (write-line "1" sf) (foreach x Drawings (setq Drawing (strcat DWGprefix x ".dwg")) (if (= Drawing ThisDwg) (progn (if (eq (get_tile "Planlijst") "1") (progn (write-line "(DISTRIBUTEEXCELPLANNLIJST)" sf) ) ) (if (eq (get_tile "Dossiergegevens") "1") (progn (write-line "(GETTEXTDOSSIERGEGEVEN)" sf) ) ) ) ) ) (write-line "(AlertEditedblocks)" sf) (write-line "_.qsave" sf) (write-line "_.regen" sf)

(close sf)

Pagina 39

) ) (princ) ); Defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------;;;;;;-----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))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------------;;;;;;-----function AlertEditedblocks -------;;;;;;---------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun AlertEditedblocks (/ ListtxtL Listtxt DWGprefix Externfolder Countblock file Txtline Position Listblock block)

(setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\#Library-Do Not Edit#")) (setq Countblock (strcat Externfolder "\\BinCountBlock.txt"))

(setq file (open Countblock "R")) (while (setq Txtline (read-line file)) (setq Listtxt (cons Txtline Listtxt)) ) (close file)

(setq ListtxtL (Length Listtxt))

(repeat ListtxtL (prompt (strcat "\n" (car Listtxt))) (setq Position (vl-string-search "is" (strcat(car Listtxt)))) (setq block (substr (car Listtxt) 7 (- Position 7))) (setq Listblock (cons block Listblock)) (setq Listtxt (cdr Listtxt)) )

(setq Listblock(AT:ListDuplicates Listblock)) (if (not(eq Listblock nil)) (Alert "There are blockduplicates, see prompt commandline") ) (princ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------------;;;;;;-----End of AlertEditedblocks -------;;;;;;-------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------;;;;;;-----Function ScriptBlock-------;;;;;;--------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun ScriptBlock (/ DWGprefix Externfolder script trust)

(setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\#Library-Do Not Edit#")) (setq script (strcat Externfolder "\\BinOpenDWGforTitleblock.SCR")) (setq trust (strcat "R:\\...")) (if (and (setq trusted (getvar 'trustedpaths)) (not (vl-string-search trust trusted)) ) (setvar 'trustedpaths (strcat (vl-string-right-trim ";" trusted) ";" trust) ) ) (command-s "script" script )

Pagina 40

);defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------;;;;;;-----End of ScriptBlock-------;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----Function add0-------;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun add0 (Repeat2d / value)

(setq Repeat2d (rtos Repeat2d 2 0)) (setq value (strlen Repeat2d)) (if (< value 2) (progn (setq Repeat2d (strcat "0" Repeat2d)) ) Repeat2d ) );DEFUN--------------

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----------------------;;;;;;-----End of add0-------;;;;;;-----------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------;;;;;;-----Function Getval-------;;;;;;---------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(Defun GetVal ( PlanRangeX / Titel1)

(setq Titel1 (sel-str (vlax-variant-value (vlax-get-property (vlax-variant-value (vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item (vlax-get-property PlanRangeX 'Row) (+ 1 (vlax-get-property PlanRangeX 'Column)) );GETPROP );VARIANT 'Value );GETPROP );VARIANT );SEL-STR );setq (if (= Titel1 "") (strcat "not") (strcat "yes") ) );Defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------;;;;;;-----End of GetVal-------;;;;;;-------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------------------;;;;;;-----Function DISTRIBUTEEXCELPLANNLIJST------;;;;;;---------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun DISTRIBUTEEXCELPLANNLIJST ( / file Textblock Externfolder Activedoc DWGprefix Txtline Listtxt Blockname objs Listtxt Listtxt1 ListtxtL Li ListAttVal Att Attl Val itm blks Countblock CoFile lineBlock ThisDwg TxtForDwgTitleblock DWGname DWGnameL)

(setq DWGprefix (getvar "dwgprefix") Externfolder (strcat DWGprefix "\#Library-Do Not Edit#")

Pagina 41

DWGname (getvar "dwgname") DWGnameL (strlen DWGname) DWGname (substr DWGname 1 (- DWGnameL 4)) TxtForDwgTitleblock (strcat Externfolder "\\Bin"DWGname"Titleblock.txt"))

(if (open TxtForDwgTitleblock "r") (progn; first argument 1.1.1 (setq file (open TxtForDwgTitleblock "R")) (while (setq Txtline (read-line file)) (setq Listtxt1 (cons Txtline Listtxt1))) (close file) (if (eq (Length Listtxt1) 0) (setq Listtxt1 nil) (setq Listtxt1 (reverse Listtxt1)) ) ) (setq Listtxt1 nil) )

(if (not (eq Listtxt1 nil)) (progn

(setq Activedoc (vla-get-activedocument (vlax-get-acad-object)) Textblock (strcat Externfolder "\\BinTextExcelAviable.txt") Countblock (strcat Externfolder "\\BinCountBlock.txt") ThisDwg (strcat DWGprefix (getvar "dwgname")))

(setq file (open Textblock "R")) (while (setq Txtline (read-line file)) (setq Listtxt (cons Txtline Listtxt)) ) (close file)

;; since I have to append from the front, my list is in reverse, so I just rearrange it.

(setq Listtxt (reverse Listtxt)) (foreach x Listtxt (if (vl-position x Listtxt1) (progn

(setq Blockname (strcat x)) (if(and (tblsearch "block" Blockname) (ssget "_X" '((0 . "INSERT")(66 . 1))) )

(vlax-for block (vla-get-ActiveSelectionSet Activedoc) (if (= (strcase (vlax-get-property block 'EffectiveName)) (strcase Blockname)) (progn (setq CoFile (open Countblock "A")) (Setq lineBlock (strcat "Block " Blockname " is adjusted in drawing: " ThisDwg)) (write-line (strcat lineBlock) CoFile) (close CoFile) ) ) ) ) (setq TextB (strcat Externfolder "\\" Blockname ".txt"))

(setq fileB (open TextB "R")) (while (setq TxtBline (read-line fileB)) (setq ListBtxt (cons TxtBline ListBtxt)) )

(close fileB)

(setq ListAttVal nil) (setq ListBtxtL (/ (length ListBtxt) 2)) (repeat ListBtxtL (setq Li (reverse(list (car ListBtxt) (cadr ListBtxt)))) (Setq ListAttVal (cons Li ListAttVal)) (setq ListBtxt (cdr (cdr ListBtxt))) )

(foreach x ListAttVal (Setq Att (car x)) (setq Attl (strlen Att)) (setq Attl (- Attl 1 )) (setq Att (substr Att 1 Attl)) (setq Val (cadr x))

Pagina 42

(if (= Val "----") (setq Val "") )

(if (tblsearch "block" Blockname) (progn (if (setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)))) (vlax-for block (setq SetDoc (vla-get-ActiveSelectionSet Activedoc)) (if (= (strcase (vlax-get-property block 'EffectiveName)) (strcase Blockname)) (progn (if (setq itm (assoc (strcase Att) (mapcar(function(lambda (j)(list(vla-get-tagstring j)(vla-get-textstring j)j))) (vlax-invoke block 'GetAttributes)))) (progn (vla-put-textstring (last itm) Val) ) ) ) ) )

) ) ) ) (vla-delete SetDoc) ) ) ) ) ) (princ) );defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;---------------------------------------------;;;;;;-----End of DISTRIBUTEEXCELPLANNLIJST------;;;;;;---------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------------;;;;;;-----function Getprojectnumber------;;;;;;-------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun BLOCKTEXT ( / TextDoss Externfolder DWGprefix dossval file Txtline Listtxt dossval Activedoc blks RepeatN dossval Repeat2d PLANnr PLANnrlst Nr Nrlst T1 T2 SCHAAL OPMAAKDD A ADD B BDD C CDD D DDD E EDD F FDD ListAtt NrX Nrxlst Att val ListXAtt Lst ListXAttVal ListAttVal BlockName objs ss Lstx Attl itm DWGprefix open_file TextTitleblock Externfolder ThisDwg script Drawings Drawing Files Blocktext sf TextExcelAviable Titleblock dossfile TextDoss)

(setq dossval (get_tile "Projectnumber")) (setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\#Library-Do Not Edit#"))

(setq RepeatN 0) (repeat 22

(setq RepeatN (+ RepeatN 1)) (setq Repeat2d RepeatN)

(Setq PLANnr (strcat dossval (add0 Repeat2d))) (setq PLANnrlst (cons PLANnr PLANnrlst))

(Setq Nr (strcat "NR" (rtos RepeatN 2 0))) (setq Nrlst (cons Nr Nrlst)) (Setq T1 (strcat "T1." (rtos RepeatN 2 0))) (Setq T2 (strcat "T2." (rtos RepeatN 2 0))) (Setq SCHAAL (strcat "SCHAAL" (rtos RepeatN 2 0))) (Setq OPMAAKDD (strcat "OPMDD." (rtos RepeatN 2 0))) (Setq A (strcat "A." (rtos RepeatN 2 0))) (Setq ADD (strcat "ADD." (rtos RepeatN 2 0))) (Setq B (strcat "B." (rtos RepeatN 2 0))) (Setq BDD (strcat "BDD." (rtos RepeatN 2 0)))

Pagina 43

(Setq C (strcat "C." (rtos RepeatN 2 0))) (Setq CDD (strcat "CDD." (rtos RepeatN 2 0))) (Setq D (strcat "D." (rtos RepeatN 2 0))) (Setq DDD (strcat "DDD." (rtos RepeatN 2 0))) (Setq E (strcat "E." (rtos RepeatN 2 0))) (Setq EDD (strcat "EDD." (rtos RepeatN 2 0))) (Setq F (strcat "F." (rtos RepeatN 2 0))) (Setq FDD (strcat "FDD." (rtos RepeatN 2 0))) (setq ListAtt (cons (list PLANnr Nr T1 T2 SCHAAL OPMAAKDD A ADD B BDD C CDD D DDD E EDD F FDD) ListAtt)) ) (setq ListAtt (reverse ListAtt )) (setq PLANnrlst (reverse PLANnrlst)) (setq Nrlst (reverse Nrlst))

(foreach x Nrlst (if (/= (get_tile x) "") (progn (setq NrX x) (setq Nr (get_tile x)) (setq Nr (strcat (substr Nr 1 4) (substr Nr 6 5))) (setq Nrxlst ( cons Nr Nrxlst)) (foreach x ListAtt (if (= (car x) Nr) (progn (setq Att x) (Setq ListXAtt (cons Att ListXAtt)) ) ) );Foreach );progn ) )

(foreach x ListXAtt (setq Lst (reverse(cdr x))) (setq ListXAttVal nil) (foreach x Lst (setq Att x) (if (= (get_tile Att) "") (setq val "----") (if (= (get_tile Att) nil) (setq val "----") (setq val (get_tile Att)) ) ) (setq ListXAttVal (cons (list Att val) ListXAttVal)) ) (setq ListAttVal (cons ListXAttVal ListAttVal)) ) (setq Nrxlst (reverse Nrxlst))

(setq TextExcelAviable (strcat Externfolder "\\BinTextExcelAviable.txt" )) (setq Blocktext (open TextExcelAviable "W")) (foreach x Nrxlst (setq Titleblock x)

(write-line (strcat Titleblock) Blocktext) ) (close Blocktext) (foreach x ListAttVal (setq Lst x) (setq Lstx (car(cdr(car Lst)))) (setq Lstx (strcat (substr Lstx 1 4) (substr Lstx 6 5))) (setq TextTitleblock (strcat Externfolder "\\" Lstx ".txt")) (setq open_file (open TextTitleblock "W")) (foreach x Lst (setq Att x) (foreach x Att (write-line (strcat x) open_file) ) ) (close open_file) ) (close open_file) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-------------------------------------;;;;;;-----End of Getprojectnumber------;;;

Pagina 44

;;;-------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; --------- ;;;;;; | SUB | ;;;;;; ------------------------- ------------------------- ;;;;;; | | ;;;;;; | Subdialog - DRAWING | ;;;;;; | | ;;;;;; " " ;;;;;; " " ;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---Function Getfiles---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun GetFiles ( / files file filelength filename filenamelst dcl_id ddiag)

(setq DWGprefix (getvar "dwgprefix")) (setq files (vl-directory-files DWGprefix "*.dwg" )) (foreach x files (setq file x) (setq filelength (strlen file)) (setq filelength (- filelength 4)) (setq filename (substr file 1 filelength)) (setq filenamelst (cons filename filenamelst)) ) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of Getfiles---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---Function !! teken---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun teken ( / dcl_id ddiag ValList1 ValList2)

;;;--- 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

(setq ValList2 (GetValList2)) (setq ValList1 (GetValList1))

(setq txtval ValList2 )

(start_list "lst1" 3) (mapcar 'add_list ValList1 ) (end_list)

(start_list "lst2" 3) (mapcar 'add_list ValList2)

Pagina 45

(end_list)

(action_tile "accept" "(done_dialog 2)") (action_tile "cancel" "(done_dialog 1) (Getcancel txtval)") (action_tile ">" "(button>)") (action_tile "<" "(button<)")

(setq ddiag(start_dialog))

;;;--- 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---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------------&&&;;;;;;&&&---Function Creatingfiles---&&&;;;;;;&&&----------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Creatingfiles ( / Externfolder DWGprefix TxtfileDir fname Txtfiletype Localfolder) (setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\\#Library-Do Not Edit#")) (setq Localfolder (strcat "C:\\Autodesk-library")) (setq TxtfileDir (strcat Externfolder "\\BinDWGforPLANLIJST.txt" ))

(if (not(vl-file-directory-p Localfolder)) (vl-mkdir Localfolder) )

(if (vl-file-directory-p Externfolder) (progn ; first argument 1.1 (if (not(open (strcat TxtfileDir) "R")) (progn; first argument 1.1.1 (setq fname (open (strcat TxtfileDir) "W")) (close fname) (set_tile "OPMERKING2" "Text made") );progn (set_tile "OPMERKING2" "Text file exist");second argument 1.1.2

);IF );PROGN (progn ;second argument 1.2 (vl-mkdir Externfolder) (if (not(open (strcat TxtfileDir) "R"))

(progn; first argument 1.1.1 (setq fname (open (strcat TxtfileDir) "W")) (close fname) (set_tile "OPMERKING2" "Text made") );progn

Pagina 46

(set_tile "OPMERKING2" "Text not found");second argument 1.2.2 );IF );PROGN );IF ); defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------------&&&;;;;;;&&&---End of Creatingfiles---&&&;;;;;;&&&----------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---Function Getlines---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Getlines ( / DWGprefix Externfolder TxtfileDir file Txtline Listtxt)

(setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\\#Library-Do Not Edit#")) (setq TxtfileDir (strcat Externfolder "\\BinDWGforPLANLIJST.txt" ))

;; 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---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&--------------------------&&&;;;;;;&&&---function GetValList1---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun GetValList1 ( / files Lines List1 filesL a First LinesL)

(setq files (GetFiles))

(setq Lines (Getlines)) (setq LinesL (length Lines))

(setq filesL (length files))

(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---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&--------------------------&&&;;;;;;&&&---function GetValList2---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun GetValList2 ( / files Lines List1 List2 Space1 Space2 opmerking a)

(setq files (GetFiles)) (setq Lines (Getlines)) (foreach x Lines (setq a x) (if (member a files) (progn (setq List1 (cons a List1)) );PROGN (progn (Setq Space1 " <") (Setq Space2 "> ") (setq List2 (cons Space1 List2)) (setq List2 (cons a List2)) (setq List2 (cons Space2 List2)) );PROGN );IF );Foreach (if List2 (setq List2 (reverse List2)) ) (setq opmerking (strcat "File(s) " (apply 'strcat List2) " not found. ")) (set_tile "OPMERKING2" opmerking) List1 );Defun

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&--------------------------&&&;;;;;;&&&---End of GetValList2---&&&;;;;;;&&&--------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------&&&;;;;;;&&&---Function button>---&&&;;;;;;&&&----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun button> ( / DWGprefix Externfolder TxtfileDir filesList1 filesList2 Num Listx ListindexAll readtile1 readtile1L readtile1a ListNum ListNumx Index list1 list2 Match1 open_file Select) (setq filesList1 (GetValList1)) (setq filesList2 (GetValList2)) (setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\\#Library-Do Not Edit#")) (setq TxtfileDir (strcat Externfolder "\\BinDWGforPLANLIJST.txt" )) (Setq Num 0) (foreach x filesList1

Pagina 48

(setq Listx x) (setq ListindexAll (cons (list Num Listx) ListindexAll)) (Setq Num (+ 1 Num)) ) (setq ListindexAll(reverse ListindexAll))

(Setq Num 1) (setq readtile1 (get_tile "lst1")) (setq readtile1L (strlen readtile1 ))

(setq readtile1a (strcat readtile1 " ")) (repeat readtile1L (if (= (substr readtile1a 2 1) " ");condition (progn (Setq ListNumx (substr readtile1a 1 Num)) (setq ListNum (cons ListNumx ListNum)) (setq readtile1a (substr readtile1a 3))

);progn (progn (Setq Num (+ 1 Num)) (setq readtile1a (substr readtile1a 2))

);progn );IF );repeat

(foreach x ListindexAll (setq Select (cadr x)) (setq Index (itoa(car x))) (if (member Index ListNum) (progn (setq Match1 (cons Select Match1)) ) (progn (setq list1 (cons Select list1)) ) ) ) (setq list2 (append filesList2 Match1))

(setq open_file (open TxtfileDir "W"))

(Foreach x list2 (write-line x open_file) ) (close open_file)

(setq filesList1 (GetValList1)) (setq filesList2 (GetValList2)) (start_list "lst1" 3) (mapcar 'add_list filesList1) (end_list) (start_list "lst2" 3) (mapcar 'add_list filesList2) (end_list)

);DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&-----------------------&&&;;;;;;&&&---End of Getfiles---&&&;;;;;;&&&-----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------&&&;;;;;;&&&---Function button<---&&&;;;;;;&&&----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;

Pagina 49

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun button< ( / DWGprefix Externfolder TxtfileDir filesList1 filesList2 Num Listx ListindexAll readtile2 readtile2L readtile2a ListNum ListNumx Index list1 list2 Match2 open_file select) (setq filesList1 (GetValList1)) (setq filesList2 (GetValList2)) (setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\\#Library-Do Not Edit#")) (setq TxtfileDir (strcat Externfolder "\\BinDWGforPLANLIJST.txt" ))

(Setq Num 0) (foreach x filesList2 (setq Listx x) (setq ListindexAll (cons (list Num Listx) ListindexAll)) (Setq Num (+ 1 Num)) ) (setq ListindexAll(reverse ListindexAll)) (Setq Num 1) (setq readtile2 (get_tile "lst2")) (setq readtile2L (strlen readtile2 ))

(setq readtile2a (strcat readtile2 " ")) (repeat readtile2L (if (= (substr readtile2a 2 1) " ");condition (progn (Setq ListNumx (substr readtile2a 1 Num)) (setq ListNum (cons ListNumx ListNum)) (setq readtile2a (substr readtile2a 3))

);progn (progn (Setq Num (+ 1 Num)) (setq readtile2a (substr readtile2a 2))

);progn );IF );repeat

(foreach x ListindexAll (setq Select (cadr x)) (setq Index (itoa(car x))) (if (member Index ListNum) (progn (setq Match2 (cons Select Match2)) ) (progn (setq list2 (cons Select list2)) ) ) ) (setq list1 (append filesList1 Match2))

(setq open_file (open TxtfileDir "W"))

(Foreach x list2 (write-line x open_file) ) (close open_file)

(setq filesList1 (GetValList1)) (setq filesList2 (GetValList2))

(start_list "lst1" 3) (mapcar 'add_list filesList1) (end_list) (start_list "lst2" 3) (mapcar 'add_list filesList2) (end_list) );DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Pagina 50

;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&----------------------&&&;;;;;;&&&---End of button<---&&&;;;;;;&&&----------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&------------------------&&&;;;;;;&&&---Function Getcancel---&&&;;;;;;&&&------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun Getcancel (txtval / DWGprefix Externfolder TxtfileDir open_file)

(setq DWGprefix (getvar "dwgprefix")) (setq Externfolder (strcat DWGprefix "\\#Library-Do Not Edit#")) (setq TxtfileDir (strcat Externfolder "\\BinDWGforPLANLIJST.txt" ))

(setq open_file (open TxtfileDir "W"))

(Foreach x txtval (write-line x open_file) ) (close open_file) )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;&&&------------------------&&&;;;;;;&&&---End of Getcancel---&&&;;;;;;&&&------------------------&&&;;;;;;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; " " ;;;;;; " " ;;;;;; | | ;;;;;; | Subdialog - DRAWING | ;;;;;; | | ;;;;;; ------------------------- ------------------------- ;;;;;; | END | ;;;;;; --------- ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------------------------;;;;;;-----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)))

Pagina 53

; Print the time. HH:MM:SS.msec (princ (strcat " " (if (> hh 9) "" "0") (itoa hh))) (princ (strcat ":" (if (> mm 9) "" "0") (itoa mm))) (princ (strcat ":" (if (> ss 9) "" "0") (itoa ss))) (princ (cond ((> msec 99) "." ) ((> msec 9) ".0" ) (T ".00") ) ) (princ msec) (terpri) (princ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------------------------------------------------------------;;;;;;-----End of the function of Autocad - Julian timeline-------;;;;;;------------------------------------------------------------;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; (setq name '(("DOSSIERNUMMER" "B") ("PROJECTNAAM" "C") ("AFK ELEMENT" "D") ("BETREFT1" "E") ("BETREFT2" "F")

;;; ("AANNEMER" "G") ("ADRESAANNEMER1" "H") ("ADRESAANNEMER2" "I") ("STRAATBOUWPLAATS" "J") ("POSTCODE" "K")

;;; ("BOUWPLAATS" "L") ("PROVINCIE" "M") ("BOUWHEER" "N") ("BOUWHEERADRES1" "O") ("BOUWHEERADRES2" "P")

;;; ("ARCHITECT" "Q") ("ARCHITECTADRES1" "R") ("ARCHITECTADRES2" "S") ("BEK TEKENAAR" "T") ("WAP TEKENAAR" "U")

;;; ("VELLINGK. BALK.KOLOM" "V") ("VELLINGK. WAND" "W") ("KWALITEIT BETON" "X") ("GEBRUIKSDOMEIN" "Y")

;;; ("OMGEVINGSKLASSE" "Z") ("CONSISTENTIEKLASSE" "AA") ("KORRELAFM NOM." "AB") ("MIN. DEKKING" "AC")

;;; ));SETQ

(defun CHECKTITLEBLOCK ( / DWGprefix Externfolder BlockUsed project DWGname DWGnameL TxtForDwgTitleblock project dcl_id Activedoc Projectnumber file listblock listblocksover rise stringrise dossblock ProjectnumberL Titleblock Listtxt Newlist Removelist OldList)

(setq DWGprefix (getvar "dwgprefix"); Externfolder (strcat DWGprefix "\#Library-Do Not Edit#"); BlockUsed (strcat Externfolder "\\BinTitleBlock.txt"); project (strcat Externfolder "\\BinProjectBlock.txt"); DWGname (getvar "dwgname"); DWGnameL (strlen DWGname); DWGname (substr DWGname 1 (- DWGnameL 4)); TxtForDwgTitleblock (strcat Externfolder "\\Bin"DWGname"Titleblock.txt"); Activedoc (vla-get-activedocument (vlax-get-acad-object)));

(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

(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) ) ) )

Pagina 54

) )

(progn (setq file (open project "R")) (setq Projectnumber (read-line file)) (close file) ) )

;;;;;;;;;;;;;;;;;;;;;;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))) )

(vlax-for block (vla-get-ActiveSelectionSet Activedoc) (if (= (strcase (vlax-get-property block 'EffectiveName)) (strcase ListX)) (progn (if (vl-position ListX Newlist) (Alert (strcat "Titleblock "ListX " is duplicated! Please delete one.")) (setq Newlist (cons ListX Newlist)) ) );Progn ) ) ) ) ) )

;;;;;;;;;;;;;getting erased blocks ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; for each element in listtxt , if it isn't equal to newlist, add it to removelist

(foreach x Listtxt (setq ListtxtX x) (if (not(member ListtxtX Newlist)) (setq Removelist (cons ListtxtX Removelist)) ) )

;;;;;;;;;;;;;;;;reset txt bin<dwgname>titleblock;;;;;;;;;;;;;;; ;;;;;;;recreate bin<dwgname>titleblock with no lines;;;;;;;;;;;;;;; (setq file (open TxtForDwgTitleblock "W")) (close file)

;;;;;;;;;;;;;;;;set the existing blocks in bin<dwgname>titleblock;;;;;;; ;;;; if newlist isn't empty set the existing block in bin<dwgname>titleblock

(if (not (eq Newlist nil)) (progn (setq Newlist (Reverse Newlist)) (foreach x Newlist (setq file (open TxtForDwgTitleblock "A")) (write-line (strcat x) file)

Pagina 55

(close file) ) ) )

;;;;;;;;;;;;;;;;;;;

(if (not (eq Removelist nil)) (progn (if (open BlockUsed "R") (progn (setq file (open BlockUsed "R")) (while (setq Txtline (read-line file)) (setq OldList (cons Txtline OldList))) (close file) (setq OldList (reverse OldList)) (setq file (open BlockUsed "W")) (foreach x OldList (setq OldListX x) (if (vl-position OldListX Removelist) (progn (Alert (strcat "You deleted block " OldListX ", This has been removed from the settings.")) (vlax-for y (vla-get-blocks Activedoc) (if (and (= (vla-get-objectname y) "AcDbBlockTableRecord") (= (strcase (vla-get-name y)) (strcase x)) ) (vla-delete y) ) ) ) (progn (write-line (strcat OldListX) file) ) );if );foreach (close file) );progn ) ) )

(princ) )

Pagina 56