Jump to content

viewport overides


pBe

Recommended Posts

Guys

can anyone please help me with this routine i made for viewport overide. it needs a lot of improvement

1: i cant make truecolor read from my list '(135,13,135 79,161,99)... if i call the value via (car 'thelist)

it doesnt seem to recognize the value

2. i can see the "LayerProperyOverides" as :vlax-true but where is the data?

3. Vlisp method of toggling from one viewport to another like (ctrl+R)

here is my code:

 

(defun c:overideme (/ lynm_lst ov_clor Vp_SetlayLst cl_cntds_clr )  
(setq lynm_lst '("A-ANNO-TEXT" "A-ANNO-DIMS" "A-ANNO-SCHD")  ; items on this list will change
      ov_clor '(7 8 9))      ; (read-line...) from a txt file
          ; every project different list
(if (= (getvar "Tilemode") 1)     
  (setvar "tilemode" 0))

(setq Vp_Set (ssget "_X" '((0 . "VIEWPORT"))))
(setq layLst  (mapcar 'cadr(ssnamex vp_set))
 cl_cnt 0
   layLst (cdr (reverse layLst)))
(foreach vpnm layLst
 (foreach lyn_ lynm_lst
   (setq ds_clr (nth cl_cnt ov_clor))
    (vl-cmdf "vplayer" "color" ;"truecolor"  error 
    ds_clr
     lyn_ "s" vpnm "" "")
    (setq cl_cnt (1+ cl_cnt))
        )
   (setq cl_cnt 0)
  )
)

 

Thank you :)

Link to comment
Share on other sites

2. i can see the "LayerProperyOverides" as :vlax-true but where is the data?

 

Contained in various XRecords in the Extension Dictionary of the layer to which it applies:

 

(defun LM:GetOverrideData ( layer / data )
 (vl-load-com)
 ;; © Lee Mac 2010

 (if
   (and
     (not
       (vl-catch-all-error-p
         (setq layer
           (vl-catch-all-apply 'vla-item
             (list
               (vla-get-Layers
                 (vla-get-ActiveDocument
                   (vlax-get-acad-object)
                 )
               )
               layer
             )
           )
         )
       )
     )
     (eq :vlax-true (vla-get-HasExtensionDictionary layer))
   )
   (vlax-for xRecord (vla-getExtensionDictionary layer)
     (vla-getXRecordData xRecord 'typ 'val)
     
     (setq data (cons (LM:Variants->DXF typ val) data))
   )
 )

 (reverse data)
)

;;-------------------=={ Variant Value }==--------------------;;
;;                                                            ;;
;;  Converts a VLA Variant into native AutoLISP data types    ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  value - VLA Variant to process                            ;;
;;------------------------------------------------------------;;
;;  Returns:  Data contained within variant                   ;;
;;------------------------------------------------------------;;

(defun LM:VariantValue ( value )
 ;; © Lee Mac 2010
 (cond
   ( (eq 'variant (type value))

     (LM:VariantValue (vlax-variant-value value))
   )
   ( (eq 'safearray (type value))

     (mapcar 'LM:VariantValue (vlax-safearray->list value))
   )
   ( value )
 )
)

;;------------------=={ Variants->DXF }==---------------------;;
;;                                                            ;;
;;  Converts Type and Value Variants to a DXF List            ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  typ - VLA Variant of Integer type                         ;;
;;  val - VLA Variant of Variant type                         ;;
;;------------------------------------------------------------;;
;;  Returns:  DXF List                                        ;;
;;------------------------------------------------------------;;

(defun LM:Variants->DXF ( typ val )
 ;; © Lee Mac 2010
 (apply 'mapcar
   (cons 'cons
     (mapcar 'LM:VariantValue (list typ val))
   )
 )
)

Example:

 

(LM:GetOverrideData "0")

(
  (
    (102 . "{ADSK_LYR_COLOR_OVERRIDE")
    (335 2129672936 2105828574)
    (420 . -1033608142)
    (102 . "}")
    (102 . "{ADSK_LYR_COLOR_OVERRIDE")
    (335 2129673304 2105827950)
    (420 . -1033493146)
    (102 . "}")
  )
  (
    (102 . "{ADSK_LYR_LINETYPE_OVERRIDE")
    (335 2129672936 2105828574)
    (343 2129671312 2105830054)
    (102 . "}")
    (102 . "{ADSK_LYR_LINETYPE_OVERRIDE")
    (335 2129673304 2105827950)
    (343 2129671320 2105830062)
    (102 . "}")
  )
  (
    (102 . "{ADSK_LYR_LINEWT_OVERRIDE")
    (335 2129673304 2105827950)
    (91 . 18)
    (102 . "}")
  )
)

Lee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...