meracl Posted January 31, 2013 Posted January 31, 2013 Im sorry for replying instead of Lee Mac. I don't even know if that's ok. Just change (rtos (car x) 2 2) (chr 44) (rtos (cadr x) 2 2) (chr 44) (rtos (caddr x) 2 2)) file) to (rtos (car x) 2 [color=#ff0000]3[/color]) (chr 44) (rtos (cadr x) 2 [color=#ff0000]3[/color]) (chr 44) (rtos (caddr x) 2 [color=#ff0000]3[/color])) file) Quote
woodman78 Posted January 31, 2013 Posted January 31, 2013 meracl, I tried that earlier today and it didn't seem to work. It looked like it changed the units instead. I'll try again in the morning. Quote
woodman78 Posted January 31, 2013 Posted January 31, 2013 Is it something to do with LeeMac's solution here: http://www.cadtutor.net/forum/showthread.php?76830-Get-coords-of-extents-of-viewport-in-Model-Space Quote
neophoible Posted January 31, 2013 Posted January 31, 2013 meracl, I tried that earlier today and it didn't seem to work. It looked like it changed the units instead. I'll try again in the morning. Yes, meracl did it correctly. Make sure you change only the 2nd 2 to a 3 in each rtos. Changing the first one will indeed change the units! Quote
neophoible Posted January 31, 2013 Posted January 31, 2013 In Civil 3D there's built in functionality that allows you to transform data from one coordinate system into another. But it looks as if Jozi only has vanilla AutoCAD According to the post & info, Jozi68 has Civil-3D. Are you suggesting it will do a batch of points rather than just one by one? If so, post the method! Quote
meracl Posted January 31, 2013 Posted January 31, 2013 As Lee Mac pointed out there (setq p (mapcar '(lambda ( x ) (rtos x 2 0)) (trans (trans x 3 2) 2 0))) 2 is the units 0 is the precision (0 decimal places) So most probably by mistake you changed the first number and not the second!! Please try it again! Quote
woodman78 Posted February 1, 2013 Posted February 1, 2013 Meracl, I tried that but it didn't change the places of decimal. There are still only 2 places of decimal in the csv file. Quote
Lee Mac Posted February 1, 2013 Posted February 1, 2013 Ensure DIMZIN is set to zero (include trailing zeros). Quote
woodman78 Posted February 1, 2013 Posted February 1, 2013 Thanks LeeMac but only set the Z to 3 decimal places. The E & N are still at 2. This is the code I am using now. ;; Polyline Point Exported, by Lee McDonnell 26.07.2009 (defun c:ptExp (/ doc spc ss file sel pts) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (and (setq ss (ssget '((0 . "*POLYLINE")))) (setq file (getfiled "Output File" (if *load *load "") "csv;txt" 9))) (progn (setq *load file file (open file "a")) (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc)) (setq pts (vlax-list->3D-point (vlax-get Obj 'Coordinates) (cond ((eq (vla-get-ObjectName Obj) "AcDbPolyline"))) Obj)) (mapcar (function (lambda (x) (write-line (strcat (rtos (car x) 2 3) (chr 44) (rtos (cadr x) 2 3) (chr 44) (rtos (caddr x) 2 3)) file) (vla-addPoint spc (vlax-3D-point x)))) pts)) (princ (strcat "\n<< Points from " (itoa (vla-get-Count sel)) " Polylines written to file >>")) (close file) (vla-delete sel))) (princ)) (defun vlax-list->3D-point (lst x Obj / oLst) (while lst (setq oLst (cons (list (car lst) (cadr lst) (if x (vla-get-Elevation Obj) (caddr lst))) oLst) lst ((if x cddr cdddr) lst))) oLst) Quote
Lee Mac Posted February 1, 2013 Posted February 1, 2013 That is old and terrible code, try this instead: ([color=BLUE]defun[/color] c:ptexp ( [color=BLUE]/[/color] a e f i l r s z ) ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] '((0 . [color=MAROON]"*POLYLINE"[/color])))) ([color=BLUE]setq[/color] f ([color=BLUE]getfiled[/color] [color=MAROON]"Output File"[/color] [color=MAROON]""[/color] [color=MAROON]"csv;txt"[/color] 33)) ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] f ([color=BLUE]open[/color] f [color=MAROON]"a"[/color])) ([color=BLUE]progn[/color] ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s)) ([color=BLUE]setq[/color] e ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))) l ([color=BLUE]entget[/color] e) r [color=BLUE]nil[/color] ) ([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=MAROON]"LWPOLYLINE"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 l))) ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] z ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 38 l))) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] a ([color=BLUE]assoc[/color] 10 l)) ([color=BLUE]setq[/color] r ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]cadr[/color] a) ([color=BLUE]caddr[/color] a) z) r) l ([color=BLUE]cdr[/color] ([color=BLUE]member[/color] a l)) ) ) ) ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] e ([color=BLUE]entnext[/color] e) l ([color=BLUE]entget[/color] e) ) ([color=BLUE]while[/color] ([color=BLUE]=[/color] [color=MAROON]"VERTEX"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 l))) ([color=BLUE]setq[/color] r ([color=BLUE]cons[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 l)) r) e ([color=BLUE]entnext[/color] e) l ([color=BLUE]entget[/color] e) ) ) ) ) ([color=BLUE]foreach[/color] p ([color=BLUE]reverse[/color] r) ([color=BLUE]write-line[/color] ([color=BLUE]strcat[/color] ([color=BLUE]rtos[/color] ([color=BLUE]car[/color] p) 2 3) [color=MAROON]","[/color] ([color=BLUE]rtos[/color] ([color=BLUE]cadr[/color] p) 2 3) [color=MAROON]","[/color] ([color=BLUE]rtos[/color] ([color=BLUE]caddr[/color] p) 2 3) ) f ) ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"POINT"[/color]) ([color=BLUE]cons[/color] 10 p))) ) ) ([color=BLUE]close[/color] f) ) ([color=BLUE]princ[/color] [color=MAROON]"\nUnable to create or open output file."[/color]) ) ) ([color=BLUE]princ[/color]) ) 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.