halam 发表于 2022-7-5 16:23:35

Routine to set transparency &#

Hi,
 
 
Wondering if any one has clue how transparency of elements in 'block' can be defined 'byblock'. Coming from Revit i have files with a overkill of blockdefinitions i just want to convert this way.
 
 

 
 
ps
 
 
I have posted a question similar in regards to mr. Gile Fixblock routine, but this doesn't seem possible back then..)

Roy_043 发表于 2022-7-5 16:29:14

(vlax-for obj blkDefObj (vla-put-entitytransparency obj "BYBLOCK"))

Grrr 发表于 2022-7-5 16:35:00

For vanilla route it looks like group code 440 is for transparency:
 

((-1 . ) (0 . "LINE") (330 . ) (5 . "2B4") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "VLD_AnnotateLINES") (100 . "AcDbLine") (10 -14.3023 -208.701 0.0) (11 239.348 -97.2689 0.0) (210 0.0 0.0 1.0))_$ ((-1 . ) (0 . "LINE") (330 . ) (5 . "2B5") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "VLD_AnnotateLINES") (440 . 33554572) (100 . "AcDbLine") (10 197.342 -405.725 0.0) (11 434.836 -405.725 0.0) (210 0.0 0.0 1.0))
 
In the above 2 line entities were compared, where one had trasparency value of 45.

halam 发表于 2022-7-5 16:36:04

From what I understood vla-put-transperancy does NOT exist in AutoCAD, Roy.
Searched for it in various resources in vain. I would think some. Refedit, select all, command properties.
Where to start?

Roy_043 发表于 2022-7-5 16:39:45

Try searching with the correct function name: vla-put-entitytransparency.

halam 发表于 2022-7-5 16:44:06

Ok. Good catch.
Can you show me how can it be used on a block ? Byblock.. Instead of 0-90..
 
http://www.theswamp.org/index.php?topic=44517.0

Roy_043 发表于 2022-7-5 16:49:52

Try this generic function:

; (NestedPutProp "MyBlk" 'entitytransparency "BYBLOCK"); (NestedPutProp "MyBlk" 'color 3)(defun NestedPutProp (nme prop val / blk) (if   (and   (not       (vl-catch-all-error-p          (setq blk         (vl-catch-all-apply             'vla-item             (list               (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))               nme             )         )         )       )   )   (= :vlax-false (vla-get-islayout blk))   (= :vlax-false (vla-get-isxref blk))   )   (vlax-for obj blk (vlax-put obj prop val)) ))

BIGAL 发表于 2022-7-5 16:52:01

have a look at these results

(vla-get-entitytransparency obj)"ByLayer"(vla-get-entitytransparency obj)"50"

halam 发表于 2022-7-5 16:59:31

Roy,
 
 
I tried it in this code. No succes.Are you sure this works on nesting? Not in my AutoCAD
A solllution would be not to apply it on 'Mytempblck' put to all blocks in the SS selection..
 
 
 

(defun C:TRBB (/ SS XS YS RA) (setvar "cmdecho" 0) (setq SS (ssget)) (if (= XS NIL)   (setq XS 1) ) ;_ end of if (if (= YS NIL)   (setq YS 1) ) ;_ end of if (if (= RA NIL)   (setq RA 0) ) ;_ end of if (command"block""MytempBlk" "0,0" SS "")(command"insert""MytempBlk" "0,0" XS YS RA "") (NestedPutProp "MytempBlk" 'entitytransparency "BYBLOCK"); ALL blocks in SS (command"explode" "l" "purge""b""MytempBlk" "n")   )@Bigal
Something just like it can be found, vla-put- but i'm just don't know you to apply some code like this. .. Sorry, beyond my skills.. ;-)
 


[*](defun SetEntityTransparency (entity transparency / typ)
[*](if (or (and (= 'STR (setq typ (type transparency)))
[*]               (= "BYLAYER" (strcase transparency))
[*]          )
[*]          (and (= 'INT typ) (vla-object entity)
[*]            transparency
[*]            )
[*]         )
[*]   )
[*])

halam 发表于 2022-7-5 16:59:39

By the way, i notice some strange behaviour
wanting to reset "ByBlock" back to "Bylayer".. (file attached)
Is 'Transparency Byblock' supported or not ??
 
 
In BricsCAD V17 is does act normal
 
In AutoCAD 2017 with my tools it switches back to 'byblock'
In AutoCAD 2017 without any loaded lisps
In AutoCAD 2018 beta without loaded loaded
 
 
Really seems like a BUG to me..
??
 

strange transparency.dwg
页: [1] 2
查看完整版本: Routine to set transparency &#