乐筑天下

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

[综合讨论] A little help if possible (Ch

[复制链接]

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 23:25:34 | 显示全部楼层 |阅读模式
A little help if possible,
 
Does anybody know how to change the VP (viewport) colour of a layer by script or if its even possible.
 
Regards KT
 
p.s or lsp of course.
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 23:37:47 | 显示全部楼层
It appears that you'll have to dig into a LayerTableRecord's Extension Dictionary's XRecord for this.
 
Cheers
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 23:45:00 | 显示全部楼层
 
Thank you, just what I didn't want to hear
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 23:50:18 | 显示全部楼层
Yeah, sorry... I got hit up for something, and posted quickly... Try this:
 
  1. (defun c:FOO (/ eName layerName color) (if   (or     (and       (setq eName              (car (entsel "\nSelect entity to change VP color: "))       )       (setq layerName (cdr (assoc 8 (entget eName))))     )     (and       (setq layerName              (getstring T                         "\nEnter layer name to change VP color: "              )       )       (tblsearch "layer" layerName)     )   )    (if (setq color (acad_colordlg                      (if (= "BYLAYER" (setq color (getvar 'cecolor)))                        256                        color                      )                    )        )      (command "._vplayer" "_color" color layerName pause "")    ) ) (princ))
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 23:54:16 | 显示全部楼层
You could use a script, at least what I understand to be a script (LT mentality)
  1. vplayercolorREDNameOfLayercurrent
the script should be finished with 2 presses of the enter key, and the script called up whilst a viewport is active. The color should be changed to suit and can include true color.
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-7 00:02:21 | 显示全部楼层
Thank you both BlackBox & Steven-g I shall give both methods a go, much appreciated.
 
I though I knew AutoCAD quite well but I never knew there was a VPlayer command   , thanks again for that one.
回复

使用道具 举报

7

主题

708

帖子

701

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-7 00:10:09 | 显示全部楼层
Don't know where I got this but use it quite often.
 
  1. (defun c:lc (/ clr lay) (vl-load-com) (setq lay (cdr      (assoc 8 (entget   (car (entsel "\nSelect object to change layer color: ")) )      )    )clr (acad_colordlg 1) ) (if (and lay clr)   (vla-put-color     (vlax-ename->vla-object (tblobjname "layer" lay))     clr   ) ) (princ))
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-7 00:18:52 | 显示全部楼层
Thank you Rob another one to try lsp wise.
 
The script is quite easy now that I know the VPLAYER command & works a treat.
 
Many thanks all for help.
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-7 00:19:57 | 显示全部楼层
im running a script
  1. ^C^Cvplayer color 8 * Select  
 
how can i pause it for user selection? for example i want to type the color index instead of fixed 8.
回复

使用道具 举报

3

主题

18

帖子

15

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-7 00:25:53 | 显示全部楼层
 
You uses a backslash (\) at the point where you want to manually input.
 
 
Found a link for you
https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/AutoCAD-LT/files/GUID-9D921CDD-89A3-44AB-865A-00F8986611F2-htm.html
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 09:53 , Processed in 0.930337 second(s), 72 queries .

© 2020-2025 乐筑天下

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