New CADforum look launched.
Over 1.082.000 registered users (EN+CZ). New 1D nesting and 3D nesting tools, updated Color converter. New AutoCAD 2025 commands and variables. Learn about twiGIS.
Over 1.082.000 registered users (EN+CZ). New 1D nesting and 3D nesting tools, updated Color converter. New AutoCAD 2025 commands and variables. Learn about twiGIS.
CAD tip # 9063:
Question
A
For simple flipping of faces in AutoCAD (changing back and front sides, with no change in geometry) you can use the free AutoLISP utility CADstudio FlipFace. This LISP application supports both 3-vertex and 4-vertex 3D faces (3DFACE entities).
Download FlipFace from z Download, load its LSP file with APPLOAD and type the command FLIPFACE. Select the (3DFACE) to flip - their orientation (normals) will change. Face normals - i.e. the direction where the face "faces" - can be checked using the add-on utility Normals (see the tip 8903).
Front faces and unified normals of faces in 3D mesh objects may be important in many scenarios for processing 3D CAD data.
Here is the FlipFace utility as an AutoLISP code:
;FLIPFACE - flip selected 3DFaces (reverse normals) ;(C)2013 - CAD Studio - www.cadstudio.cz - www.cadforum.cz ; (defun C:FlipFace( / ss ssl p1 p2 p3 p4 e edata ndata) (prompt "\nSelect 3DFaces to reverse normals: ") (setq ss (ssget '((0 . "3DFACE")))) (if ss (progn (setq ssl (sslength ss)) (setvar "CMDECHO" 0) (command "_UNDO" "_BE") (while (> ssl 0) (setq edata (entget (setq e (ssname ss (setq ssl (1- ssl)))))) (setq p1 (cdr (assoc 10 edata))) (setq p2 (cdr (assoc 11 edata))) (setq p3 (cdr (assoc 12 edata))) (setq p4 (cdr (assoc 13 edata))) (if (or (equal p1 p4) (equal p3 p4)) ; 3 or 4 point 3DFACE? (setq ndata (subst (cons 10 p2)(assoc 10 edata) edata) ndata (subst (cons 11 p1)(assoc 11 edata) ndata) ); else (setq ndata (subst (cons 10 p4)(assoc 10 edata) edata) ndata (subst (cons 13 p1)(assoc 13 edata) ndata) ndata (subst (cons 11 p3)(assoc 11 edata) ndata) ndata (subst (cons 12 p2)(assoc 12 edata) ndata) ) );if (entmod ndata) (entupd e) );while (command "_UNDO" "_E") (setvar "CMDECHO" 1) (princ "\nDone. Use _U to revert back (undo).") ));if (princ) )
ACAD
*CAD
30.1.2013
19472×
applies to: AutoCAD ·