How to put transparency to an objekt in BricsCAD 16?

Dear Forum,

in AutoCAD its possible to put transparecy to an ocject with following LISP-Code:

(vla-put-entitytransparency vla-object value)

The function vla-put-entitytransparency ist not known in BricsCAD 16. How can I put transparency in a LISP-environment to an object?

Best regards.

Comments

  • [code]; Transparency:
    ; 0                              ; Transparency ByLayer.
    ; (lsh 1 24)         => 16777216 ; Transparency ByBlock.
    ; (lsh 2 24)         => 33554432 ; Transparency 100%; Saturation   0%.
    ; (+ (lsh 2 24) 255) => 33554687 ; Transparency   0%; Saturation 100%.

    ; (_Sys_Transparency_Num_To_Perc 33554661) => 0.1
    ; (_Sys_Transparency_Num_To_Perc (cdr (assoc 440 (entget (car (entsel))))))
    (defun _Sys_Transparency_Num_To_Perc (num)
      (* 0.01 (fix (/ (- 33554687 num) 2.55)))
    )

    ; (_Sys_Transparency_Perc_To_Num 0.1) => 33554661
    (defun _Sys_Transparency_Perc_To_Num (perc)
      (fix (- 33554687 (* perc 255)))
    )

    ; (TransparencyPut (car (entsel)) "80")
    ; (TransparencyPut (car (entsel)) "ByLayer")
    ; (TransparencyPut (car (entsel)) "ByBlock")
    (defun TransparencyPut (enme str)
      (vle-entmod
        440
        enme
        (cond
          ((= "BYLAYER" (strcase str))
            0
          )
          ((= "BYBLOCK" (strcase str))
            16777216
          )
          (T
            (_Sys_Transparency_Perc_To_Num (* 0.01 (atoi str)))
          )
        )
      )
    )

    ; (TransparencyGet (car (entsel)))
    (defun TransparencyGet (enme / num)
      (setq num (vle-entget 440 enme))
      (cond
        ((not num)
          "BYLAYER"
        )
        ((zerop num)
          "BYLAYER"
        )
        ((= 16777216 num)
          "BYBLOCK"
        )
        (T
          (rtos (* 100 (_Sys_Transparency_Num_To_Perc num)) 2 0)
        )
      )
    )[/code]
  • Dear Albert,

    next coming V16.2 will have (vla-get-entitytransparency) and (vla-put-entitytransparency) the same way as known from AutoLISP :-)
    besides, as Roy mentioned, (entmod) or the BricsCAD-specific (vle-entmod) can be used with DXF 440 ...
    many greetings !
  • Dear Roy,
    thank you for this tip!

    Dear Torsten,
    thank you for this information!

    Many greetings,
    Albert

  • @Roy: Are "vle-entmod" and "vle-entget" lisp-functions, special made for BricsCAD?

    I cannot find them it the developer reference: https://www.bricsys.com/bricscad/help/en_US/V16/DevRef/

    Best regards, Albert
  • @Roy: Are "vle-entmod" and "vle-entget" lisp-functions, special made for BricsCAD?

    I cannot find them it the developer reference: https://www.bricsys.com/bricscad/help/en_US/V16/DevRef/

    Best regards, Albert


    Sorry, I found them :-)
  • When using those "(vle-xxx)" functions, which do not exist in AutoCAD AutoLISP :
    always load the "vle-extension.lsp" from your Lisp code, this file contains the emulations of "vle-xxx" functions, if those functions are not available as plain built-in Lisp functions.
    Hence, the "vle-xxx" fucntions will be available in AutoCAD, ZWCAD etc. as well ...

    vle-extension.lsp can be even loaded in BricsCAD also, does not harm ...
    function definition is optional, if not yet present (simply see inside vle-extension.lsp).

    More details in "Lisp Developer Support Package" in AppCatalaog
    http://www.bricsys.com/applications/a/?lisp-developer-support-package-%28ldsp%29-a720-al1176

    many greeitngs !
This discussion has been closed.