A little help if possible (Ch
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. It appears that you'll have to dig into a LayerTableRecord's Extension Dictionary's XRecord for this.
Cheers
Thank you, just what I didn't want to hear Yeah, sorry... I got hit up for something, and posted quickly... Try this:
(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)) You could use a script, at least what I understand to be a script (LT mentality)
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. 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. Don't know where I got this but use it quite often.
(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)) 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. im running a script
^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.
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
页:
[1]