SolarPVDesigner Posted May 10, 2012 Share Posted May 10, 2012 (edited) (defun c:vlplexport (/ AT:GetVertices strnum theobj fn) (defun AT:GetVertices (e / p l) ;; Return point at each vertex of curve ;; e - curve to evaluate (Arc, Line, *Polyline, Spline) ;; Alan J. Thompson, 09.30.10 (if e (if (eq (setq p (vlax-curve-getEndParam e)) (fix p)) (repeat (setq p (1+ (fix p))) (setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l)) ) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e)) ) ) ) (defun strnum (str val / p) (setq p " ") (repeat (- val (strlen str)) (setq p (strcat " " p))) (strcat str p)) (vl-mkdir "c:/autolisp") (prompt "\nSelect a Polyline: ") (while (setq theobj (ssget ":S:E" '((0 . "*LINE")))) (setq thelist (AT:GetVertices (setq e (ssname theobj 0)))) (setq fn (open "c:/autolisp/infile.txt" "w")) (redraw e 3) (foreach itm thelist (write-line (strcat " at point X =" (strnum (rtos (Car itm) 2 4) 10) "Y= " (strnum (rtos (Cadr itm) 2 4) 10) "Z= " (strnum (rtos (last itm) 2 4) 10)) fn) ) (close fn) )(vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport) (princ) ) Edited May 10, 2012 by SolarPVDesigner Quote Link to comment Share on other sites More sharing options...
SolarPVDesigner Posted May 10, 2012 Share Posted May 10, 2012 (edited) Where would the following code be incorporated into the code above? (setq _trans (lambda (pt) (trans pt 0 1))) (setq ss (AT:GetVertices (car (entsel)))) (setq pts (mapcar '_trans ss));<-- translated point list Once I see it done I can grasp it and then look out world!! Thanks pBe and Lee Mac Thanks, Edited May 10, 2012 by SolarPVDesigner Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 10, 2012 Share Posted May 10, 2012 SolarPVDesigner, Have a read of the Code Posting Guidlines for information on how to format code in your posts. Also, looking at the code you have posted, are you aware that this will overwrite the export file for each Polyline selected? Is this your intention? Lee Quote Link to comment Share on other sites More sharing options...
SolarPVDesigner Posted May 10, 2012 Share Posted May 10, 2012 Lee Mac, I will follow the Guidelines from here on out. And Yes I want to overwrite the export file. John Quote Link to comment Share on other sites More sharing options...
pBe Posted May 10, 2012 Share Posted May 10, 2012 (setq fn (open "c:/autolisp/infile.txt" "w")) and (close fn); Quote Link to comment Share on other sites More sharing options...
pBe Posted May 11, 2012 Share Posted May 11, 2012 Where would the following code be incorporated into the code above? Once I see it done I can grasp it and then look out world!! Thanks pBe and Lee Mac Thanks, (setq thelist [color=blue][b](mapcar (function (lambda ( j) (trans j 0 e))) [/b][/color] (AT:GetVertices (setq e (ssname theobj 0))) [color=blue][b]) [/b][/color] ) HTH Quote Link to comment Share on other sites More sharing options...
saunambon654 Posted February 21, 2023 Share Posted February 21, 2023 After export Polylines to file, could I import that file to other drawing with nothing change (include Spline or Arc segments, Layer, color...)? It is like Copy and Paste to Original Coordinates, but instead open DWG file and copy, I can choose that TXT file. Thank you. Quote Link to comment Share on other sites More sharing options...
devitg Posted February 21, 2023 Share Posted February 21, 2023 13 hours ago, saunambon654 said: After export Polylines to file, could I import that file to other drawing with nothing change (include Spline or Arc segments, Layer, color...)? It is like Copy and Paste to Original Coordinates, but instead open DWG file and copy, I can choose that TXT file. Thank you. As to not dig at all the topic , would you please, upload all dwg, lsp , and text or csv files? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 21, 2023 Share Posted February 21, 2023 Using Wblock much easier way to approach this request, all dwg object properties are maintained. 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.