vnk172004 Posted August 6, 2009 Posted August 6, 2009 hello everybody i got the attached lisp file from somewhere. the purpose of this file is it will extract x,y coordinates from the polyline and will export to a notepad file. can anyone modify this file so that it has to export Z coordinate also from a 3d polyline? PLATE.txt Quote
tagkelas Posted August 6, 2009 Posted August 6, 2009 http://www.cadtutor.net/forum/showpost.php?p=257242&postcount=9 This works well with polylines... Quote
Lee Mac Posted August 6, 2009 Posted August 6, 2009 Thanks for the plug tagkelas That LISP will also add a point to each vertex of the polyline/lwpolyline, but that can be easily taken out. Lee Quote
David Bethel Posted August 6, 2009 Posted August 6, 2009 Since a 3D PLINE can only be the old style heavy POLYLINE, maybe something like this for a single entity: [b][color=BLACK]([/color][/b]defun c:ex3dpl [b][color=FUCHSIA]([/color][/b]/ odz ss wf en vn vp[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq odz [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"DIMZIN"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setvar [color=#2f4f4f]"DIMZIN"[/color] 8[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]or [b][color=MAROON]([/color][/b]not ss[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]> [b][color=GREEN]([/color][/b]sslength ss[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect 3D Polyline To Export..."[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"POLYLINE"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]-4 . [color=#2f4f4f]"<OR"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]70 . 8[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]70 . 9[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]-4 . [color=#2f4f4f]"OR>"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq wf [b][color=NAVY]([/color][/b]open [color=#2f4f4f]"point.txt"[/color] [color=#2f4f4f]"w"[/color][b][color=NAVY])[/color][/b] en [b][color=NAVY]([/color][/b]ssname ss 0[b][color=NAVY])[/color][/b] vn [b][color=NAVY]([/color][/b]entnext en[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]/= [color=#2f4f4f]"SEQEND"[/color] [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 0 [b][color=BLUE]([/color][/b]entget vn[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq vp [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 10 [b][color=BLUE]([/color][/b]entget vn[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]write-line [b][color=MAROON]([/color][/b]strcat [b][color=GREEN]([/color][/b]rtos [b][color=BLUE]([/color][/b]car vp[b][color=BLUE])[/color][/b] 2 15[b][color=GREEN])[/color][/b] [color=#2f4f4f]","[/color] [b][color=GREEN]([/color][/b]rtos [b][color=BLUE]([/color][/b]cadr vp[b][color=BLUE])[/color][/b] 2 15[b][color=GREEN])[/color][/b] [color=#2f4f4f]","[/color] [b][color=GREEN]([/color][/b]rtos [b][color=BLUE]([/color][/b]caddr vp[b][color=BLUE])[/color][/b] 2 15[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] wf[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq vn [b][color=MAROON]([/color][/b]entnext vn[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]close wf[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setvar [color=#2f4f4f]"DIMZIN"[/color] odz[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] -David Quote
rkmcswain Posted October 9, 2009 Posted October 9, 2009 Since a 3D PLINE can only be the old style heavy POLYLINE, maybe something like this for a single entity: (setq ss (ssget '((0 . "POLYLINE") (-4 . " (70 . 8) (70 . 9) (-4 . "OR>"))))) You *could* miss some 3d polylines doing it that way... Safer to do this... (ssget '((0 . "POLYLINE")(-4 . "&")(70 . )) Quote
David Bethel Posted October 9, 2009 Posted October 9, 2009 Yes, you could miss a Spline curved but then it would export the control points which wouldn't be of much use to most users. But then anything is possible -David Quote
gile Posted October 10, 2009 Posted October 10, 2009 You could miss the the 3d polylines which line type generation is on too (128 bit code). Here's another way to get the vertices WCS coordinates list of any polyline type. ;;; Poly-Pts (gile) ;;; Returns the vertices WCS coordinates list of a polyline (all types) ;;; ;;; Argument ;;; pl : the polyline (ename or vla-object) (defun poly-pts (pl / n p l) (vl-load-com) (setq n (fix (vlax-curve-getEndParam pl))) (or (vlax-curve-IsClosed pl) (setq n (1+ n))) (while (setq p (vlax-curve-getPointAtParam pl (setq n (1- n)))) (setq l (cons p l)) ) ) Quote
rkmcswain Posted October 12, 2009 Posted October 12, 2009 You could miss the the 3d polylines which line type generation is on too (128 bit code).I don't believe that the 128 bit and the 8 bit can be set together (at least by AutoCAD), since 3D polylines do not display linetypes. Neither PEDIT or PROPS give you the option of turning on this flag, and even if PLINEGEN is set to 1, a newly constructed 3d polyline does not include the 128 bit. 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.