乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 54|回复: 15

[编程交流] Routine to set transparency &#

[复制链接]

37

主题

264

帖子

236

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
185
发表于 2022-7-5 16:23:35 | 显示全部楼层 |阅读模式
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..)
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 16:29:14 | 显示全部楼层
  1. (vlax-for obj blkDefObj (vla-put-entitytransparency obj "BYBLOCK"))
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
325
发表于 2022-7-5 16:35:00 | 显示全部楼层
For vanilla route it looks like group code 440 is for transparency:
 
  1. ((-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")[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.
回复

使用道具 举报

37

主题

264

帖子

236

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
185
发表于 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?
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 16:39:45 | 显示全部楼层
Try searching with the correct function name: vla-put-entitytransparency.
回复

使用道具 举报

37

主题

264

帖子

236

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
185
发表于 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
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 16:49:52 | 显示全部楼层
Try this generic function:
  1. ; (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)) ))
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:52:01 | 显示全部楼层
have a look at these results
  1. (vla-get-entitytransparency obj)"ByLayer"(vla-get-entitytransparency obj)"50"
回复

使用道具 举报

37

主题

264

帖子

236

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
185
发表于 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..
 
 
 
  1. (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.. ;-)
 
  1. [list=1]
  2. [*]([url="http://www.theswamp.org/~john/avlisp/#defun"][color=#4d4dff][b]defun[/b][/color][/url] SetEntityTransparency (entity transparency [color=#008000]/[/color] typ)
  3. [*]  ([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)))
  4. [*]               ([color=#008000]=[/color] [color=#ff0000]"BYLAYER"[/color] ([url="http://www.theswamp.org/~john/avlisp/#strcase"][color=#4d4dff][b]strcase[/b][/color][/url] transparency))
  5. [*]          )
  6. [*]          ([url="http://www.theswamp.org/~john/avlisp/#and"][color=#4d4dff][b]and[/b][/color][/url] ([color=#008000]=[/color] 'INT typ) ([color=#008000][/color][url="http://www.theswamp.org/~john/avlisp/#vla-object"][color=#008b8b][b]vla-object[/b][/color][/url] entity)
  7. [*]              transparency
  8. [*]            )
  9. [*]           )
  10. [*]     )
  11. [*]  )
  12. [/list]
回复

使用道具 举报

37

主题

264

帖子

236

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
185
发表于 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
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-1 10:47 , Processed in 2.104628 second(s), 73 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表