Quantcast
Channel: AutoCAD Tips
Viewing all articles
Browse latest Browse all 89

AutoLISP: Convert 2D Solid to Polyline Outline

$
0
0

Since 2D solids aren’t very friendly after you place them and are hard to edit, you may need find this tool helpful for converting the solid into a polyline that represents the outline of the solid.

An example of its use is editing existing drawings… I have been adjusting blocks from an older block library where some parts of the blocks contain “arrowheads” but they are really just 2D solids. This is helpful so that the users don’t actually snap to these arrows. But a few of them no longer conform to our new CAD standards and sadly, some of the geometry was drawn incorrectly. So I have been using this routine to adjust these stubborn objects.

Here’s how:

  • OUTLINESOLID <enter>
  • Select the 2D Solid
Convert 2D Solid to Polyline

Convert 2D Solid to Polyline


;;; Select a 2D solid and this will delete the solid and replace its outline with a polyline
;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Solid-object-to-Polyline/td-p/783079
;;; Posted By: Schamenek, Alex
(defun c:outlinesolid(/ solid pt1 pt2 pt3 pt4)
   (prompt "\nPlease select the solid you want to outline.")
   (WHILE (NOT (setq solid (ssget ":S" '((0 . "SOLID")))))
      (prompt "\nPlease select the solid you want to outline."))
      (SETQ pt1 (cdr (assoc 10 (entget (ssname solid 0))))
         pt2 (cdr (assoc 11 (entget (ssname solid 0))))
         pt3 (cdr (assoc 12 (entget (ssname solid 0))))
         pt4 (cdr (assoc 13 (entget (ssname solid 0))))
       );SETQ
   (COMMAND "_.PLINE" PT1 PT2 PT4 PT3 "C")
   (command ".erase" solid "")
);DEFUN


Viewing all articles
Browse latest Browse all 89

Trending Articles