added unitcheck
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
; Just drag the script to the autocad window.
|
; Just drag the script to the autocad window.
|
||||||
; The script automatically starts after loading, no command needed.
|
; The script automatically starts after loading, no command needed.
|
||||||
|
|
||||||
; Version 1.3
|
; Version 1.4
|
||||||
; Created by Peter Gyetvai
|
; Created by Peter Gyetvai
|
||||||
; gyetpet@mailbox.org
|
; gyetpet@mailbox.org
|
||||||
; git repo: https://git.gyetpet.dynu.net/infeeeee/revitDwgImportCleaner
|
; git repo: https://git.gyetpet.dynu.net/infeeeee/revitDwgImportCleaner
|
||||||
@@ -175,6 +175,69 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
; --------------------------------- unitCheck -------------------------------- ;
|
||||||
|
;CHeck units with measurement, change if wrong
|
||||||
|
(defun unitcheck (/ setunits currunit domeasure testdist dochange newunit newunitnum)
|
||||||
|
(setq setunits (getvar "insunits"))
|
||||||
|
|
||||||
|
(cond
|
||||||
|
((= setunits 0) (setq currunit "no units"))
|
||||||
|
((= setunits 1) (setq currunit "Inches"))
|
||||||
|
((= setunits 2) (setq currunit "Feet"))
|
||||||
|
((= setunits 3) (setq currunit "Miles"))
|
||||||
|
((= setunits 4) (setq currunit "Millimeters"))
|
||||||
|
((= setunits 5) (setq currunit "Centimeters"))
|
||||||
|
((= setunits 6) (setq currunit "Meters"))
|
||||||
|
((= setunits 7) (setq currunit "Kilometers"))
|
||||||
|
((= setunits 8) (setq currunit "Microinches"))
|
||||||
|
((= setunits 9) (setq currunit "Mils"))
|
||||||
|
((= setunits 10) (setq currunit "Yards"))
|
||||||
|
((= setunits 11) (setq currunit "Angstroms"))
|
||||||
|
((= setunits 12) (setq currunit "Nanometers"))
|
||||||
|
((= setunits 13) (setq currunit "Microns"))
|
||||||
|
((= setunits 14) (setq currunit "Decimeters"))
|
||||||
|
((= setunits 15) (setq currunit "Dekameters"))
|
||||||
|
((= setunits 16) (setq currunit "Hectometers"))
|
||||||
|
((= setunits 17) (setq currunit "Gigameters"))
|
||||||
|
((= setunits 18) (setq currunit "Astronomical Units"))
|
||||||
|
((= setunits 19) (setq currunit "Light Years"))
|
||||||
|
((= setunits 20) (setq currunit "Parsecs"))
|
||||||
|
((= setunits 21) (setq currunit "US Survey Feet"))
|
||||||
|
)
|
||||||
|
|
||||||
|
(initget 1 "Accept Change")
|
||||||
|
(setq domeasure (getkword (strcat "Current units: " currunit " \n[Accept/Change]")))
|
||||||
|
(princ domeasure)
|
||||||
|
|
||||||
|
(if
|
||||||
|
(= domeasure "Change")
|
||||||
|
(progn
|
||||||
|
(setq testdist (getdist "\nMeasure now"))
|
||||||
|
|
||||||
|
(initget 1 "Yes No")
|
||||||
|
(setq dochange (getkword (strcat "Measurement: " (rtos testdist) " " currunit "\nChange unit? [Yes/No]")))
|
||||||
|
(if
|
||||||
|
(= dochange "Yes")
|
||||||
|
(progn
|
||||||
|
(initget 1 "Inches Feet Millimeters Centimeters Decimeters Meters")
|
||||||
|
(setq newunit (getkword "Select new unit: [Inches/Feet/Millimeters/Centimeters/Decimeters/Meters]"))
|
||||||
|
|
||||||
|
(cond
|
||||||
|
((= newunit "Inches") (setq newunitnum 1))
|
||||||
|
((= newunit "Feet") (setq newunitnum 2))
|
||||||
|
((= newunit "Millimeters") (setq newunitnum 4))
|
||||||
|
((= newunit "Centimeters") (setq newunitnum 5))
|
||||||
|
((= newunit "Decimeters") (setq newunitnum 14))
|
||||||
|
((= newunit "Meters") (setq newunitnum 6))
|
||||||
|
)
|
||||||
|
(setvar "insunits" newunitnum)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(princ)
|
||||||
|
)
|
||||||
|
|
||||||
; -------------------------- checkedExportToAutocad -------------------------- ;
|
; -------------------------- checkedExportToAutocad -------------------------- ;
|
||||||
;if the file length is too long, export to desktop
|
;if the file length is too long, export to desktop
|
||||||
(defun checkedExportToAutocad (/ prefix basefilename fn1 fn2 fullength filename savepath)
|
(defun checkedExportToAutocad (/ prefix basefilename fn1 fn2 fullength filename savepath)
|
||||||
@@ -223,6 +286,9 @@
|
|||||||
;; Attdef to txt
|
;; Attdef to txt
|
||||||
(cAttDef2Text)
|
(cAttDef2Text)
|
||||||
|
|
||||||
|
;; Units
|
||||||
|
(unitcheck)
|
||||||
|
|
||||||
;; Variables
|
;; Variables
|
||||||
(setvar "PROXYGRAPHICS" 1)
|
(setvar "PROXYGRAPHICS" 1)
|
||||||
|
|
||||||
|
|||||||
60
source scripts/unitCheck.lsp
Normal file
60
source scripts/unitCheck.lsp
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
(defun c:unitcheck (/ setunits currunit domeasure testdist dochange newunit newunitnum)
|
||||||
|
(setq setunits (getvar "insunits"))
|
||||||
|
|
||||||
|
(cond
|
||||||
|
((= setunits 0) (setq currunit "no units"))
|
||||||
|
((= setunits 1) (setq currunit "Inches"))
|
||||||
|
((= setunits 2) (setq currunit "Feet"))
|
||||||
|
((= setunits 3) (setq currunit "Miles"))
|
||||||
|
((= setunits 4) (setq currunit "Millimeters"))
|
||||||
|
((= setunits 5) (setq currunit "Centimeters"))
|
||||||
|
((= setunits 6) (setq currunit "Meters"))
|
||||||
|
((= setunits 7) (setq currunit "Kilometers"))
|
||||||
|
((= setunits 8) (setq currunit "Microinches"))
|
||||||
|
((= setunits 9) (setq currunit "Mils"))
|
||||||
|
((= setunits 10) (setq currunit "Yards"))
|
||||||
|
((= setunits 11) (setq currunit "Angstroms"))
|
||||||
|
((= setunits 12) (setq currunit "Nanometers"))
|
||||||
|
((= setunits 13) (setq currunit "Microns"))
|
||||||
|
((= setunits 14) (setq currunit "Decimeters"))
|
||||||
|
((= setunits 15) (setq currunit "Dekameters"))
|
||||||
|
((= setunits 16) (setq currunit "Hectometers"))
|
||||||
|
((= setunits 17) (setq currunit "Gigameters"))
|
||||||
|
((= setunits 18) (setq currunit "Astronomical Units"))
|
||||||
|
((= setunits 19) (setq currunit "Light Years"))
|
||||||
|
((= setunits 20) (setq currunit "Parsecs"))
|
||||||
|
((= setunits 21) (setq currunit "US Survey Feet"))
|
||||||
|
)
|
||||||
|
|
||||||
|
(initget 1 "Accept Change")
|
||||||
|
(setq domeasure (getkword (strcat "Current units: " currunit " \n[Accept/Change]")))
|
||||||
|
(princ domeasure)
|
||||||
|
|
||||||
|
(if
|
||||||
|
(= domeasure "Change")
|
||||||
|
(progn
|
||||||
|
(setq testdist (getdist "\nMeasure now"))
|
||||||
|
|
||||||
|
(initget 1 "Yes No")
|
||||||
|
(setq dochange (getkword (strcat "Measurement: " (rtos testdist) " " currunit "\nChange unit? [Yes/No]")))
|
||||||
|
(if
|
||||||
|
(= dochange "Yes")
|
||||||
|
(progn
|
||||||
|
(initget 1 "Inches Feet Millimeters Centimeters Decimeters Meters")
|
||||||
|
(setq newunit (getkword "Select new unit: [Inches/Feet/Millimeters/Centimeters/Decimeters/Meters]"))
|
||||||
|
|
||||||
|
(cond
|
||||||
|
((= newunit "Inches") (setq newunitnum 1))
|
||||||
|
((= newunit "Feet") (setq newunitnum 2))
|
||||||
|
((= newunit "Millimeters") (setq newunitnum 4))
|
||||||
|
((= newunit "Centimeters") (setq newunitnum 5))
|
||||||
|
((= newunit "Decimeters") (setq newunitnum 14))
|
||||||
|
((= newunit "Meters") (setq newunitnum 6))
|
||||||
|
)
|
||||||
|
(setvar "insunits" newunitnum)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(princ)
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user