Author Topic: Replace - AFLAYER  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

MORITZK

  • Mosquito
  • Posts: 18
Replace - AFLAYER
« on: May 12, 2017, 02:59:57 PM »
Hallo,
in bricscad there is sometime a bug with aflayer and "deutschen Umlauten". Aflayer ignore sometime Layers with ä,ö,ü,ß.
I use (command "aflayer")  in lisp- routines. Is there a way to replace aflayer by another lisp- routine?
Thank you
Christian

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Replace - AFLAYER
« Reply #1 on: May 13, 2017, 07:34:53 AM »
aflayer = vplayer

Can you give a reproducible scenario? Your description ('sometimes') is rather vague.
BricsCAD version(s)?
Have you submitted a support request?

MORITZK

  • Mosquito
  • Posts: 18
Re: Replace - AFLAYER
« Reply #2 on: May 14, 2017, 02:25:35 PM »
Hallo, Roy,
i know the failure with V14/V15/V16. Now i work with V17-German. Most of time bricscad vplayer works correct, but sometimes not.
The support knows the  problem since V17. I can´t give a reproducible scenario. Its sometimes, but i think, in V17 the failure is oftener.
Only Bricscad- restart helps. Very rare i must twice or triply restart. This was only in V17.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Replace - AFLAYER
« Reply #3 on: May 15, 2017, 07:07:44 AM »
There are some Lisp functions available since BricsCAD V17 for dealing with viewport overrides (See 'Lisp Developer Support Package' vl-vplayer-set-* and vl-vplayer-get-*).

MORITZK

  • Mosquito
  • Posts: 18
Re: Replace - AFLAYER
« Reply #4 on: May 15, 2017, 08:41:51 AM »
Thank you,
but i think, this is not helpfull for me. There is no vl-vplayer-set-on / off / freeze / thaw.
Christian

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Replace - AFLAYER
« Reply #5 on: May 15, 2017, 11:38:11 AM »
The names of layers that are 'vp frozen' are stored as Xdata attached to the viewport.

Here is what I use (KGA_Layer_VpVisibilityMultiChange):
Code - Auto/Visual Lisp: [Select]
  1. ; (KGA_Conv_List_To_Array '(1 2 3 4 5) vlax-vbinteger)
  2. (defun KGA_Conv_List_To_Array (lst typ)
  3.   (if lst
  4.       (vlax-make-safearray typ (cons 0 (1- (length lst))))
  5.       lst
  6.     )
  7.   )
  8. )
  9.  
  10. ; (KGA_Data_ObjectXdataGet (vlax-ename->vla-object (car (entsel))) "MYAPP") => ((1000 . "ghi") (1000 . "jkl") (1000 . "mno") (1010 1.0 3.0 5.0))
  11. (defun KGA_Data_ObjectXdataGet (object app / keyLst valueLst)
  12.   (vla-getxdata object app 'keyLst 'valueLst) ; Vlax-invoke does not work here.
  13.   (if keyLst
  14.     (mapcar
  15.       '(lambda (key value)
  16.         (cons
  17.           key
  18.           (if (= 'safearray (type (setq value (vlax-variant-value value))))
  19.             (vlax-safearray->list value)
  20.             value
  21.           )
  22.         )
  23.       )
  24.       (cdr (vlax-safearray->list keyLst))
  25.       (cdr (vlax-safearray->list valueLst))
  26.     )
  27.   )
  28. )
  29.  
  30.  
  31. ; The function does not check the xdroom.
  32. ; The function always returns nil.
  33. ; (KGA_Data_ObjectXdataSet (vlax-ename->vla-object (car (entsel))) "MYAPP" '((1000 . "ghi") (1000 . "jkl") (1000 . "mno") (1010 1.0 3.0 5.0)))
  34. (defun KGA_Data_ObjectXdataSet (object app dataLst)
  35.     object
  36.     (KGA_Conv_List_To_Array
  37.       (cons 1001 (mapcar 'car dataLst))
  38.       vlax-vbinteger
  39.     )
  40.     (KGA_Conv_List_To_Array
  41.       (cons
  42.         app
  43.         (mapcar
  44.           '(lambda (a) (if (vl-consp (cdr a)) (vlax-3d-point (cdr a)) (cdr a)))
  45.           dataLst
  46.         )
  47.       )
  48.       vlax-vbvariant
  49.     )
  50.   )
  51. )
  52.  
  53. ; With speed improvement based on Reini Urban's (std-%setnth).
  54. ; (KGA_List_DropRight '(0 1 2 3 4 5) 2)   => (0 1 2 3)
  55. (defun KGA_List_DropRight (lst n)
  56.   (cond
  57.     ((minusp n)
  58.       lst
  59.     )
  60.     ((zerop n)
  61.       lst
  62.     )
  63.     ((>= n (length lst))
  64.       nil
  65.     )
  66.     (T
  67.       (setq lst (reverse lst))
  68.       (repeat (/ n 4)
  69.         (setq lst (cddddr lst))
  70.       )
  71.       (repeat (rem n 4)
  72.         (setq lst (cdr lst))
  73.       )
  74.       (reverse lst)
  75.     )
  76.   )
  77. )
  78.  
  79. ; (KGA_List_SplitBefore '(0 1 2 6 4 5 6 7 8) 6) => ((0 1 2) (6 4 5 6 7 8))
  80. (defun KGA_List_SplitBefore (lst itm / tail)
  81.   (if (setq tail (member itm lst))
  82.     (list (KGA_List_DropRight lst (length tail)) tail)
  83.     (list lst nil)
  84.   )
  85. )
  86.  
  87. ;;; 20161019
  88. ;;; (KGA_Layer_VpVisibilityMultiChange (vlax-ename->vla-object (car (entsel))) '("NewLayer1") '("NewLayer2"))
  89. ;;; ======================================================================
  90. ;;; Lib function: KGA_Layer_VpVisibilityMultiChange
  91. ;;; Purpose:      VP freeze layers in a viewport.
  92. ;;; Arguments:    vpObj     - Viewport object.
  93. ;;;               freezeLst - List of layer names to VP freeze.
  94. ;;;               thawLst   - List of layer names to VP thaw.
  95. ;;; Return value: T.
  96. ;;; ======================================================================
  97. (defun KGA_Layer_VpVisibilityMultiChange (vpObj freezeLst thawLst / lst tmp)
  98.   (setq lst (mapcar 'strcase (append freezeLst thawLst)))
  99.   (setq tmp (KGA_List_SplitBefore (KGA_Data_ObjectXdataGet vpObj "ACAD") '(1002 . "}")))
  100.   (KGA_Data_ObjectXdataSet
  101.     vpObj
  102.     "ACAD"
  103.     (append
  104.       (vl-remove-if
  105.         '(lambda (sub) (and (= (car sub) 1003) (vl-position (strcase (cdr sub)) lst)))
  106.         (car tmp)
  107.       )
  108.       (mapcar
  109.         '(lambda (lyrNme) (cons 1003 lyrNme))
  110.         freezeLst
  111.       )
  112.       (cadr tmp)
  113.     )
  114.   )
  115.   T
  116. )

MORITZK

  • Mosquito
  • Posts: 18
Re: Replace - AFLAYER
« Reply #6 on: May 15, 2017, 03:56:37 PM »
Thank you very much, Roy.
this ist the perfect replacement for german aflayer.
Thank you.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Replace - AFLAYER
« Reply #7 on: May 16, 2017, 03:50:06 AM »
The names of layers that are 'vp frozen' are stored as Xdata attached to the viewport.

Here is what I use (KGA_Layer_VpVisibilityMultiChange):
...
:smitten: