MSasu Posted March 27, 2012 Posted March 27, 2012 Mircea, user can always replace char. with find&replace option from notepad... Entirely true, but a good programming practice is to try to solve programmatically this instead of asking the user to fix it. Regards, Mircea Quote
Tharwat Posted March 28, 2012 Posted March 28, 2012 Tharwat, variable filename must be string of complete HD path + filename so consider changing integer of (getfiled) from 8 to 16... I still wonder about the differences between the flag values ( 8 and 16 ) for the getfiled function , so would you please explain it for me ? Quote
pBe Posted March 28, 2012 Posted March 28, 2012 Try this on a file included in the SFSP (getfiled "\nSelect file :" "" "" 8) "banana.txt" (getfiled "\nSelect file :" "" "" 16) "D:\\My Documents\\banana.txt" So everytime i use bit 8 i include (open (findfile var) "r") Quote
MSasu Posted March 28, 2012 Posted March 28, 2012 I will see that more like: (if (setq var (findfile var)) (open var "r")) Otherwise will get an error if the file isn't located in search path. Regards, Mircea Quote
Tharwat Posted March 28, 2012 Posted March 28, 2012 Thanks pBe . I saw the differences just if the file is in My documents , but if you select the file when it is on Desktop or other local drive , the result would be the same (8 and 16 ). Quote
pBe Posted March 28, 2012 Posted March 28, 2012 (edited) I will see that more like:(if (setq var (findfile var)) (open var "r")) Otherwise will get an error if the file isn't located in search path. Regards, Mircea True Oh. I just have a thought, the line wont fail if you selected the file thru getfiled. its a guarantee the file exists. Thanks pBe .I saw the differences just if the file is in My documents , but if you select the file when it is on Desktop or other local drive , the result would be the same (8 and 16 ). So what does that tell you? Cheers Edited March 28, 2012 by pBe A thought pops into my head Quote
Tharwat Posted March 28, 2012 Posted March 28, 2012 So what does that tell you? Cheers Try to put the banana.txt file on desktop and select the file with the function getfiled and see the result . Quote
MSasu Posted March 28, 2012 Posted March 28, 2012 Just add your Desktop on SFSP (Support File Search Path) to see what pBe means. Regards, Mircea Quote
sanrajbhar Posted April 2, 2012 Posted April 2, 2012 Hi, I am new to this forum.i hope that some body can help me out here. now i have a situation to create pile layout with coordinates.i have the coordinates of pile in excel format ( total 934 nos ).is any auto lisp can place the piles in the actual coordinates with the number ,Coordinates and the cutoff level ...i mean number+coordinates x,yz.pile dia 750mm Please help me Regards Just use attached xlxs file. i made some script. hope it helps. Rnd For Cadtutor.xlsx Quote
BIGAL Posted April 3, 2012 Posted April 3, 2012 Great Sanrajbhar I have been saying for ages use excel power if you can not program ! Did not know about the & easier than concactenate You can also cut the column, paste to notepad save as a script then run or write a macro to write script file direct. Quote
BlackBox Posted April 3, 2012 Posted April 3, 2012 FWIW - Autodesk // Labs_ still has ScriptPro available for download (link to download is at the bottom of EULA). Quote
sanrajbhar Posted April 3, 2012 Posted April 3, 2012 :)I am using same concept for placing boreholes on co-ordinates. Great Sanrajbhar I have been saying for ages use excel power if you can not program ! Did not know about the & easier than concactenate You can also cut the column, paste to notepad save as a script then run or write a macro to write script file direct. Quote
godofcad Posted April 6, 2012 Posted April 6, 2012 Hi mate Here i am posting codes to import your data to CAD But before u have to prepare a .Prn file to import 1.Open Your Data in excel file select all columns and change width to 20 and save it as "formatted Text(space delimited)(*.prn) file format Codes: (defun c:plt (/ cmh blip snp clay x1 y1 gfl dls dlg cnos dldis dlang dldts qty lt lt1 tlt1 lt2 tlt2 lt3 tlt3 lt4 tlt4 lt5 tlt5 slno lv1 cor ftxt x y east north ) (setq cmh (getvar "cmdecho")) (setq blip (getvar "blipmode")) (setq snp (getvar "osmode")) (setq clay (getvar "clayer")) (setvar "cmdecho" 0) (setvar "osmode" 0) (setvar "blipmode" 0) (setq x1 0) (setq y1 0) ;Main Function........ (setq gfl (getfiled "Select the data file" "d:" "prn" 4)) (if (= gfl nil) (exit) ) (setq dls (open gfl "r")) (setq dlg (read-line dls)) (setq cnos (list (substr dlg 1 20))) (setq dldis (list (atof (substr dlg 21 20)))) (setq dlang (list (atof (substr dlg 41 20)))) (setq dldts (list (substr dlg 61 20))) (setq qty (list (substr dlg 81 10))) (while (/= dlg nil) (setq dlg (read-line dls)) (if (/= dlg nil) (progn (setq cnos (cons (substr dlg 1 20) cnos)) (setq dldis (cons (atof (substr dlg 21 20)) dldis)) (setq dlang (cons (atof (substr dlg 41 20)) dlang)) (setq dldts (cons (substr dlg 61 20) dldts)) (setq qty (cons (substr dlg 81 5) qty)) ) ) ) (setq lt (- (length dldis) 1)) (while (/= lt -1) (setq lt1 (list 'nth)) (setq lt1 (append lt1 (list lt))) (setq lt1 (append lt1 (list 'cnos))) (setq tlt1 (nth lt cnos)) (setq lt2 (list 'nth)) (setq lt2 (append lt2 (list lt))) (setq lt2 (append lt2 (list 'dldis))) (setq tlt2 (nth lt dldis)) (setq lt3 (list 'nth)) (setq lt3 (append lt4 (list lt))) (setq lt3 (append lt4 (list 'dlang))) (setq tlt3 (nth lt dlang)) (setq lt4 (list 'nth)) (setq lt4 (append lt4 (list lt))) (setq lt4 (append lt4 (list 'dldts))) (setq tlt4 (nth lt dldts)) (setq lt5 (list 'nth)) (setq lt5 (append lt4 (list lt))) (setq lt5 (append lt4 (list 'qty))) (setq tlt5 (nth lt qty)) (setq slno (atoi tlt1)) (setq lvl (atof tlt4)) (setq lv1 (rtos lvl 2 3)) (setq cor (list tlt2 tlt3)) ;for points (setq ftxt (- tlt3 1)) (setq ftxt (list tlt2 ftxt)) (setq xx (car cor)) (setq yy (cadr cor)) (setq east (strcat "Easting = " (rtos xx 2 3))) (setq north (strcat "Northing = " (rtos yy 2 3))) (setq ssno1 (car cor)) (setq ssno2 (cadr cor)) (setq ssno3 (+ ssno2 0.7)) (setq ssno4 (list ssno1 ssno3)) (setq elev1 (car cor)) (setq elev2 (cadr cor)) (setq elev3 (- elev2 0.7)) (setq elev4 (list elev1 elev3)) (setq co1 (car cor)) (setq co2 (cadr cor)) (setq co3 (- co2 1.5)) (setq co4 (list co1 co3)) ;;Place Elevation ,Codes And Serial No Text (command "layer" "make" "Points" "c" "4" "" "") (command "point" cor) (command "layer" "make" "Sl.No" "c" "1" "" "") (command "Text" "j" "mc" ssno4 "0.5" "0" slno) (command "layer" "make" "Remarks" "c" "6" "" "") (command "text" "j" "mc" elev4 "0.5" "0" tlt5) (command "layer" "make" "Elevation" "c" "2" "" "") (command "text" "j" "mc" cor "0.5" "0" lv1) (command "layer" "make" "Circle" "c" "3" "" "") (command "Circle" cor "d" "1.5") (setq lt (1- lt)) (setvar "cmdecho" cmh) (setvar "osmode" snp) (setvar "clayer" clay) ) (command "ZOOM" "E") (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.