halam Posted May 2, 2017 Share Posted May 2, 2017 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..) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 3, 2017 Share Posted May 3, 2017 (vlax-for obj blkDefObj (vla-put-entitytransparency obj "BYBLOCK") ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 3, 2017 Share Posted May 3, 2017 For vanilla route it looks like group code 440 is for transparency: ((-1 . <Entity name: 7ff7d4c073c0>) (0 . "LINE") (330 . <Entity name: 7ff7d4c039f0>) (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 . <Entity name: 7ff7d4c073d0>) (0 . "LINE") (330 . <Entity name: 7ff7d4c039f0>) (5 . "2B5") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "VLD_AnnotateLINES") [color="red"] (440 . 33554572)[/color] (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. Quote Link to comment Share on other sites More sharing options...
halam Posted May 3, 2017 Author Share Posted May 3, 2017 (edited) 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? Edited May 4, 2017 by halam Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 3, 2017 Share Posted May 3, 2017 From what I understood vla-put-transperancy does NOT exist in AutoCADTry searching with the correct function name: vla-put-entitytransparency. Quote Link to comment Share on other sites More sharing options...
halam Posted May 3, 2017 Author Share Posted May 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 3, 2017 Share Posted May 3, 2017 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)) ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 4, 2017 Share Posted May 4, 2017 have a look at these results (vla-get-entitytransparency obj) "ByLayer" (vla-get-entitytransparency obj) "50" Quote Link to comment Share on other sites More sharing options...
halam Posted May 4, 2017 Author Share Posted May 4, 2017 (edited) 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.. ;-) [list=1] [*]([url="http://www.theswamp.org/~john/avlisp/#defun"][color=#4d4dff][b]defun[/b][/color][/url] SetEntityTransparency (entity transparency [color=#008000]/[/color] typ) [*] ([url="http://www.theswamp.org/~john/avlisp/#if"][color=#4d4dff][b]if[/b][/color][/url] ([url="http://www.theswamp.org/~john/avlisp/#or"][color=#4d4dff][b]or[/b][/color][/url] ([url="http://www.theswamp.org/~john/avlisp/#and"][color=#4d4dff][b]and[/b][/color][/url] ([color=#008000]=[/color] 'STR ([url="http://www.theswamp.org/~john/avlisp/#setq"][color=#4d4dff][b]setq[/b][/color][/url] typ ([url="http://www.theswamp.org/~john/avlisp/#type"][color=#4d4dff][b]type[/b][/color][/url] transparency))) [*] ([color=#008000]=[/color] [color=#ff0000]"BYLAYER"[/color] ([url="http://www.theswamp.org/~john/avlisp/#strcase"][color=#4d4dff][b]strcase[/b][/color][/url] transparency)) [*] ) [*] ([url="http://www.theswamp.org/~john/avlisp/#and"][color=#4d4dff][b]and[/b][/color][/url] ([color=#008000]=[/color] 'INT typ) ([color=#008000]<=[/color] [color=#0000dd]0[/color] transparency [color=#0000dd]90[/color])) [*] ) [*] ([url="http://www.theswamp.org/~john/avlisp/#cond"][color=#4d4dff][b]cond[/b][/color][/url] (([color=#008000]=[/color] '[url="http://www.theswamp.org/~john/avlisp/#vla-object"][color=#008b8b][b]VLA-OBJECT[/b][/color][/url] ([url="http://www.theswamp.org/~john/avlisp/#setq"][color=#4d4dff][b]setq[/b][/color][/url] typ ([url="http://www.theswamp.org/~john/avlisp/#type"][color=#4d4dff][b]type[/b][/color][/url] entity))) [*] ([url="http://www.theswamp.org/~john/avlisp/#not"][color=#4d4dff][b]not[/b][/color][/url] (vla[color=#008000]-[/color]put[color=#008000]-[/color]entitytransparency entity transparency)) [*] ) [*] (([color=#008000]=[/color] 'ENAME typ) [*] (SetEntityTransparency [*] (vlax[color=#008000]-[/color]ename[color=#008000]->[/color][url="http://www.theswamp.org/~john/avlisp/#vla-object"][color=#008b8b][b]vla-object[/b][/color][/url] entity) [*] transparency [*] ) [*] ) [*] ) [*] ) [/list] Edited May 4, 2017 by halam Quote Link to comment Share on other sites More sharing options...
halam Posted May 4, 2017 Author Share Posted May 4, 2017 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 Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 6, 2017 Share Posted May 6, 2017 (edited) Hans if you want to change the block definitions for a selection of block references you should first extract their block names: ; (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)) ) ) (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret) (if ss (repeat (setq i (sslength ss)) (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret)) ) ) ) (defun C:TRBB ( / doc doneLst ss) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (setq ss (ssget '((0 . "INSERT")))) (foreach obj (KGA_Conv_Pickset_To_ObjectList ss) (if (not (vl-position (strcase (vla-get-name obj)) doneLst)) (progn (NestedPutProp (vla-get-name obj) 'entitytransparency "BYBLOCK") (setq doneLst (cons (strcase (vla-get-name obj)))) ) ) ) ) (vla-endundomark doc) (princ) ) Edited May 8, 2017 by Roy_043 The doc variable was not localized. Quote Link to comment Share on other sites More sharing options...
halam Posted May 7, 2017 Author Share Posted May 7, 2017 Thx !! that was what i was assuming... This piece of code allready saves me a whole bunch of dead work load! But it is still picking blocks one-by-one.. The final touch would be it would work on a sessies of blocks for ssget. As reference, this tool from Gile that can do allmost all, except for the tranparency. http://gilecad.azurewebsites.net/LISP/Edit_bloc_3.5.zip Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 8, 2017 Share Posted May 8, 2017 But it is still picking blocks one-by-one..Judging from your last comment you have not tested the code in my previous post. If you analyse the code you will notice: (setq ss (ssget '((0 . "INSERT")))) Quote Link to comment Share on other sites More sharing options...
halam Posted May 8, 2017 Author Share Posted May 8, 2017 I did however, just does not work as that way. Only 1 block is redined. Check the link. Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted May 8, 2017 Share Posted May 8, 2017 OK try this: ; (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)) ) ) (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret) (if ss (repeat (setq i (sslength ss)) (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret)) ) ) ) (defun C:TRBB ( / doc doneLst ss) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (setq ss (ssget '((0 . "INSERT")))) (foreach obj (KGA_Conv_Pickset_To_ObjectList ss) (if (not (vl-position (strcase (vla-get-name obj)) doneLst)) (progn (NestedPutProp (vla-get-name obj) 'entitytransparency "BYBLOCK") (setq doneLst (cons (strcase (vla-get-name obj)) doneLst)) ) ) ) ) (vla-regen doc acactiveviewport) (vla-endundomark doc) (princ) ) Quote Link to comment Share on other sites More sharing options...
halam Posted May 8, 2017 Author Share Posted May 8, 2017 Great !!! Many thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.