Author Topic: Help: Insert Hatch with transparency  (Read 372 times)

0 Members and 1 Guest are viewing this topic.

mhy3sx

  • Newt
  • Posts: 166
Help: Insert Hatch with transparency
« on: June 30, 2024, 09:44:31 AM »
Hi I am trying to  hach a close polyline with transparency, but I can not set transparency !!

The code is

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test (/ la ss i sset p1 p2)
  2.   (if (not (tblsearch "LAYER" "HATCH"))
  3.     (vl-cmdf "_.layer" "_m" "HATCH" "_c" "40" "" "")
  4.   )
  5.  
  6.   (setq la (getvar "clayer"))
  7.   (command "-layer" "S" "HATCH" "")
  8.  
  9.   (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
  10.     (progn
  11.       (repeat
  12.         (setq i (sslength ss))
  13.         (setq sset (ssname ss (setq i (1- i))))
  14.         (if (and
  15.               (eq (car (setq p1 (cdr (vlax-curve-getStartPoint sset))))
  16.                    (car (setq p2 (cdr (vlax-curve-getEndPoint sset))))
  17.               )
  18.               (eq (cadr p1)
  19.                   (cadr p2)
  20.               )
  21.             )
  22.             (progn
  23.               (command "_.-hatch" "_s" sset "" "_P" "solid" "")
  24.               (setvar 'CETRANSPARENCY 80)  ; Set hatch transparency to 80% ,BUT IS NOT WORKING !!!!
  25.             )
  26.           )
  27.         )
  28.       )
  29.     )
  30.     (princ "\n No closed Polylines found !! ")
  31.  
  32.  
  33.   ; Hatch back
  34.   (setq hss (ssget "x" '((0 . "HATCH"))))
  35.   (command "draworder" hss "" "b")
  36.   (setvar "clayer" la)
  37.   (princ)
  38. )
  39.  

Thanks

ribarm

  • Gator
  • Posts: 3327
  • Marko Ribar, architect
Re: Help: Insert Hatch with transparency
« Reply #1 on: June 30, 2024, 09:56:09 AM »
Have you tried to switch this two lines :

Code - Auto/Visual Lisp: [Select]
  1.               (command "_.-hatch" "_s" sset "" "_P" "solid" "")
  2.               (setvar 'CETRANSPARENCY 80)  ; Set hatch transparency to 80% ,BUT IS NOT WORKING !!!!
  3.  

Try with :

Code - Auto/Visual Lisp: [Select]
  1.               (setvar 'CETRANSPARENCY 80)
  2.               (command "_.-hatch" "_s" sset "" "_P" "solid" "")
  3.  
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhy3sx

  • Newt
  • Posts: 166
Re: Help: Insert Hatch with transparency
« Reply #2 on: June 30, 2024, 10:05:31 AM »
Thanks ribarm   :smitten: