Jump to content
Developer Wiki and Function Reference Links ×

Numerical color values?


RMorse

Recommended Posts

I'm at it again.... I can't seem to figure out how to make a script that will change color and lineweight. I tried a few months ago and gave up to do a miserable kludge.

Now I've got a new project and would like to start RIGHT!

The issue is that I'm trying to alter a VW script which sets a line color an weight and can't figure out what the numerical colors are. The color table is of no help as it doesn't seem to correspond with the archiac (?) 5x numerical system. What looks like "medium gray" it calls "9" and yet is referred to as 41120,41120,42148 in the script.

I'm used to the hexidecimal #999999 or 153,153,153 designations for that particular color. Here is the dialogue from the last time I inquired about this.

Things seem to wind up that I had to run a script called "Create Color Chart" but for some reason that doesn't "run". I get an error message instead. So I can't even get to square one.

Being that this may be the only time I'll ever have to deal with this, perhaps one of you folks can just tell me what numbers these colors are:

Gray: 3rd row down, 2nd from the right end

Gold: 4th row down, 5th from the right end

Red: 2nd row down, 1st form the left end

Purple: 6th row down, 7th from the left end

Blue: 3rd row down, 1st from the left end

Black: 1st row, 2nd from the left end

Or help me alter the scripts I have?

-- Rich --

Link to comment

In attachment is a little pio that can help you. It will draw a rectangle. When you write the color index in the OIP, the rectangles fill will become that color and the RGB value will be visible in the OIP.

The Color Index you can find in Vector Script Appendix E.

But if you want, here are the values:

Gray (46): (52428,52428,52428)

Gold (59): (52428,48087,26214)

Red (16): (56797,0,0)

Purple (86): (52428,21845,65535)

Blue (32): (0,0,56797)

Black (255): (0,0,0)

Edited by maarten.
Link to comment

What is a pio? The OIP is Object Information Pallet? If so, what field do I write it in? But I can't get that far as your attachment link doesn't seem to work. All I get it an error: "The page cannot be found". It'd be so good to be able to have full color control!

Thanks for pointing me to that color chart and for the value numbers!

At least I was able to adjust my script with them but now for some reason I can't seem to implement them. I added them to my workspace and they don't do anything. The previous hot-keys remain active rather than activating the new script files.

Suggestions?

-- Rich --

Link to comment

PIO is a Plug In Object. It is a a scripted tool or menu command.

Here is my take on this. It is just a script rather than a PIO. Draw an object with the color you want and leave it selected. Run the script. It will put all of the code needed to set the drawing defaults to match the attributes of the object. It only shows the first line in the Dialog Box, but copy and paste it into something else (a VW Text block, the VectorScript Editor, your word processor) and you will see all the code. It is set up the way it is as that was the only way I could find to have the text be copyable.

I wrote this to update scripts for a client of mine that were based on the old position in the color chart mode. VW2008 now used RGB values for all of the color information. The Custom Tool functions have not yet been updated to include teh RGB values.

Do you need help with the script to set the line weight and color? Or just to Get the RGB (Red, Green, Blue) values? This post should get you the RGB.

***************

Procedure GetAttributes;

{Gets the current attributes of the first selected object}

{and puts a string in a text dialog box so you can copy}

{and paste the code to set those attributes as the drawing}

{defaults. Written to overcome a bug in the VW2008 Custom Tool}

{code that used the old color index rather than RGB values}

{April 13, 2008}

{? 2008, Coviana, Inc - Pat Stanford pat@coviana.com}

{Licensed under the GNU Lesser General Public License}

var H1: Handle;

R1,R2,R3,R4:LongInt;

G1,G2,G3,G4:LongInt;

B1,B2,B3,B4:LongInt;

FP,PP:LongInt;

S1,S2,S3,S4,S5,S6:String;

Begin

H1:=FSActLayer;

GetPenFore(H1,R1,G1,B1);

GetPenBack(H1,R2,G2,B2);

GetFillFore(H1,R3,G3,B3);

GetFillBack(H1,R4,G4,B4);

FP:=GetFPat(H1);

PP:=FPenPat;

S1:=Concat('PenFore(',R1,',',G1,',',B1,');');

S2:=Concat('PenBack(',R2,',',G2,',',B2,');');

S3:=Concat('FillFore(',R3,',',G3,',',B3,');');

S4:=Concat('FillBack(',R4,',',G4,',',B4,');');

S5:=Concat('PenPat(',PP,');');

S6:=Concat('FillPat(',FP,');');

S1:=StrDialog('Copy',Concat(S1,Chr(13),S2,Chr(13),S5,Chr(13),S3,Chr(13),S4,Chr(13),S6));

End;

Run(GetAttributes);

***************

Pat

Link to comment
PIO is a Plug In Object. It is a scripted tool or menu command.
Is a script a PIO? I'm confused as I've been trying to run scripts by going to Tools/Scripts/Run VectorScript... which opens up a window to select a file but there are NO *.vss, *.xxt, *.mpc, *.txt... files in the Plug-Ins directory.
Draw an object with the color you want and leave it selected. Run the script.
What script? The code you posted? I really have no idea how to make that into a script. I tried using the VW plug-in editor but after copying the code in I can't find it to run it. Where does it save those things?

It will put all of the code needed to set the drawing defaults to match the attributes of the object. It only shows the first line in the Dialog Box, but copy and paste it into something else (a VW Text block, the VectorScript Editor, your word processor) and you will see all the code. It is set up the way it is as that was the only way I could find to have the text be copyable.
And then what do you do with that? Make another script of it?
I wrote this to update scripts for a client of mine that were based on the old position in the color chart mode. VW2008 now used RGB values for all of the color information. The Custom Tool functions have not yet been updated to include teh RGB values.
I'm using VW 12.0 as 12.5 messes up my fonts and doesn't allow any of my scripts or hot-keys to function. There's no way I'm going to get 2008 as it will take me forever to configure things to the point that it is as functional as my 12.0 is. I tried so hard with 12.5 and became totally frustrated. I'm not stupid... and I've been using VW since MiniCad days (about 12 years).
Do you need help with the script to set the line weight and color? Or just to Get the RGB (Red, Green, Blue) values? This post should get you the RGB.
Yes, I need help - ideally with the script. The RGB values are just a stepping stone in getting there... but I can't seem to get even that far.

I'm trying to change a script slightly what already works (my drafter made it about 10 years ago), which is that I have hot-keys Ctrl+Shift+3, Ctrl+Shift+4, Ctrl+Shift+5, Ctrl+Shift+6, Ctrl+Shift+7, Ctrl+Shift+8, such that whatever is selected turns into the line color and weight I want it/them to. The change is that I want the line colors and weights to be a little different than I've been using for the past several years.

-- Rich --

Link to comment
PIO is a Plug In Object. It is a scripted tool or menu command.
Is a script a PIO? I'm confused as I've been trying to run scripts by going to Tools/Scripts/Run VectorScript... which opens up a window to select a file but there are NO *.vss, *.xxt, *.mpc, *.txt... files in the Plug-Ins directory.

No, the script I sent is not a PIO. It is a basic vectorscript. Go to the Resource Browser and from the bottom pulldown triangle, select New Vectorscript in "you file name here". First a dialog box opens and asks for what Script Palette to put it in. I usually name it Scripts. Then a dialog box asks for the name of the script. YOu can call it anything you want. I call this one Get Attributes. Then a blank VectorScript editor document opens. Paste the script I sent in there and click OK (selecte everything between the ******** lines.) To run the script double click it in the Scripts Palette.

It will put all of the code needed to set the drawing defaults to match the attributes of the object. It only shows the first line in the Dialog Box, but copy and paste it into something else (a VW Text block, the VectorScript Editor, your word processor) and you will see all the code. It is set up the way it is as that was the only way I could find to have the text be copyable.
And then what do you do with that? Make another script of it?

Yes, if you want to. But what I am suggesting is just to use it to get the RGB values you need to edit the scripts you already have.

PIO I wrote this to update scripts for a client of mine that were based on the old position in the color chart mode. VW2008 now used RGB values for all of the color information. The Custom Tool functions have not yet been updated to include teh RGB values.
I'm using VW 12.0 as 12.5 messes up my fonts and doesn't allow any of my scripts or hot-keys to function. There's no way I'm going to get 2008 as it will take me forever to configure things to the point that it is as functional as my 12.0 is. I tried so hard with 12.5 and became totally frustrated. I'm not stupid... and I've been using VW since MiniCad days (about 12 years).

I'm not suggesting this is easy. Scripting is a challenging task. That is why there are not a lot of us doing it. I think I am getting a better idea of what you are really trying to do now.

PIO Do you need help with the script to set the line weight and color? Or just to Get the RGB (Red, Green, Blue) values? This post should get you the RGB.
Yes, I need help - ideally with the script. The RGB values are just a stepping stone in getting there... but I can't seem to get even that far.

I'm trying to change a script slightly what already works (my drafter made it about 10 years ago), which is that I have hot-keys Ctrl+Shift+3, Ctrl+Shift+4, Ctrl+Shift+5, Ctrl+Shift+6, Ctrl+Shift+7, Ctrl+Shift+8, such that whatever is selected turns into the line color and weight I want it/them to. The change is that I want the line colors and weights to be a little different than I've been using for the past several years.

Based on the new information you included in this mail, primarily that you have keyboard shortcuts assigned to your "scripts" that tells me that they are not just scripts, but rather PIOs. The underlying concept is the same, but how you do what you want depends on which they are.

Since they are PIOs, we need to figure out what kind of PIO and take a look at the script code.

My guess is that they are Menu commands based on the keystrokes that call them up. That means that they should show up in your menus somewhere. Take a look at the menus and find the exact name that one of them is called. Then go into the VectorScript Plug-In Editor and locate the file with the same name in the top box and select it. Then click the Script... button. You should see something that looks kind of like the script I sent you. Copy that out and paste it into a message here and I can take a look and see what needs to be done.

I don't know about the font problems, but we should be able to get your script transfered across so you can upgrade to at least VW12.5 and then on to VW2008 if you want.

Pat

Edited by Pat Stanford
Link to comment
No, the script I sent is not a PIO. It is a basic vectorscript.

I guess I got confused as I don't know the difference as my PIO or script (I still don't know what it is) lives in the Plug-Ins folder and is accessible with the VectorScript editor.

Go to the Resource Browser and from the bottom pulldown triangle, select New Vectorscript in "you file name here". First a dialog box opens and asks for what Script Palette to put it in. I usually name it Scripts. Then a dialog box asks for the name of the script. YOu can call it anything you want. I call this one Get Attributes. Then a blank VectorScript editor document opens. Paste the script I sent in there and click OK (selecte everything between the ******** lines.) To run the script double click it in the Scripts Palette.

Great! I was now able to make that script and have it tell me what attributes my lines have. Strange thing though - I can see what the line colornumbers are... but I don't understand why they have different FillFore and FillBack numbers.

Based on the new information you included in this mail, primarily that you have keyboard shortcuts assigned to your "scripts" that tells me that they are not just scripts, but rather PIOs. The underlying concept is the same, but how you do what you want depends on which they are.

Since they are PIOs, we need to figure out what kind of PIO and take a look at the script code.

My guess is that they are Menu commands based on the keystrokes that call them up. That means that they should show up in your menus somewhere. Take a look at the menus and find the exact name that one of them is called. Then go into the VectorScript Plug-In Editor and locate the file with the same name in the top box and select it. Then click the Script... button. You should see something that looks kind of like the script I sent you. Copy that out and paste it into a message here and I can take a look and see what needs to be done.

That all makes sense. Here's one of them:

*************************************

PROCEDURE setcolorweightgrayfour;

VAR

h :HANDLE;

BEGIN

{ gets a handle to the first selected object on the layer }

h:= FSActLayer;

IF FSActlayer = NIL Then Penfore(41120,41120,42148);

IF FSActlayer = NIL Then Pensize (4);

{ while you have a valid handle to an object, perform the operation }

WHILE h <> NIL DO BEGIN

SetPenFore(h,41120,41120,42148);

SetLW(h,4);

{ get a handle to the next selected object after the current one }

h:= NextSObj(h);

END;

END;

RUN(setcolorweightgrayfour);

*************************************

I hadn't realized that I can edit it there. I've been trying to alter the code by using Notepad as that's what comes up when I doubleclick on the filename. Each of these scripts/PIOs have lots of extra strange characters in them with Notepad and are a bit different for some reason.

So now I've just altered the scripts (saved as with a new name) with the VS editor and changed the workspace to make my old hotkeys trigger the new scripts (what ARE they called?) but for some reason it didn't "take". When I use my hotkeys, selected objects still change as they used to, not as the new commands.

And now I have an additional problem: the change changes the colors to the "old" colors - AND - the lineweights change to be very different from what I had them previously (or newly). Very strange. Any idea what's going on there? Why won't the workspace recognise my new commands and why are the old ones acting differently?

I don't know about the font problems, but we should be able to get your script transfered across so you can upgrade to at least VW12.5 and then on to VW2008 if you want.

Getting the linecolor/weight thing to work would be great.

The font problem is that the font I've always used (MrHand) and with 12.5 its linewrap capability is gone. It wraps wherever the textbox ends whether in the middle of a word or not. And on top of that, even though I see text on the monitor, when it prints it only prints out rows of little squares. Strange.

VW says they did something different to the font compatibility stuff when going to 12.5 which makes older fonts not work. So I contacted the people I got my architectural font package from (which went through several ownerships since I first bought it in 1994)... of course the current owners don't know anything about how the fonts were made or updated. I ended up buying the current version of them which works fine with 12.5 when I create new drawings (and text) but anything with previous MrHand text (including Word docs, spreadsheets, etc.) are total garbage.

I don't know what do about it. For the moment I've put the text problem on hold and have been doing all my work in 12.0. I'm thinking that I might be able to get around this problem by renaming the new text and using it for 12.5 for new jobs and leaving the old version in place so that I can access all my other work in 12.0.

-- Rich --

Link to comment
Great! I was now able to make that script and have it tell me what attributes my lines have. Strange thing though - I can see what the line colornumbers are... but I don't understand why they have different FillFore and FillBack numbers.

You can apply patterns to lines (both single lines and the lines at the edges of objects) The Fore and Back let you set different colors for the parts of the patterns. If you are just using single color lines, then the Back numbers don't matter.

That all makes sense. Here's one of them:

*************************************

PROCEDURE setcolorweightgrayfour;

VAR

h :HANDLE;

BEGIN

{ gets a handle to the first selected object on the layer }

h:= FSActLayer;

IF FSActlayer = NIL Then Penfore(41120,41120,42148);

IF FSActlayer = NIL Then Pensize (4);

{ while you have a valid handle to an object, perform the operation }

WHILE h <> NIL DO BEGIN

SetPenFore(h,41120,41120,42148);

SetLW(h,4);

{ get a handle to the next selected object after the current one }

h:= NextSObj(h);

END;

END;

RUN(setcolorweightgrayfour);

*************************************

OK, what this is doing is checking to see if anything is selected. If nothing is selected, then it is setting the file defaults to the color and lineweight specified (in the If FSActLayer = NIL lines). Otherwise, it is stepping through all of the selected objects and setting the line color (PenFore) and lineweight to the color and thickness specified.

I hadn't realized that I can edit it there. I've been trying to alter the code by using Notepad as that's what comes up when I doubleclick on the filename. Each of these scripts/PIOs have lots of extra strange characters in them with Notepad and are a bit different for some reason.

You never want to edit any of the scripts in anything other than the VectorScript Plug-In Editor. There is special data (those "extra stange characters") stored in the file that make them work. Editing in any other program will mess them up and make them not work.

So now I've just altered the scripts (saved as with a new name) with the VS editor and changed the workspace to make my old hotkeys trigger the new scripts (what ARE they called?) but for some reason it didn't "take". When I use my hotkeys, selected objects still change as they used to, not as the new commands.

They are called Plug-Ins or Plug-In Menu Items. (Tools are called Plug-In Tools).

I don't know what is happening with your workspace editor. Once you have the renamed/edited Plug-In showing up in the Plug-In Editor, you should be able to assign a keyboard shortcut to it. Are you sure your edited the "new/renamed" one and not the original one?

And now I have an additional problem: the change changes the colors to the "old" colors - AND - the lineweights change to be very different from what I had them previously (or newly). Very strange. Any idea what's going on there? Why won't the workspace recognise my new commands and why are the old ones acting differently?

The LineWeight must be set in Mils (1/1000 inch). If you are trying to use any other unit, it will end up being wrong.

If you can't get it, let me know and I will send you an edited PIO to put in your workspace and see if you can attached a shortcut to it.

Pat

Link to comment
You never want to edit any of the scripts in anything other than the VectorScript Plug-In Editor. There is special data (those "extra stange characters") stored in the file that make them work. Editing in any other program will mess them up and make them not work.

I didn't know that. I guess I'm used to editing other code (like webpages) with Notepad.

So now I've just altered the scripts (saved as with a new name) with the VS editor and changed the workspace to make my old hotkeys trigger the new scripts but for some reason it didn't "take". When I use my hotkeys, selected objects still change as they used to, not as the new commands.
I don't know what is happening with your workspace editor. Once you have the renamed/edited Plug-In showing up in the Plug-In Editor, you should be able to assign a keyboard shortcut to it. Are you sure your edited the "new/renamed" one and not the original one?

I ended up calling VW on that one. Turns out that VW doesn't "see" custom scripts and plug-ins in its Plug-Ins directory (Program Files/Vectorworks/...). It looks for them in another Plug-Ins directory (C:/Documents and Settings/[name}/Application Data/Nemetschek...). I was creating copies to alter and placing them in the wrong directory.

And now I have an additional problem: the change changes the colors to the "old" colors - AND - the lineweights change to be very different from what I had them previously (or newly). Very strange.
The LineWeight must be set in Mils (1/1000 inch). If you are trying to use any other unit, it will end up being wrong.

Yup you nailed that one down. Setting ALL the related things to Mils fixed it.

Now everything seems to be working the way I want it too! Thanks so much for your help and patience!

-- Rich --

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...