TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mkweaver on April 19, 2011, 10:36:30 AM

Title: Viewport layer overrides? Where is the data
Post by: mkweaver on April 19, 2011, 10:36:30 AM
I know where to find the information for layers frozen in viewports.  How about layers with other overrides (color/lineweight/linetype)?

Thanks,
Mike
Title: Re: Viewport layer overrides? Where is the data
Post by: T.Willey on April 19, 2011, 10:37:58 AM
It's in the extension dictionary of the layers.
Title: Re: Viewport layer overrides? Where is the data
Post by: mkweaver on April 19, 2011, 11:36:45 AM
Thanks for the reply Tim.  I haven't done much with extension dictionaries - time to do some studying.

Mike
Title: Re: Viewport layer overrides? Where is the data
Post by: Lee Mac on April 19, 2011, 11:46:57 AM
This may help you in your quest:

http://www.theswamp.org/index.php?topic=35274.0 (http://www.theswamp.org/index.php?topic=35274.0)
Title: Re: Viewport layer overrides? Where is the data
Post by: T.Willey on April 19, 2011, 12:04:23 PM
Here are some codes I use to dig into entity data.  If you want to step through layer 0, then call like

(ChaseEntData (tblobjname "layer" "0"))

Code: [Select]
(defun c:ChaseEntData (/ Sel)
    (if (setq Sel (entsel))
        (ChaseEntData (car Sel))
    )
    (princ)
)
;-----------------------------------------
(defun ChaseEntData (Ent / DiaRtn DataList)
   
    (while
        (and
            Ent
            (setq DiaRtn
                (SingleSelectWide
                    (mapcar
                        '(lambda (x / tempType)
                            (if
                                (and
                                    (equal (type (cdr x)) 'ENAME)
                                    (setq tempType (cdr (assoc 0 (entget (cdr x)))))
                                )
                                (strcat
                                    (vl-princ-to-string (car x))
                                    "\t\t"
                                    (vl-princ-to-string (cdr x))
                                    "  [ "
                                    tempType
                                    " ]"
                                )
                                (strcat
                                    (vl-princ-to-string (car x))
                                    "\t\t"
                                    (vl-princ-to-string (cdr x))
                                )
                            )
                        )
                        (setq DataList (entget Ent '("*")))
                    )
                    "Select entity name to chase."
                    nil
                )
            )
        )
        (if (not (equal (type (setq Ent (cdr (nth (car DiaRtn) DataList)))) 'ENAME))
            (setq Ent nil)
        )
    )
)
Code: [Select]
(defun SingleSelectWide (Listof Message Toggle / DiaLoad tmpStr tmpTog tmpList)

(setq DiaLoad (load_dialog "MyDialogs.dcl"))
(if (new_dialog "SingleSelectWide" DiaLOad)
(progn
(start_list "listbox" 3)
(mapcar 'add_list Listof)
(end_list)
(if Message
(set_tile "text1" Message)
)
(if (not Toggle)
(mode_tile "toggle1" 1)
)
(action_tile "listbox"
"(if (= $reason 4)
(progn
(setq tmpStr (get_tile \"listbox\"))
(if Toggle
(setq tmpTog (get_tile \"toggle1\"))
)
(done_dialog 1)
)
)"
)     
(action_tile "accept"
"(progn
(setq tmpStr (get_tile \"listbox\"))
(if Toggle
(setq tmpTog (get_tile \"toggle1\"))
)
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq tmpList (read (strcat "(" tmpStr ")")))
(if (= tmpTog "1")
(cons T tmpList)
tmpList
)
)
)
)
)
)
Title: Re: Viewport layer overrides? Where is the data
Post by: mkweaver on April 19, 2011, 04:02:30 PM
I stand in awe.

Thanks for the links and code.  It looks like everything I might need will be covered.

Mike