NEXTMARCUS Posted January 4, 2013 Share Posted January 4, 2013 Hi everyone, I'm loking for a code to import a serie of points in the xyz axis to a dwg file, i used the Lee Mac's program PtManagerV2-4 and it has solved my problem in part , each point in the .csv file has an information , this information should apear in autocad as a text close to the point it was linked in excel. can anyone help me? Thanks everyone! follows format below of the .csv file 2.7149,4.5177,0, point 1 5.6981,5.1197,0, point 2 5.9822,7.6342,0, point 3 6.8346,3.5969,0, point 4 9.2496,4.2698,0, point 5 9.5337,6.9613,0, point 6 11.8777,6.4655,0,point 7 Sorry about my very bad english Quote Link to comment Share on other sites More sharing options...
ReMark Posted January 4, 2013 Share Posted January 4, 2013 Lee Mac's Point Manager might work. Click on link below. http://www.lee-mac.com/ptmanager.html Quote Link to comment Share on other sites More sharing options...
NEXTMARCUS Posted January 4, 2013 Author Share Posted January 4, 2013 Thanks for de reply, but this program writes only the points in the .dwg file not the text close to the point. am i right? Or i'am doing something wrong? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 Can you upload a sample drawing shows the point with its information besides the height of the text ? Quote Link to comment Share on other sites More sharing options...
NEXTMARCUS Posted January 4, 2013 Author Share Posted January 4, 2013 Yes i'll upload an example, i think this information could apear as a tag within the point's attibute. the origin of the text can coincide with the point. Testatt.dwg Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 4, 2013 Share Posted January 4, 2013 If you create an attributed block for your point, you can use my existing Point Manager program to import the attributed block and populate the block attribute value with the data that follows the point coordinates. Quote Link to comment Share on other sites More sharing options...
NEXTMARCUS Posted January 4, 2013 Author Share Posted January 4, 2013 Tanks Lee ill try this solution. Quote Link to comment Share on other sites More sharing options...
NEXTMARCUS Posted January 4, 2013 Author Share Posted January 4, 2013 But in this case should i create an attribute block for each point that i've imported using the point manager? Thanks for the reply. Quote Link to comment Share on other sites More sharing options...
ReMark Posted January 4, 2013 Share Posted January 4, 2013 I believe all you need is one attributed block. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 Try this routine and let me know how it goes .... (defun c:Test (/ Deconstruct_String _att file st p pt) ;;; Tharwat 04. 01 2013 ;;; (defun Deconstruct_String (st delimiter / p l) (while (setq p (vl-string-search delimiter st 0)) (setq l (cons (substr st 1 p) l) st (substr st (+ p 2) (strlen st)) ) ) (if st (setq l (cons st l)) ) (setq l (reverse l)) ) (defun _att (pt string) (entmakex (list '(0 . "ATTDEF") (cons 10 pt) '(40 . 0.2) '(1 . "Pt") (cons 2 string) '(3 . "point") '(70 . 0) ) ) ) (if (setq file (getfiled "Select Excel file ..." "" "csv" 16)) (progn (setq file (open file "r")) (while (setq st (read-line file)) (setq st (Deconstruct_String st ";")) (setq p (Deconstruct_String (car st) ",")) (_att (setq pt (list (read (car p)) (read (cadr p)) (read (caddr p))) ) (vl-list->string (vl-remove 32 (vl-string->list (last st)))) ) (entmakex (list '(0 . "POINT") (cons 10 pt))) ) (close file) ) (princ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 4, 2013 Share Posted January 4, 2013 But in this case should i create an attribute block for each point that i've imported using the point manager? I believe all you need is one attributed block. Correct, only one attributed block is required; this block may be defined in the active drawing or in an external drawing file. Quote Link to comment Share on other sites More sharing options...
NEXTMARCUS Posted January 4, 2013 Author Share Posted January 4, 2013 Tharwat, thanks a lot , it was just what i was looking for. the program worked very well ! Thanks for all who helped me . Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 Tharwat, thanks a lot , it was just what i was looking for. the program worked very well ! Thanks for all who helped me . You're very welcome . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 4, 2013 Share Posted January 4, 2013 Tharwat, it was just what i was looking for. Creating ATTDEFs at every location? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 Creating ATTDEFs at every location? That was according to the sample attached drawing . Quote Link to comment Share on other sites More sharing options...
ReMark Posted January 4, 2013 Share Posted January 4, 2013 Is that an efficient way of doing it? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 Is that an efficient way of doing it? For me , I did the routine according to the sample drawing that I asked the OP to upload and I wrote the code as it's been all requested from them . nothing's more . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 4, 2013 Share Posted January 4, 2013 That was according to the sample attached drawing . I just can't see why anyone would want ATTDEFs at every imported point in a drawing - it seems to me as though the OP doesn't understand attributed blocks too well. Quote Link to comment Share on other sites More sharing options...
ReMark Posted January 4, 2013 Share Posted January 4, 2013 I too question the reasoning behind the OP's approach and not the programming provided by Tharwat. Sorry for any confusion. No offense was meant. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 4, 2013 Share Posted January 4, 2013 I am entirely agree with that , but I am also sometimes receive drawings from contractors that contain lots of ATTDEFs instead of TEXTs and I can't see one reason that encourage people to use ATTDEFs in place of TEXTs other than ATTDEFs don't accept spaces and nothing's more than that . - STILL A GUESS . 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.