<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 3d Polylines to new 2d Polylines on new layer in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808382#M33489</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Paul, thank you for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to expand on your code with my extremely limited skills :P.&lt;/P&gt;&lt;P&gt;The only problems I have (apart from my very sloppy additions) are:&lt;/P&gt;&lt;P&gt;- I Can't get the new polylines to elevation 0&lt;BR /&gt;- Get error message at end but still works&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:3DP2FLATPLBB ()

(command "-linetype" "load" "*" "E:\\Dropbox\\Dropbox\\ABD\\Linetypes\\STREAMBANK" "" "") ;Have to remove parenthesis if linetype exists in drawing
(command "_.Layer" "_Make" "ABD - A - 2d Bank Bottom" "_Color" "251" "" "LType" "STREAMBANK" "" "LWeight" "0.09" "" "")

; select 3dpoly to get layer
(while(not(setq en (ssget"_+.:E:S"'((0 . "POLYLINE")(100 . "AcDb3dPolyline"))))))
; get layer name
(setq lyr(cdr(assoc 8(entget (ssname en 0)))))
; select all 3dpolylines on matching layer:
(setq ss(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 lyr))))
; make copy selection to same location
(command"_.Copy" ss "" "@" "@") 

(command "_chprop" ss "" "_LA" "ABD - A - 2d Bank Bottom" "")
; I should probably setq this layer :P

; select all 3dpolylines on new layer layer:
(setq nl(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 "ABD - A - 2d Bank Bottom"))))

; now flatten original selection
(command "_.AeccConvert3dPolys" nl "")
; Im using Civil 3d so can use this command, but polylines end up on 1st 3dpoly point elevation


; echo how many plines flattened
(princ(strcat"\nSuccessfully Flattened [" (itoa selected) "] Plines"))
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 21:57:03 GMT</pubDate>
    <dc:creator>As-Built_Sigurd</dc:creator>
    <dc:date>2023-03-08T21:57:03Z</dc:date>
    <item>
      <title>3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806087#M33485</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started to learn autolisp way back, but have forgotten almost everything and want to write a small program.&lt;BR /&gt;&lt;BR /&gt;Basically, I want to select all 3d polylines which are on the same layer as the one I&amp;nbsp; select, copy them all to the same position on a new layer (to be created if it doesn't exist). Then the new 3d polylines on the new layer are to be exploded &amp;amp; flattened, then joined to make them 2d polylines.&lt;BR /&gt;&lt;BR /&gt;Is this something I could get to fairly quickly? I have access to fairly basic .lisp functions I could get ideas from.&lt;!-- /data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_230308_163342_345.sdocx --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sigurd&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 03:35:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806087#M33485</guid>
      <dc:creator>As-Built_Sigurd</dc:creator>
      <dc:date>2023-03-08T03:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806247#M33486</link>
      <description>&lt;P&gt;start you off with this...see if you can figure out how to place the flattened plines into a new layer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; select 3dpoly to get layer
(while(not(setq en (ssget"_+.:E:S"'((0 . "POLYLINE")(100 . "AcDb3dPolyline"))))))
; get layer name
(setq lyr(cdr(assoc 8(entget (ssname en 0)))))
; select all 3dpolylines on matching layer:
(setq ss(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 lyr))))
; make copy selection to same location
(command"_.Copy" ss "" "@" "@") 
; now flatten original selection
(setq selected (sslength ss)) ; get total number of selected objects
(setq ss (mapcar 'vlax-ename-&amp;gt;vla-object (mapcar 'cadr (ssnamex ss)))) ; convert selection of entities to list of vla obj
; flatten selected objects to 1e99 -1e99 which = 0 elevation 
(foreach i (list 1e99 -1e99) 
 (mapcar(function(lambda (x) (vla-move x (vlax-3d-point (list 0 0 0)) (vlax-3d-point (list 0 0 i))))) ss) 
) ; foreach
; echo how many plines flattened
(princ(strcat"\nSuccessfully Flattened [" (itoa selected) "] Plines"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 06:14:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806247#M33486</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-03-08T06:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806429#M33487</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You may be inspired by &lt;A href="http://www.theswamp.org/index.php?topic=58129.msg613455#msg613455" target="_blank" rel="noopener"&gt;this reply&lt;/A&gt; to a similar request at TheSwamp.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 08:12:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806429#M33487</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-03-08T08:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806927#M33488</link>
      <description>&lt;P&gt;There are several approaches to the 3D-to-2D conversion in the Topic containing &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/trouble-converting-3d-to-2d-polyline/m-p/8273224/highlight/true#M374147" target="_blank" rel="noopener"&gt;&amp;gt;this&amp;lt;&lt;/A&gt; offering of mine.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 12:21:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11806927#M33488</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-03-08T12:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808382#M33489</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Paul, thank you for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to expand on your code with my extremely limited skills :P.&lt;/P&gt;&lt;P&gt;The only problems I have (apart from my very sloppy additions) are:&lt;/P&gt;&lt;P&gt;- I Can't get the new polylines to elevation 0&lt;BR /&gt;- Get error message at end but still works&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:3DP2FLATPLBB ()

(command "-linetype" "load" "*" "E:\\Dropbox\\Dropbox\\ABD\\Linetypes\\STREAMBANK" "" "") ;Have to remove parenthesis if linetype exists in drawing
(command "_.Layer" "_Make" "ABD - A - 2d Bank Bottom" "_Color" "251" "" "LType" "STREAMBANK" "" "LWeight" "0.09" "" "")

; select 3dpoly to get layer
(while(not(setq en (ssget"_+.:E:S"'((0 . "POLYLINE")(100 . "AcDb3dPolyline"))))))
; get layer name
(setq lyr(cdr(assoc 8(entget (ssname en 0)))))
; select all 3dpolylines on matching layer:
(setq ss(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 lyr))))
; make copy selection to same location
(command"_.Copy" ss "" "@" "@") 

(command "_chprop" ss "" "_LA" "ABD - A - 2d Bank Bottom" "")
; I should probably setq this layer :P

; select all 3dpolylines on new layer layer:
(setq nl(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 "ABD - A - 2d Bank Bottom"))))

; now flatten original selection
(command "_.AeccConvert3dPolys" nl "")
; Im using Civil 3d so can use this command, but polylines end up on 1st 3dpoly point elevation


; echo how many plines flattened
(princ(strcat"\nSuccessfully Flattened [" (itoa selected) "] Plines"))
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 21:57:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808382#M33489</guid>
      <dc:creator>As-Built_Sigurd</dc:creator>
      <dc:date>2023-03-08T21:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808392#M33490</link>
      <description>&lt;P&gt;Oh another problem is that the original 3d polys are usually set to continuous lintypes, and the new 2d polys end up with the same linetypes, rather than bylayer&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:01:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808392#M33490</guid>
      <dc:creator>As-Built_Sigurd</dc:creator>
      <dc:date>2023-03-08T22:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808404#M33491</link>
      <description>&lt;P&gt;very good additions you've made.&lt;/P&gt;&lt;P&gt;To test if linetype exists before loading use this code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if(not(tblsearch"LTYPE""STREAMBANK"))
 (command "-linetype" "load" "*" "E:\\Dropbox\\Dropbox\\ABD\\Linetypes\\STREAMBANK" "" "")
)&lt;/LI-CODE&gt;&lt;P&gt;Since the Civil3d flatten command does not allow you to place the now 2d Polylines onto 0 elevation, used AutoCAD's built-in Change command:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(command "_.Change" ss "" "_P" "_E" "0" "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:08:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808404#M33491</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-03-08T22:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808413#M33492</link>
      <description>&lt;P&gt;This linetype issue could be caused by the Civil 3D flatten command.&lt;/P&gt;&lt;P&gt;Perhaps try my code I provided before to flatten instead?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; now flatten original selection
(setq selected (sslength ss)) ; get total number of selected objects
(setq ss (mapcar 'vlax-ename-&amp;gt;vla-object (mapcar 'cadr (ssnamex ss)))) ; convert selection of entities to list of vla obj
; flatten selected objects to 1e99 -1e99 which = 0 elevation 
(foreach i (list 1e99 -1e99) 
 (mapcar(function(lambda (x) (vla-move x (vlax-3d-point (list 0 0 0)) (vlax-3d-point (list 0 0 i))))) ss) 
) ; foreach&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808413#M33492</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-03-08T22:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808550#M33493</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks Paul. Yes putting your flattening code before the conversion to polylines did the trick. I also just added the bylayer bit too. It may look messy, but it works perfectly (as far as I have tested so far).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:3DP2FLATPLBB ()

(if(not(tblsearch"LTYPE""STREAMBANK"))
 (command "-linetype" "load" "*" "E:\\Dropbox\\Dropbox\\ABD\\Linetypes\\STREAMBANK" "" "") ; To check if layer exists
)
(command "_.Layer" "_Make" "ABD - A - 2d Bank Bottom" "_Color" "251" "" "LType" "STREAMBANK" "" "LWeight" "0.09" "" "")

; select 3dpoly to get layer
(while(not(setq en (ssget"_+.:E:S"'((0 . "POLYLINE")(100 . "AcDb3dPolyline"))))))
; get layer name
(setq lyr(cdr(assoc 8(entget (ssname en 0)))))
; select all 3dpolylines on matching layer:
(setq ss(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 lyr))))
; make copy selection to same location
(command"_.Copy" ss "" "@" "@") 



(command "_chprop" ss "" "_LA" "ABD - A - 2d Bank Bottom" "")
(command "_chprop" ss "" "_LT" "BYLAYER" "")
; I should probably setq this layer :P


; now flatten original selection
(setq selected (sslength ss)) ; get total number of selected objects
(setq ss (mapcar 'vlax-ename-&amp;gt;vla-object (mapcar 'cadr (ssnamex ss)))) ; convert selection of entities to list of vla obj
; flatten selected objects to 1e99 -1e99 which = 0 elevation 
(foreach i (list 1e99 -1e99) 
 (mapcar(function(lambda (x) (vla-move x (vlax-3d-point (list 0 0 0)) (vlax-3d-point (list 0 0 i))))) ss) 
) ; foreach

; select all 3dpolylines on new layer layer:
(setq nl(ssget"x"(list'(0 . "POLYLINE")'(100 . "AcDb3dPolyline")(cons 8 "ABD - A - 2d Bank Bottom"))))

; now convert 3d polys
(command "_.AeccConvert3dPolys" nl "")

; echo how many plines flattened
(princ(strcat"\nSuccessfully Flattened [" (itoa selected) "] Plines"))
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 23:33:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808550#M33493</guid>
      <dc:creator>As-Built_Sigurd</dc:creator>
      <dc:date>2023-03-08T23:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: 3d Polylines to new 2d Polylines on new layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808607#M33494</link>
      <description>&lt;P&gt;Glad to have helped…cheers!!!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 00:08:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polylines-to-new-2d-polylines-on-new-layer/m-p/11808607#M33494</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-03-09T00:08:04Z</dc:date>
    </item>
  </channel>
</rss>

