Nad SK Posted December 28, 2010 Share Posted December 28, 2010 Dear all. I have a problem: I need to import the coordinate of many text on the screen to the file (.txt fomart) like this: text content; x coordinate; y coordinate Thank for all. Quote Link to comment Share on other sites More sharing options...
pBe Posted December 28, 2010 Share Posted December 28, 2010 export you mean? Are the X and Y corrdinate from a text string and not a point or object on the screen? There's a lot of codes for similar to that on this forum, I suggest you utilize the search button first, i'm pretty sure you'll find one that suit your needs. Otherwise, post a sample dwg or image, and if possible, provide more information TRY THIS THREAD http://www.cadtutor.net/forum/showthread.php?42954-Point-Manager&highlight=EXPORT+COORDINATE Quote Link to comment Share on other sites More sharing options...
fuccaro Posted December 28, 2010 Share Posted December 28, 2010 This old Lisp does almost that. Change the code to suit your needs: (defun c:tex2file() (setq dwg (getvar "dwgname") nam (substr dwg 1 (- (strlen dwg) 3)) nam (strcat (getvar "dwgprefix") nam "tXt") f (open nam "w") sep ",") (setq ss (ssget "X" '((0 . "TEXT")))) (repeat (setq i (sslength ss)) (setq el (entget (ssname ss (setq i (1- i)))) str (strcat (cdr (assoc 1 el)) sep (rtos (cadr (assoc 10 el))) sep (rtos (caddr (assoc 10 el))))) (print str f) ) (close f) (strcat " " nam " Saved") ) Quote Link to comment Share on other sites More sharing options...
BearDyugin Posted December 28, 2010 Share Posted December 28, 2010 Look and my program Export coordinates (both Geodetic and Mathematical) But there will be a format: text content; x coordinate; y coordinate; z coordinate Quote Link to comment Share on other sites More sharing options...
Nad SK Posted December 28, 2010 Author Share Posted December 28, 2010 (edited) Thank for all. @pBe: Export the coodinate. Right. Thanks. The link for point only, not for text. @fuccaro: It's nearly perfect. It select all the text in the drawing. @Geobuilder: Thanks. It's goodddddddddddddddddd. Edited December 28, 2010 by Nad SK Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 28, 2010 Share Posted December 28, 2010 Another: http://lee-mac.com/ptmanager.html Quote Link to comment Share on other sites More sharing options...
BearDyugin Posted December 29, 2010 Share Posted December 29, 2010 TRY THIS THREAD http://www.cadtutor.net/forum/showthread.php?42954-Point-Manager&highlight=EXPORT+COORDINATE ie Link to your same Point Manager @pBe: The link for point only, not for text. To be honest, not only points, but also blocks and polylines But there is no text exportAnother: http://lee-mac.com/ptmanager.html Quote Link to comment Share on other sites More sharing options...
pBe Posted December 29, 2010 Share Posted December 29, 2010 @pBe: Export the coodinate. Right. Thanks. The link for point only, not for text. A point on the screen? or POINT the object entity? anyway..... What about a simple one like this: (defun c:testme (/ cdwg cms cutl pt_nm pt_ds pt_fn fso file ptw pn-vl wtxt ptwo) (vl-load-com) (setq cdwg (vla-get-activedocument (vlax-get-acad-object)) cms (vla-get-modelspace cdwg) cutl (vla-get-utility cdwg) ) (setq pt_nm (vla-getinteger cutl "\nEnter Point Number: ") pt_ds (strcase (vla-GetString cutl 1 "\nEnter Description Number: ")) pt_fn (strcat (vla-get-path cdwg) "\\" (vla-GetString cutl 1 "\nEnter File Name: ") ".txt") fso (vlax-create-object "Scripting.FileSystemObject") file (vlax-invoke-method fso 'CreateTextFile pt_fn 8 :vlax-true ) ) (while (not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda () (setq ptw (vla-getpoint cutl ptwo "\nPick Coordinate point: ")) )))) ) (setq pn-vl (vlax-safearray->list (vlax-variant-value ptw)) wtxt (strcat (itoa pt_nm) "," pt_ds "," (rtos (car pn-vl) 2 3) "," (rtos (cadr pn-vl) 2 3) "," (rtos (caddr pn-vl) 2 3) ) ) (vlax-invoke file 'Writeline wtxt) (setq pt_nm (1+ pt_nm) ptwo ptw ptw nil) );while (vlax-release-object fso) (vlax-invoke file 'close) ) The format would be: Command: testme Enter Point Number: 500 <---- series number Command: Enter Description Number: lot 65 <----- description of area Command: Enter File Name: lot 65 coordinates <------ name of file Command: Pick Coordinate point: Command: Pick Coordinate point: Command: Pick Coordinate point: Command: Pick Coordinate point: Command: Pick Coordinate point: Command: Pick Coordinate point: Command: <<<<< File Path: C:\CAD\Help_others\lot 65 coordinates.txt >>>>> 500,LOT 65,-1512.367,3719.373,0.000 501,LOT 65,-186.069,4384.833,0.000 502,LOT 65,480.002,3731.048,0.000 503,LOT 65,-787.869,2440.990,0.000 504,LOT 65,-1617.536,3497.553,0.000 comma delimited file Series number, Description, Coordinates (X,Y,Z) Had time to play around Quote Link to comment Share on other sites More sharing options...
fuccaro Posted December 30, 2010 Share Posted December 30, 2010 So many ways to skin this cat! 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.