Short description
CookieCutter2 is an AutoCAD and Civil 3D AutoLISP trimming and cleanup utility that uses a closed circle, polyline, ellipse, or spline as a cutting boundary to trim intersecting geometry or erase objects inside or outside the selected area.
Command:
Primary command: CookieCutter2
Shortcut command: CC
Multi-boundary command: CookieCutter2Multi
Multi-boundary shortcut: CC2M
Run CookieCutter2 or CC in the AutoCAD command line to select one closed trimming boundary, choose the side to process, and trim or erase geometry. Run CookieCutter2Multi or CC2M to keep objects inside any of several selected closed boundaries by erasing objects outside their combined areas.
Description:
CookieCutter2 is an AutoCAD and Civil 3D AutoLISP alternative to Express Tools EXTRIM, also known as CookieCutter. It accepts a circle or a closed polyline, ellipse, or spline as the trimming edge, then asks the user to pick the side to trim. Depending on the selected side, the routine can behave like EXTRIM or erase all objects on visible layers inside or outside the boundary.
The routine expands the trimming workflow by processing blocks, hatches, and regions. Intersecting blocks can be exploded recursively, nested block attributes can be converted to text, non-solid hatches and regions can be exploded, and solid hatches can optionally be converted to ANSI31 lines before trimming. Objects that cannot be trimmed are preserved or skipped according to their type.
CookieCutter2 temporarily unlocks locked non-xref layers, traces curved boundary geometry into point lists, detects inside and outside areas, calculates intersections with Visual LISP ActiveX IntersectWith logic, offsets the selected boundary to determine trim points, trims intersecting objects, restores the original view and system variables, relocks layers, and groups the operation inside an AutoCAD undo mark.
The included CookieCutter2Multi command adds a multi-boundary cleanup mode. It accepts several closed boundaries, builds the combined inside and crossing selections, protects the selected boundaries, and erases objects outside all selected areas. This multi-boundary mode performs outside erasing only and does not trim intersecting entities.
Helper function: (if any)
Main helper functions include CC:TraceObject, CC:TracePline, CC:TraceCE, and CC:TraceSpline for boundary tracing; CC:GetInters for ActiveX intersection detection; CC:Inside for point-in-polygon testing; CC:CommandExplode and CC:ExpNestedBlock for block processing; CC:AttributesToText for attribute conversion; CC:UnlockLayers and CC:RelockLayers for layer-state handling; CC:ZoomToPointList and Extents for view control; SortInterPoints for ordered trim points; and the CC2M:TraceObject family for multi-boundary outside-erasing support.
Functionalities:
– Runs the primary CookieCutter2 command with the CC shortcut.
– Accepts a circle or closed polyline, ellipse, or spline as the trimming edge.
– Rejects non-closed, self-intersecting, and unsupported boundary objects.
– Lets the user pick whether the inside or outside side of the boundary should be processed.
– Can erase all objects on visible layers inside or outside the selected boundary.
– Behaves like EXTRIM when the erase-all option is not selected.
– Explodes intersecting blocks and recursively processes nested blocks.
– Converts exploded block attributes into text while preserving key properties.
– Explodes regions and non-solid hatches that intersect the trimming boundary.
– Offers to convert intersecting solid hatches into ANSI31 lines before trimming.
– Ignores true external references and can process bound block content when it is explodable.
– Skips annotation and unsupported entities such as text, mtext, leaders, dimensions, mleaders, tables, solids, traces, and remaining solid hatches.
– Temporarily unlocks locked non-xref layers and relocks them when the command ends.
– Uses an offset boundary and IntersectWith calculations to determine reliable trim locations.
– Sorts multiple intersection points to improve repeated trimming behavior.
– Restores AutoCAD system variables, object visibility, layer locks, and the original view after completion or error.
– Wraps the operation in an AutoCAD undo mark.
– Includes CookieCutter2Multi and CC2M for keeping objects inside any of several closed boundaries by erasing objects outside their combined areas.
Result:
The primary routine trims intersecting drawing objects or erases visible-layer objects on the selected side of one closed boundary. It can break down blocks, hatches, and regions so their supported geometry can be processed. The multi-boundary routine preserves objects inside or crossing any selected boundary and erases objects outside the combined selected areas.
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="CookieCutter2"> <src:RibbonToolTip.ExpandedContent> <StackPanel> <TextBlock Background="AntiqueWhite" TextAlignment="Left"> <Bold>Function Syntax: CookieCutter2 / CC / DelOutside / CookieCutter2Multi / CC2M</Bold> <LineBreak/> <Bold>Version: 1.1 Date: 20.06.2026 6:38:50PM</Bold> <LineBreak/> <Hyperlink>https://www.cadtutor.net/forum/topic/66934-help-lisp-cookiecutter2-v12-mod-by-vva-dont-trim-polyline-3d/</Hyperlink> <LineBreak/> <Bold><Run Foreground="DodgerBlue">🚀 CookieCutter2</Run></Bold><LineBreak/> <Run Foreground="White">CookieCutter2 is an AutoCAD and Civil 3D AutoLISP utility for trimming geometry or erasing objects inside or outside a selected closed cutting boundary.</Run><LineBreak/> <Run Foreground="LimeGreen">It extends the EXTRIM-style workflow by processing blocks, nested blocks, hatches, and regions while providing boundary-based drawing cleanup options.</Run><LineBreak/> <LineBreak/> <Bold><Run Foreground="DodgerBlue">Main Commands</Run></Bold><LineBreak/> <Run Foreground="White">🧰 Run </Run><Bold><Run Foreground="Orange">CookieCutter2</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">CC</Run></Bold><Run Foreground="White"> to select one closed cutting boundary and trim or erase geometry on the chosen side.</Run><LineBreak/> <Run Foreground="White">🗺️ Run </Run><Bold><Run Foreground="Orange">CookieCutter2Multi</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">CC2M</Run></Bold><Run Foreground="White"> to keep objects inside any of several selected closed boundaries by erasing objects outside their combined areas.</Run><LineBreak/> <LineBreak/> <Bold><Run Foreground="DodgerBlue">SEO Optimized Description</Run></Bold><LineBreak/> <Run Foreground="White">📐 This AutoCAD cookie cutter trim tool uses a circle or closed polyline, ellipse, or spline as a cutting edge for inside trimming, outside trimming, boundary cleanup, and area-based erasing.</Run><LineBreak/> <Run Foreground="White">🔍 The routine supports CAD production workflows where intersecting lines, curves, blocks, hatches, and regions need to be processed against a closed boundary more efficiently than repetitive manual TRIM and ERASE operations.</Run><LineBreak/> <Run Foreground="White">🧠 It uses Visual LISP ActiveX </Run><Bold><Run Foreground="Orange">IntersectWith</Run></Bold><Run Foreground="White"> logic, boundary tracing, point-in-polygon tests, offset geometry, and sorted intersection points to determine reliable trimming locations.</Run><LineBreak/> <Run Foreground="White">📌 CookieCutter2 is useful for CAD technicians, Civil 3D users, survey drafting, utility plans, site drawings, map cleanup, detail isolation, hatch cleanup, block-heavy drawings, and any AutoCAD workflow that requires EXTRIM-style boundary processing.</Run><LineBreak/> <LineBreak/> <Bold><Run Foreground="LimeGreen">Functionalities</Run></Bold><LineBreak/> <Run Foreground="White">🚀 </Run><Bold><Run Foreground="LimeGreen">EXTRIM-style workflow</Run></Bold><Run Foreground="White"> - selects one closed boundary, asks for the side to process, and trims intersecting geometry when erase-all is not selected.</Run><LineBreak/> <Run Foreground="White">📐 </Run><Bold><Run Foreground="LimeGreen">Supported cutting edges</Run></Bold><Run Foreground="White"> - accepts circles, closed lightweight or 2D polylines, ellipses, and closed splines as trimming boundaries.</Run><LineBreak/> <Run Foreground="White">🧹 </Run><Bold><Run Foreground="LimeGreen">Inside or outside erase</Run></Bold><Run Foreground="White"> - can erase all objects on visible layers either inside or outside the selected trimming object.</Run><LineBreak/> <Run Foreground="White">🧩 </Run><Bold><Run Foreground="LimeGreen">Block processing</Run></Bold><Run Foreground="White"> - explodes intersecting blocks, recursively processes nested blocks, and converts block attributes into text when possible.</Run><LineBreak/> <Run Foreground="White">🎨 </Run><Bold><Run Foreground="LimeGreen">Hatch and region support</Run></Bold><Run Foreground="White"> - explodes regions and non-solid hatches that cross the boundary so their supported geometry can be trimmed.</Run><LineBreak/> <Run Foreground="White">📏 </Run><Bold><Run Foreground="LimeGreen">Solid hatch conversion</Run></Bold><Run Foreground="White"> - optionally converts intersecting solid hatches to </Run><Bold><Run Foreground="Orange">ANSI31</Run></Bold><Run Foreground="White"> lines before trimming.</Run><LineBreak/> <Run Foreground="White">🔍 </Run><Bold><Run Foreground="LimeGreen">Boundary validation</Run></Bold><Run Foreground="White"> - rejects open, self-intersecting, spline-fit, or unsupported trimming objects before editing the drawing.</Run><LineBreak/> <Run Foreground="White">🧠 </Run><Bold><Run Foreground="LimeGreen">Intersection sorting</Run></Bold><Run Foreground="White"> - orders multiple trim points along curve parameters to make repeated trimming more predictable.</Run><LineBreak/> <Run Foreground="White">🔓 </Run><Bold><Run Foreground="LimeGreen">Layer-state handling</Run></Bold><Run Foreground="White"> - temporarily unlocks locked non-xref layers and relocks them when processing ends.</Run><LineBreak/> <Run Foreground="White">↩️ </Run><Bold><Run Foreground="LimeGreen">Undo and recovery</Run></Bold><Run Foreground="White"> - wraps changes in an AutoCAD undo mark and restores modified system variables, visibility states, layer locks, and the original view.</Run><LineBreak/> <Run Foreground="White">🗺️ </Run><Bold><Run Foreground="LimeGreen">Multi-boundary cleanup</Run></Bold><Run Foreground="White"> - the </Run><Bold><Run Foreground="Orange">CookieCutter2Multi</Run></Bold><Run Foreground="White"> command preserves objects inside or crossing any selected closed boundary and erases objects outside all selected areas.</Run><LineBreak/> <LineBreak/> <Bold><Run Foreground="DodgerBlue">Practical Result</Run></Bold><LineBreak/> <Run Foreground="White">✅ The result is a faster AutoCAD boundary trimming and cleanup workflow that can trim intersecting geometry, erase objects on a selected side, process block and hatch content, and isolate geometry inside multiple closed areas.</Run><LineBreak/> <Run Foreground="LimeGreen">This makes CookieCutter2 useful for EXTRIM replacement workflows, cookie-cutter editing, drawing cleanup, area isolation, hatch conversion, nested block processing, Civil 3D drafting support, and repetitive boundary-based CAD editing tasks.</Run><LineBreak/> <LineBreak/> <Bold><Run Foreground="DarkRed">Important Note</Run></Bold><LineBreak/> <Run Foreground="White">This command directly edits, erases, and may explode drawing objects. Review the result and use AutoCAD undo when needed.</Run><LineBreak/> <Run Foreground="White">The routine operates only on visible layers, ignores true external references, does not trim annotation objects, and may require cleanup after processing.</Run><LineBreak/> <Run Foreground="White">The </Run><Bold><Run Foreground="Orange">CookieCutter2Multi</Run></Bold><Run Foreground="White"> command performs outside erasing only and does not trim objects that cross the selected boundaries.</Run><LineBreak/> </TextBlock> <!-- Use MediaElement for GIF (static first frame) and Image as fallback --> </StackPanel> </src:RibbonToolTip.ExpandedContent> </src:RibbonToolTip> </ResourceDictionary>
