TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: lamarn on April 01, 2021, 02:04:46 PM

Title: Edge 1-4 3dface
Post by: lamarn on April 01, 2021, 02:04:46 PM
Hi,

How can the edge 1 edge 2 egde 3 and edge 4 settings be manipulated.
I want to turn them of for all 3dfaces for or after import / conversion..

thanks


Title: Re: Edge 1-4 3dface
Post by: ronjonp on April 01, 2021, 02:58:06 PM
Select them all and use the Properties Palette ?
Title: Re: Edge 1-4 3dface
Post by: lamarn on April 01, 2021, 03:46:40 PM
Yes, but no. It's horribly slow. Large models.
And there is some sort of max. where the pallette shows nothing.
Searching for it but there is nothing documented (?)
Title: Re: Edge 1-4 3dface
Post by: Lee Mac on April 01, 2021, 04:57:38 PM
Edge visibility for a 3D Face is controlled by the bit-coded value of DXF group 70 (http://help.autodesk.com/view/ACD/2021/ENU/?guid=GUID-747865D5-51F0-45F2-BEFE-9572DBC5B151) where:
Quote
Invisible edge flags (optional; default = 0):

1 = First edge is invisible
2 = Second edge is invisible
4 = Third edge is invisible
8 = Fourth edge is invisible

Here is a quickly written program to demonstrate how to manipulate this value:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:3dfev ( / b i s x )
  2.     (if (and (setq s (ssget "_:L" '((0 . "3DFACE"))))
  3.              (setq b (3dfev:dialog))
  4.              (setq b (cons 70 b))
  5.         )
  6.         (repeat (setq i (sslength s))
  7.             (setq i (1- i)
  8.                   x (entget (ssname s i))
  9.             )
  10.             (entmod (subst b (assoc 70 x) x))
  11.         )
  12.     )
  13.     (princ)
  14. )
  15.  
  16. (defun 3dfev:dialog ( / *error* bit dch dcl des rtn )
  17.  
  18.     (defun *error* ( msg )
  19.         (if (< 0 dch) (unload_dialog dch))
  20.         (if (= 'file (type des)) (setq des (close des)))
  21.         (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl))
  22.         (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
  23.             (princ (strcat "\nError: " msg))
  24.         )
  25.         (princ)
  26.     )
  27.    
  28.     (if
  29.         (and
  30.             (setq dcl (vl-filename-mktemp nil nil ".dcl"))
  31.             (setq des (open dcl "w"))
  32.             (foreach str
  33.                '(
  34.                     "tmp : dialog"
  35.                     "{"
  36.                     "    label = \"3D Face Edge Visibility\";"
  37.                     "    spacer;"
  38.                     "    : boxed_column"
  39.                     "    {"
  40.                     "        label = \"Visible Edges\";"
  41.                     "        : toggle { key = \"1\"; label = \"Edge 1\"; }"
  42.                     "        : toggle { key = \"2\"; label = \"Edge 2\"; }"
  43.                     "        : toggle { key = \"4\"; label = \"Edge 3\"; }"
  44.                     "        : toggle { key = \"8\"; label = \"Edge 4\"; }"
  45.                     "        spacer;"
  46.                     "    }"
  47.                     "    ok_cancel;"
  48.                     "}"
  49.                 )
  50.                 (write-line str des)
  51.             )
  52.             (not (setq des (close des)))
  53.             (< 0 (setq dch (load_dialog dcl)))
  54.             (new_dialog "tmp" dch)
  55.             (setq bit 1 rtn (logior 1 2 4 8))
  56.             (repeat 4
  57.                 (action_tile (itoa bit) "(setq rtn (logand rtn (~ (logand (atoi $key) (- (atoi $value))))))")
  58.                 (setq bit (lsh bit 1))
  59.             )
  60.             (zerop (start_dialog))
  61.         )
  62.         (setq rtn nil)
  63.     )
  64.     (*error* nil)
  65.     rtn
  66. )
Title: Re: Edge 1-4 3dface
Post by: lamarn on April 01, 2021, 05:36:27 PM
Outstanding!!
Does this in less than a minute what otherwise can take over a hour!
Thanks mr. Lee Mac!

Title: Re: Edge 1-4 3dface
Post by: Lee Mac on April 01, 2021, 06:55:41 PM
You're welcome - I'm glad it helps!  :-)