Bert F Posted July 23, 2010 Share Posted July 23, 2010 Hello, I'm busy with manipulating data in matlab, just 2D data rectangles now after a while I do like to import this data and view this in autocad R14. Because matlab is a programming environment I can get the data in every form in a text file or excel or whatsoever but who can I display this in autocad R14? Thereafter of course I like to do some manipulations in autocad store him back to a same file and read it in matlab. Thanks a lot. Quote Link to comment Share on other sites More sharing options...
SanganakSakha Posted July 26, 2010 Share Posted July 26, 2010 Reading data from a text file, using VB(A) and hence VLisp - is a standard process. Interacting with applications like Excel is also a standard process. Since I do not have r14, I can't tell the exact location, but explore the VBA help and you will get the solution you need. Quote Link to comment Share on other sites More sharing options...
fuccaro Posted July 27, 2010 Share Posted July 27, 2010 Welcome in the forum, Bert F! How are the rectangles defined? Do you have the coordinates of the corners? Can you export them in a text file? Post a sample -a few lines from such a text file - and for sure someone will write a Lisp for you. When you say R14, you mean AutoCAD R14, and not AutoCAD R14 LT, right? LT can't handle Lisp, nor VBA Quote Link to comment Share on other sites More sharing options...
Bert F Posted July 27, 2010 Author Share Posted July 27, 2010 Thanks for all answers. When you say R14, you mean AutoCAD R14, and not AutoCAD R14 LT, right? LT can't handle Lisp, nor VBA Yep I mean the full AutoCAD R14 not the lt version. I have also try to use some stuff from the internet, written in lisp and this work in my version of AutoCAD R14 only it didn’t do what I need. How are the rectangles defined? Do you have the coordinates of the corners? I ‘m work most time in matlab, this is a matrix lab so there I can define a rectangle as an array of 6 elements rec1=[-1 -2 0 1 2 0 ] Where I mean that the first x coordinates is equal to -1 the y to 2 and the z are always equal to 0 the second x=1 y=2 z=0 Then I can do a dump of this variable and can get the folloing in a txt file: -1.0000000e+000 -2.0000000e+000 0.0000000e+000 -1.0000000e+000 -2.0000000e+000 0.0000000e+000 Now I just want to draw a rectangle with this coordinates? Quote Link to comment Share on other sites More sharing options...
fuccaro Posted July 28, 2010 Share Posted July 28, 2010 A quick and somehow dirty routine: (defun c:x1( / fn f line osmode nr f1 f2) (setq fn (getfiled "Select input file" "" "txt" 0)) (setq f (open fn "r") line t) (setq line (read-line f)) (setq osmode (getvar "osmode")) (setvar "osmode" 0) (while line (setq f1 1 f2 1 nr nil) (repeat 5 (while (not (= " " (substr line f2 1))) (setq f2 (1+ f2))) (setq nr (append nr (list (read (substr line f1 f2))))) (setq f1 (1+ f2) f2 f1) ) (command "rectangle" (list (car nr) (cadr nr)) (list (nth 3 nr) (nth 4 nr))) (setq line (read-line f)) ) (close f) (setvar "osmode" osmode) ) Quote Link to comment Share on other sites More sharing options...
Bert F Posted July 28, 2010 Author Share Posted July 28, 2010 Thanks a lot I going to try it. Quote Link to comment Share on other sites More sharing options...
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.