Jump to content

Numerical color values?


Recommended Posts

I'm trying to alter a VW script "setcolorweight" 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. Can anyone point me to a table with all the 5x color codes I'm supposed to use? Thanks!

-- Rich --

Link to comment

Rich -

Run "Create Color Chart" (Under Tools...Utilities in the Standard 13/08 WorkSpace). A color chart will be created with numbers in the color squares. Create the following script:

----------------------------------------

PROCEDURE Color;

VAR

r,g,b :LONGINT;

BEGIN

ColorIndexToRGB (0,r,g,b);

Message ('Red: ',r,' Green: ',g,' Blue: ',b);

END;

RUN (Color);

---------------------------------------

Replace the "0" in the ColorIndexToRGB line with the number of the color you're wanting. That will give you the RGB values, which is what VectorScript is wanting.

Make sense?

Link to comment

I'm afraid not. I've never had to work with a script before. So what happens when I put a "9" for the "0" in that script you show? How do I "run" a script? What happens then - some window pops up to tell me what the RBG values are?

I opened up the script in NotePad which shows this:

--------------------

MCVS ILine Gray 5?i??

! ???? 7?7?! ? ?6??6?

Miscellaneous? ! ,6?,6? ?? ? ? ?

? ! ?

??? ?? ! p T6?T6? ! ??? ? ! ,6?<? ??pt: P ! ???? ? ! ???? ? 4$??

x?? ? P PROCEDURE setcolorweightgrayfive;

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,5);

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

h:= NextSObj(h);

END;

END;

RUN(setcolorweightgrayfive);

---------------------

Which is similar to what the VW script editor shows... I don't know why there are all those strange characters though. Should I delete them? Or maybe the VW script editor intentionally hides them?

The help file for the editor says that it lissts "all procedures and functions available in the VectorScript language". I guess it missed the one I want to edit/use.

I'm thinking I can just adjust in the color numbers I want but I have no clue how scripts work. I would imagine that there'd be a table with these numbers somewhere. I can't find any by Googling the net.

-- Rich --

Link to comment

Rich -

A "9" gives you 41120, 41120, 42148. The values pop up in a message box.

Running the script is a matter of double-clicking it - either in a script palette or in the Resource Browser.

Scripts created from within VW can't be opened with Notepad. If you created yours using the Script Editor, you have to use that to edit them. If your script is drawing-specific (created from the Resource Browser), right-click on the script and choose "Edit."

As to a table of the numbers, I don't know of one. The closest thing is either the Utility command I mentioned or the Color Table in the VS Function Reference document - both of which will give you Color Index numbers (the latter if you're using stock colors).

Link to comment

I can't seem to find the script I created using your script above. When making it, it says that it'll be in the Vectorworks\12\Plug-ins folder but it's not there. I don't know why it'd be put there anyway as I have 12.5 (I looked there and it's not there either).

But I DID find a "Create Color Chart" script but when I try to run it I get an error: Line #1: MCVS

I have no clue what's going on. I've just talked to VW techhelp but they say that they don't know anything about scripting as it's not a "part" of VW.... and to repost my problem here under the "Script" section of this forum.

But I can't seem to find that section!!!

-- Rich --

Link to comment

Rich -

VectorScript Forum:

Look for the general heading here of "Software Customization." There is a VectorScript section underneath that. (http://techboard.nemetschek.net/ubbthreads/ubbthreads.php?ubb=postlist&Board=13&page=1)

Locale of your script:

If you're running Windows, check "C:\Documents and Settings\C. Andrew Dunning\Application Data\Nemetschek\VectorWorks\12\Plug-ins" (where "C. Andrew Dunning" is your user name. Newly-created scripts will end up there.

If I were you, instead of trying to create a menu command w. the code I posted, I'd create a document-specific script. I think you'd find that a bit easier to manage if this is your first go-round w. scripting. To do that, click the bottom gray "play (arrow) button toward the top of the Resource Browser. Select "New Resource" and then "VectorScript..." Select the palette where you'd your script to live. Give the script a name in the next dialog. Once you've done that, an editor window opens up. Input the code there and click "OK." The script will then be ready to run from the palette you chose earlier.

Color Chart script:

I don't remember if that is a stock menu item or not. (Anyone else know?) If not, I have no idea where I got it. One of those things I've grown to take for granted over the years.

Good luck...

Link to comment
VectorScript Forum:

Look for the general heading here of "Software Customization." There is a VectorScript section underneath that. (http://techboard.nemetschek.net/ubbthreads/ubbthreads.php?ubb=postlist&Board=13&page=1)

Thanks - I'll query over there!

Locale of your script:

If you're running Windows, check "C:\Documents and Settings\C. Andrew Dunning\Application Data\Nemetschek\VectorWorks\12\Plug-ins" (where "C. Andrew Dunning" is your user name. Newly-created scripts will end up there.

Ah! Now that I'm trying to make one again I see in the editor window that that's where they'll wind up. Pretty squirrelly.
If I were you, instead of trying to create a menu command w. the code I posted, I'd create a document-specific script. I think you'd find that a bit easier to manage if this is your first go-round w. scripting.
I really don't think I'm capable. I've never done coding and don't even know what a "document-specific script" is (only works in on one VW file?). I just want a script that I've been using for years to *work* (works fine in v12 but not v12.5) and to make a couple more similar to it.

Right now I have a menu command (if that's the right word?) and hot key that I've made my workspace editor with to access the script file. When doing that, whatever lines I have selected turn the color and lineweight I want. I don't know why the script doesn't work in v12.5 which is one problem... and the other: I'd like to adjust the lineweights in the script and add a couple more scripts for different color/weights.

Color Chart script:

I don't remember if that is a stock menu item or not. (Anyone else know?) If not, I have no idea where I got it. One of those things I've grown to take for granted over the years.

The "Create Color Chart" is a script that lives in the Plug-ins directory which came with both v12 and v12.5. Unfortunately it doesn't work. The error says: Line #1: MCVS

Actually - I've just now tried to open several files. They all don't open. Most have the same error message. Maybe there's something wrong with my VW installation?

Another strange thing I noticed is that when I look for the VS files to run, I don't SEE ANY as all VS extensions which defaults seem to be vss, xxt, mpc, and txt don't show. But when I switch the type to "All Files", I see the vso, vsm... which ARE VS files? Strange. I just don't understand.

Good luck...
Thanks. I've got a feeling I'll be needing a lot of it. I'll try reposting this problem over on the VS forum. But please don't let that from continuing to help me out! Thanks!

-- 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...