Author Topic: Attribs: Dynamic Visibility versus GroupCode 60  (Read 3325 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 654
Attribs: Dynamic Visibility versus GroupCode 60
« on: April 13, 2015, 09:11:28 AM »
I talked with an Acad user who has many dynamic blocks where the dynamic-features are only used to modify the visibility of the attribs. Now I'm thinking about the pros and cons of using groupcode 60 (visibility) instead of dynamic feature.

Con:
- needs a special tool (Lisp ...) and
- needs a special handling


Pro:
- can be used also without dynamic block
- can be used regardless of the name of visiblity-status
- can be used in old Acadversions
- does not create a bunch of "*U-blocks"
- the tool can be used for other features too

It seems that I oversaw some cons - but which? "Of course "Dynamic" can be used for much more, but if it is reduced only to the mentioned usage?
What's your opinion about this approach?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #1 on: April 13, 2015, 09:30:50 AM »
Aside, note that dynamic blocks also use the DXF 60 group code to control the visibility of objects within the block definition.
« Last Edit: April 13, 2015, 09:57:07 AM by Lee Mac »

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #2 on: April 13, 2015, 10:45:04 AM »
Dynamic blocks are the spawn of Satan and should be avoided at all costs. The visibility states feature is especially prone to abuse by end users. As a developer you should never sell your soul to dynamic blocks.

Peter2

  • Swamp Rat
  • Posts: 654
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #3 on: April 13, 2015, 11:09:31 AM »
Dynamic blocks are the spawn of Satan and should be avoided at all costs...
The clarity of this response is impressive .. :-)

(Do you have some links summing up this topic?)
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #4 on: April 13, 2015, 11:43:45 AM »
Since you are only looking to control the visibility of attributes, rather than using the generic visibility property (i.e. DXF Group 60) you could instead use the invisible property of an attribute reference, which could be reverted manually using ATTSYNC if necessary.

To offer an example, attached is an old program following this approach (please excuse my old & ugly code formatting).

Lee

Peter2

  • Swamp Rat
  • Posts: 654
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #5 on: April 13, 2015, 12:18:28 PM »
Hi Lee

thanks, that's look the way I'm thinking about. But I'm still hoping for some opinions about pros and cons of the 3 ways

- dynamic visibility
- entity visibility with GC 60
- Attdef visibility with GC 70

Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

lamarn

  • Swamp Rat
  • Posts: 636
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #6 on: April 13, 2015, 04:07:45 PM »

I would like to use ddatte2 to my routine.
This code makes it easy to use a mixed kind of attributes.
But if i replace ddatte with c:ddatte2 i can not make it work.
I would like to get some idea's what i can do. Thanks in advance
Hans

Code: [Select]

(defun C:ed () (editicc))   ; ...DEFAULT EDIT ROUTINE FOR MIXED TEXT STUFF...

(defun editicc (/ SS CNT NUM SENT ANS oldsnp ent els tx1 sta )
  (command "undo" "group")
  (setq oldsnp (getvar "snapmode"))
  (setvar "snapmode" 0)
  (prompt "\n  Multi-Edit  ")
  (if (>= (getvar "acadver") "13")
    (setq SS (ssget '((-4 . "<or")
      (0 . "RTEXT")
                      (0 . "ATTDEF")
                      (0 . "DIMENSION")
                      (0 . "MTEXT")
                      (0 . "TEXT")
      (0 . "MULTILEADER")
                      (0 . "TOLERANCE")
                      (-4 . "<and")
                      (0 . "INSERT")
                      (66 . 1)
                      (-4 . "and>")
                      (-4 . "or>")
                     )
             )
    )
    (setq SS (ssget '((-4 . "<or")
                      (0 . "ATTDEF")
                      (0 . "TEXT")
                      (-4 . "<and")
                      (0 . "INSERT")
                      (66 . 1)
                      (-4 . "and>")
                      (-4 . "or>")
                     )
             )
    )
  )
  (if SS
    (progn
      (setq NUM (sslength SS)
            CNT 0
      )
      (while (< CNT NUM)
        (princ (strcat "\r Edit : "
                       (rtos (1+ CNT) 2 0)
                       " of "
                       (rtos NUM 2 0)
                       ": "
               )
        )
        (setq SENT (ssname SS CNT))
        (setq ANS (cdr (assoc 0 (entget SENT))))
        (cond
          ((or (eq ANS "ATTDEF")
               (eq ANS "TEXT")
               (eq ANS "TOLERANCE")
       (eq ANS "MULTILEADER")
           )
           (command "textedit" SENT \)
          )
  ((or (eq ANS "MTEXT")
           )
           (command "mtedit" SENT \)
          )

  ((or (eq ANS "rtext")
           )
           (command "rtedit" SENT \ pause)
          )
 
  ((or (eq ANS "DIMENSION")
           )
           (command "ddedit" SENT \)
          )
   
   
          ((eq ANS "INSERT")
           (command "DDatte" SENT \)    ;;; .. THIS LINE IS FOR STANDARD DDATTE WHICH I WOULD LIKE TO MAKE C:DDATT2, BUT HOW...?
          )
  ((eq ANS "RTEXT") (c:RTEDIT))
          )
        (entupd SENT)
        (setq CNT (1+ CNT))
      )
      (princ "  Done... ")
    )
    (princ "  Nothing selected. ")
  )
  (setvar "snapmode" oldsnp)
  (command "undo" "end")
  (princ)
) ;EOF


Design is something you should do with both hands. My 2d hand , my 3d hand ..

Peter2

  • Swamp Rat
  • Posts: 654
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #7 on: April 13, 2015, 04:40:31 PM »

I would like to use ddatte2 to my routine....

Code: [Select]
...
((eq ANS "INSERT")
    (command "DDatte" SENT \)    ;;; .. THIS LINE IS FOR STANDARD DDATTE WHICH I WOULD LIKE TO MAKE C:DDATT2, BUT HOW...?
)
....) ;EOF
Usually, a lisp is called from a lisp-file like
Code - Auto/Visual Lisp: [Select]
  1. (c:ddatte2)
- no "command", no quotation mark. But of course there a lisps which need parameter, some have an unexpected reurn-value: you have to check and to try.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #8 on: April 13, 2015, 05:19:17 PM »
I would like to use ddatte2 to my routine.
This code makes it easy to use a mixed kind of attributes.
But if i replace ddatte with c:ddatte2 i can not make it work.

Without modifying the ddatte2 code, and assuming PICKFIRST is set to 1 (though, this could be set in your code if necessary), try replacing:
Code: [Select]
(command "DDatte" SENT \)
With:
Code: [Select]
(sssetfirst nil (ssadd sent))
(c:ddatte2)

You will also need to ensure the selected block is attributed.

(@Peter2, apologies for derailing the thread!)

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #9 on: April 13, 2015, 06:00:15 PM »
Dynamic blocks are the spawn of Satan and should be avoided at all costs...
(Do you have some links summing up this topic?)

Sorry, I don't have anything more technical other than to point out that Autodesk very wisely abandoned dynamic blocks for the associative network framework.

lamarn

  • Swamp Rat
  • Posts: 636
Re: Attribs: Dynamic Visibility versus GroupCode 60
« Reply #10 on: April 14, 2015, 02:39:25 AM »
Thanks Lee Mac, and sorry for derailling the dynamic block discussion.
Happy Birthday to you!!

(please skip my edit routine from now then)
Design is something you should do with both hands. My 2d hand , my 3d hand ..