+ Reply to Thread
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 31
  1. #11
    Full Member
    Using
    AutoCAD 2012
    Join Date
    Jul 2009
    Location
    Poughkeepsie, NY
    Posts
    36

    Default

    Registered forum members do not see this ad.

    Try this..

    Code:
    (defun spline-to-pline (/ i)
      (vl-load-com)
      (setq *thisdrawing* (vla-get-activedocument
       (vlax-get-acad-object)
            ) ;_ end of vla-get-activedocument
     *modelspace*  (vla-get-ModelSpace *thisdrawing*)
      ) ;_ end of setq
      (setq spline-list (get-spline))
      (setq i (- 1))
      (if spline-list
        (progn
          (setq msg "\nNumber of segments <100>: ")
          (initget 6)
          (setq num (getint msg))
          (if (or (= num 100) (= num nil))
     (setq num 100)
          ) ;_ end of if
          (repeat (length spline-list)
     (setq splobj (nth (setq i (1+ i)) spline-list))
     (convert-spline splobj num)
          ) ;_ end of repeat
        ) ;_ end of progn
      ) ;_ end of if
    ) ;_ end of spline-to-pline
    (defun get-spline (/ spl-list obj spline no-ent i)
      (setq spl-list nil
     obj  nil
     spline  "AcDbSpline"
     selsets  (vla-get-selectionsets *thisdrawing*)
     ss1  (vlax-make-variant "ss1")
      ) ;_ end of setq
      (if (= (vla-get-count selsets) 0)
        (setq ssobj (vla-add selsets ss1))
      ) ;_ end of if
      (vla-clear ssobj)
      (setq no-ent 1)
      (while no-ent
        (prompt "\nSelect splines: ")
        (vla-Selectonscreen ssobj)
        (if (> (vla-get-count ssobj) 0)
          (progn
     (setq no-ent nil)
     (setq i (- 1))
     (repeat (vla-get-count ssobj)
       (setq
         obj (vla-item ssobj
         (vlax-make-variant (setq i (1+ i)))
      ) ;_ end of vla-item
       ) ;_ end of setq
       (cond
         ((= (vlax-get-property obj "ObjectName") spline)
          (setq spl-list
          (append spl-list (list obj))
          ) ;_ end of setq
         )
       ) ;_ end-of cond
     ) ;_ end of repeat
          ) ;_ end of progn
          (prompt "\nNo entities selected, try again.")
        ) ;_ end of if
        (if (and (= nil no-ent) (= nil spl-list))
          (progn
     (setq no-ent 1)
     (prompt "\nNo splines selected.")
     (quit)
          ) ;_ end of progn
        ) ;_ end of if
      ) ;_ end of while  
      (vla-delete (vla-item selsets 0))
      spl-list
    ) ;_ end of get-spline
    (defun convert-spline (splobj n / i)
      (setq point-list   nil
     2Dpoint-list nil
     z-list      nil
     spl-lyr      (vlax-get-property splobj 'Layer)
     startSpline  (vlax-curve-getStartParam splobj)
     endSpline    (vlax-curve-getEndParam splobj)
     i      (- 1)
      ) ;_ end of setq
      (repeat (+ n 1)
        (setq i (1+ i))
        (setq p (vlax-curve-getPointAtParam
           splobj
           (* i
       (/ (- endspline startspline) n)
           ) ;_ end of *
         ) ;_ end of vlax-curve-getPointAtParam
        ) ;_ end of setq
        (setq 2Dp        (list (car p) (cadr p))
       2Dpoint-list (append 2Dpoint-list 2Dp)
       point-list   (append point-list p)
       z        (caddr p)
       z-list       (append z-list (list z))
        ) ;_ end of setq
      ) ;_ end of repeat
      (setq summ (apply '+ z-list))
      (setq arraySpace
      (vlax-make-safearray
        vlax-vbdouble ; element type
        (cons 0
       (- (length point-list) 1)
        ) ; array dimension
      ) ;_ end of vlax-make-safearray
      ) ;_ end of setq
      (setq vert-array (vlax-safearray-fill arraySpace point-list))
      (vlax-make-variant vert-array)
      (if (and (= :vlax-true (vlax-get-property splobj 'IsPLanar))
        (= summ 0.0)
          ) ;_ end of and
        (setq plobj (add-polyline
        2Dpoint-list
        vla-AddLightweightPolyline
      ) ;_ end of add-polyline
        ) ;_ end of setq
        (setq plobj (add-polyline
        point-list
        vla-Add3DPoly
      ) ;_ end of add-polyline
        ) ;_ end of setq
      ) ;_ end of if
      (vlax-put-property plobj 'Layer spl-lyr)
      (vla-delete splobj)
      (vlax-release-object splobj)
    ) ;_ end of convert-spline
    (defun add-polyline (pt-list poly-func)
      (setq arraySpace
      (vlax-make-safearray
        vlax-vbdouble
        (cons 0
       (- (length pt-list) 1)
        ) ; array dimension
      ) ;_ end of vlax-make-safearray
      ) ;_ end of setq
      (setq vertex-array
      (vlax-safearray-fill arraySpace pt-list)
      ) ;_ end of setq
      (vlax-make-variant vertex-array)
      (setq plobj (poly-func
      *modelspace*
      vertex-array
           ) ;_ end of poly-func
      ) ;_ end of setq
    ) ;_ end of add-polyline
    (defun c:s2p ()
      (spline-to-pline)
      (princ)
    ) ;_ end of c:s2p
    (prompt
      "SPLINE-TO-PLINE by Tony Hotchkiss. Enter S2P to start"
    ) ;_ end of prompt
    Last edited by SLW210; 7th Dec 2012 at 08:38 pm. Reason: Add Code Tags!

  2. #12
    Forum Newbie
    Computer Details
    McWaters12's Computer Details
    Operating System:
    Windows XP SP 3
    Computer:
    Toshiba Satellite
    CPU:
    1.86 Ghz
    RAM:
    2 GB
    Primary Storage:
    80GB
    Secondary Storage:
    500 GB
    Using
    AutoCAD 2011
    Join Date
    Jan 2011
    Location
    Auburn, AL
    Posts
    6

    Default

    When I try to convert a 2d polyline to a regular polyline, it then asks me to choose between options like 'open' 'fit' 'close'. I'm not really sure which one to choose. I have been choosing 'open' but then it's like i have to choose it thousands of times. I don't know what is going on.

  3. #13
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,819

    Default

    To get out of the pedit you should hit enter or escape.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  4. #14
    Forum Newbie
    Using
    Land Desktop 2009
    Join Date
    Dec 2012
    Posts
    4

    Default

    Try using overkill. It worked for me. I learned it from a good friend, a legend in the CAD industry that goes by the name candymountain.

  5. #15
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,495

    Default

    shrimp: You're suggesting the use of Overkill to obtain what end result?
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  6. #16
    Forum Newbie
    Using
    Land Desktop 2009
    Join Date
    Dec 2012
    Posts
    4

    Default

    It will convert 2d polylines to polylines

  7. #17
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,495

    Default

    Well let's hope the OP did not wait until June 2008 for an answer. But it will prove useful to others with the same question.

    You're in the running for today's prize for the person that resurrects the oldest thread. 4 years 6 months. LoL
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  8. #18
    Forum Newbie
    Using
    Land Desktop 2009
    Join Date
    Dec 2012
    Posts
    4

    Default

    Haha, yeah I know its old as hell but I did a search on google and couldnt find any answers on it so when I found this thread I joined today to make sure the answer is out there for anyone who may need it in the future.

  9. #19
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,819

    Default

    Quote Originally Posted by shrimpbiscuits View Post
    It will convert 2d polylines to polylines
    OVERKILL doesn't work here to convert 2D Polyline to Polyline.

    CONVERTPOLY works just fine as does PEDIT.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  10. #20
    Forum Newbie
    Using
    Land Desktop 2009
    Join Date
    Dec 2012
    Posts
    4

    Default

    Registered forum members do not see this ad.

    Neither one of those worked for me for converting from 2d to a regular poly but overkill did just what I needed for some reason.

Similar Threads

  1. convert Spline to Polyline
    By Beadin Sabovic in forum AutoCAD 3D Modelling & Rendering
    Replies: 11
    Last Post: 26th Jun 2013, 04:39 pm
  2. Convert Spline to polyline?
    By MikeP in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 1
    Last Post: 12th May 2008, 05:06 pm
  3. Convert a spline to polyline
    By JaketheMan in forum AutoCAD General
    Replies: 1
    Last Post: 7th Aug 2007, 02:00 pm
  4. How do I convert an line to a polyline ?
    By nurquhar in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 17th Sep 2005, 02:38 pm
  5. Convert Arc to Polyline
    By cyberfreak in forum AutoCAD Drawing Management & Output
    Replies: 8
    Last Post: 11th May 2005, 11:15 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts