Short description
๐ 3DF_to_3DPoly is an AutoCAD and Civil 3D AutoLISP utility that converts selected 3DFACE entities into closed 3D polylines while preserving the original vertex elevations. It helps CAD and Civil 3D users transform face-based geometry into editable 3D polyline boundaries for cleanup, drafting, terrain preparation, and production drawing workflows.
Command:
๐งฐ Load the LISP file with APPLOAD or (load "3DF_to_3DPoly.lsp").
๐ Run the command 3df2pl in AutoCAD or Civil 3D.
๐ Select one or more 3DFACE entities when prompted.
๐งฉ The routine creates a closed 3DPOLY for each selected face using the 3DFACE vertex DXF points 10, 11, 12, and 13.
๐ Target platform: AutoCAD and Civil 3D with Visual LISP and standard AutoLISP command support.
Description:
๐ 3DF_to_3DPoly is a focused AutoLISP conversion tool for AutoCAD and Civil 3D users who need to convert 3DFACE geometry into normal closed 3D Polyline objects.
๐ The user runs 3df2pl, selects the required 3DFACE entities in the drawing, and the program reads the four vertex coordinates stored in the entity definition. Each face is then recreated as a closed 3D polyline using the AutoCAD ._3dpoly command.
๐ Because the routine uses the original 3D face vertex points, the resulting 3D polylines keep the Z elevations from the source faces. This is useful for Civil 3D cleanup, survey geometry processing, 3D drafting, terrain boundary preparation, legacy DWG conversion, and CAD quality-control workflows.
๐ง The LISP includes a Civil 3D compatibility header, a guarded vl-load-com pattern, local error handling, and system variable restoration for CMDECHO and OSMODE. The workflow is intentionally simple: select faces, convert them, and continue working with editable 3D polyline geometry.
Helper function: (if any)โ
- ๐ Command entry point –
c:3df2pldefines the user command that starts the 3DFACE to 3D polyline conversion workflow. - ๐ 3DFACE selection filter –
ssgetuses the filter((0 . "3DFACE"))so only valid 3DFACE objects are selected for conversion. - ๐ DXF vertex extraction –
entgetreads the selected entity data, andLI_itemretrieves vertex codes10,11,12, and13. - ๐งฉ 3D polyline creation – the AutoCAD
._3dpolycommand is called with all four source face vertices and then closed with_Close. - ๐ง Elevation preservation – the routine passes full 3D point lists to
3DPOLY, so the converted geometry keeps the original X, Y, and Z coordinates. - ๐ System variable protection –
CMDECHOandOSMODEare saved before processing and restored through the local*error*handler. - ๐งน Civil 3D compatibility guard – the header avoids unsafe top-level COM behavior and uses a guarded Visual LISP COM-loading pattern.
- ๐ Small helper function –
LI_itemreturns the value of a requested DXF dotted pair from an association list, keeping the conversion logic concise and readable.
Functionalities:
- ๐ Convert 3DFACE to 3D Polyline – quickly transforms face geometry into editable closed 3D polyline objects.
- ๐ Preserve vertex elevations – keeps the original Z values from the selected 3DFACE vertices.
- ๐ Select multiple faces – processes an AutoCAD selection set so several 3DFACE entities can be converted in one command run.
- ๐งฉ Create closed boundaries – uses the four face vertices and closes the generated 3D polyline automatically.
- ๐ง Use direct DXF data – reads entity vertex data from
entgetinstead of relying on manual point picking. - ๐ Restore drafting settings – returns
CMDECHOandOSMODEafter processing or after an error. - ๐งน Improve drawing cleanup – helps replace legacy 3DFACE objects with more practical 3D polyline geometry for CAD editing.
- ๐ Support Civil 3D production workflows – useful before terrain cleanup, feature interpretation, surface boundary preparation, 3D drafting, and DWG conversion tasks.
Result:
โ The final result is a practical AutoCAD and Civil 3D AutoLISP utility that converts selected 3DFACE objects into closed 3D polylines with elevation-aware vertices. It improves drawing cleanup, makes legacy 3D face geometry easier to edit, reduces manual tracing, and supports faster 3D CAD and Civil 3D production workflows.
Images, animations etc.
XAML code:
๏ปฟ<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows"> <src:RibbonToolTip x:Key="3DF_to_3DPoly"> <src:RibbonToolTip.ExpandedContent> <StackPanel> <TextBlock Background="AntiqueWhite" TextAlignment="Left"> <Bold>Function Syntax: 3DF2PL</Bold> <LineBreak/> <Bold>Version: 1.0 Date: 20.06.2026 2:44:37PM</Bold> <LineBreak/> <Hyperlink>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-face-to-polylines-macro/td-p/7585662</Hyperlink> <LineBreak/> <Bold><Run Foreground="DodgerBlue">short_description:</Run></Bold><LineBreak/> <Run Foreground="White">๐ 3DF_to_3DPoly is an AutoCAD and Civil 3D AutoLISP utility that converts selected </Run><Bold><Run Foreground="DarkRed">3DFACE</Run></Bold><Run Foreground="White"> entities into closed </Run><Bold><Run Foreground="DarkRed">3D polylines</Run></Bold><Run Foreground="White"> while preserving vertex elevations.</Run><LineBreak/> <Run Foreground="LimeGreen">The main benefit is faster CAD cleanup, easier 3D geometry editing, and better Civil 3D production preparation.</Run><LineBreak/> <Bold><Run Foreground="DodgerBlue">command:</Run></Bold><LineBreak/> <Run Foreground="White">๐งฐ Load the LISP with </Run><Bold><Run Foreground="Orange">APPLOAD</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">(load "3DF_to_3DPoly.lsp")</Run></Bold><Run Foreground="White">.</Run><LineBreak/> <Run Foreground="White">๐ Run </Run><Bold><Run Foreground="Orange">3df2pl</Run></Bold><Run Foreground="White"> to start the conversion command.</Run><LineBreak/> <Run Foreground="White">๐ Select one or more </Run><Bold><Run Foreground="Orange">3DFACE</Run></Bold><Run Foreground="White"> objects from the active drawing.</Run><LineBreak/> <Run Foreground="White">๐งฉ The routine creates a closed </Run><Bold><Run Foreground="Orange">3DPOLY</Run></Bold><Run Foreground="White"> using DXF vertex codes </Run><Bold><Run Foreground="Orange">10</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">11</Run></Bold><Run Foreground="White">, </Run><Bold><Run Foreground="Orange">12</Run></Bold><Run Foreground="White">, and </Run><Bold><Run Foreground="Orange">13</Run></Bold><Run Foreground="White">.</Run><LineBreak/> <Bold><Run Foreground="DodgerBlue">description:</Run></Bold><LineBreak/> <Run Foreground="White">๐ This AutoLISP program converts AutoCAD </Run><Bold><Run Foreground="DarkRed">3DFACE</Run></Bold><Run Foreground="White"> geometry into normal closed </Run><Bold><Run Foreground="DarkRed">3D Polyline</Run></Bold><Run Foreground="White"> objects.</Run><LineBreak/> <Run Foreground="White">๐ The user runs the command, selects the faces, and the tool reads the original vertex coordinates directly from the entity data.</Run><LineBreak/> <Run Foreground="White">๐ Each source face is recreated as a closed 3D polyline, making the geometry easier to edit, inspect, export, or reuse in Civil 3D workflows.</Run><LineBreak/> <Run Foreground="LimeGreen">Because the source X, Y, and Z points are reused, the generated 3D polylines retain the elevation information from the original faces.</Run><LineBreak/> <Bold><Run Foreground="LimeGreen">helper_function:</Run></Bold><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Command entry point</Run></Bold><Run Foreground="White"> - c:3df2pl defines the main AutoCAD command.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Selection filter</Run></Bold><Run Foreground="White"> - ssget limits selection to 3DFACE objects.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">DXF vertex extraction</Run></Bold><Run Foreground="White"> - entget reads entity data and LI_item extracts vertex codes 10, 11, 12, and 13.</Run><LineBreak/> <Run Foreground="White">๐งฉ </Run><Bold><Run Foreground="LimeGreen">3D polyline creation</Run></Bold><Run Foreground="White"> - the command ._3dpoly creates the converted geometry and _Close closes the boundary.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">System variable restoration</Run></Bold><Run Foreground="White"> - CMDECHO and OSMODE are restored through the local error handler.</Run><LineBreak/> <Run Foreground="White">๐งน </Run><Bold><Run Foreground="LimeGreen">Civil 3D-safe header</Run></Bold><Run Foreground="White"> - the LISP includes guarded Visual LISP COM loading and safer command behavior notes.</Run><LineBreak/> <Bold><Run Foreground="LimeGreen">functionalities:</Run></Bold><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Convert 3DFACE to 3D Polyline</Run></Bold><Run Foreground="White"> - turns selected face entities into editable closed 3D polylines.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Preserve elevations</Run></Bold><Run Foreground="White"> - keeps the original Z values from the source vertices.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Batch selection</Run></Bold><Run Foreground="White"> - converts multiple 3DFACE objects in one command run.</Run><LineBreak/> <Run Foreground="White">๐งฉ </Run><Bold><Run Foreground="LimeGreen">Closed geometry output</Run></Bold><Run Foreground="White"> - automatically closes each generated 3D polyline.</Run><LineBreak/> <Run Foreground="White">๐ง </Run><Bold><Run Foreground="LimeGreen">Direct entity data workflow</Run></Bold><Run Foreground="White"> - uses DXF data instead of manual point picking.</Run><LineBreak/> <Run Foreground="White">๐ </Run><Bold><Run Foreground="LimeGreen">Civil 3D cleanup support</Run></Bold><Run Foreground="White"> - helps prepare legacy DWG geometry for production drafting and terrain-related workflows.</Run><LineBreak/> <Bold><Run Foreground="DodgerBlue">result:</Run></Bold><LineBreak/> <Run Foreground="White">โ The final result is a lightweight AutoCAD and Civil 3D conversion tool that produces closed 3D polylines from selected 3DFACE entities.</Run><LineBreak/> <Run Foreground="LimeGreen">It reduces manual tracing, improves 3D drawing cleanup, and makes legacy face-based geometry easier to manage in CAD production.</Run><LineBreak/> <Bold><Run Foreground="DarkOrange">additional_info:</Run></Bold><LineBreak/> <Run Foreground="White">๐ The routine converts only </Run><Bold><Run Foreground="Orange">3DFACE</Run></Bold><Run Foreground="White"> entities and does not create Civil 3D surfaces, feature lines, alignments, corridors, or section views.</Run><LineBreak/> <Run Foreground="White">๐ด Triangular faces with repeated vertices may create a closed 3D polyline with overlapping points.</Run><LineBreak/> <Run Foreground="White">๐ The command saves and restores </Run><Bold><Run Foreground="Orange">CMDECHO</Run></Bold><Run Foreground="White"> and </Run><Bold><Run Foreground="Orange">OSMODE</Run></Bold><Run Foreground="White"> for safer drafting behavior.</Run><LineBreak/> </TextBlock> <!-- Use MediaElement for GIF (static first frame) and Image as fallback --> </StackPanel> </src:RibbonToolTip.ExpandedContent> </src:RibbonToolTip> </ResourceDictionary>
