ParallelGraphics Forums
Authoring Tools
You are here: [Forums]::[Authoring Tools]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
  Authoring Tools

Subject: Re: changing colors through automation
Sender: zeno@frontiernet.net 27.06.01 16:13
This works great..
<script language="VBScript">
Sub changeColorVBScript ()
CortonaX.Engine.Nodes
("hotScrew3").Fields
("diffuseColor")=Array(0.5,0,0)
End Sub
</script>

It just seems very easy to
change the SFColor values this
way. I also tried this:

function changeColorJS(){
c = CortonaX.Engine.Nodes
("hotScrew3").Fields
("diffuseColor");
c.Red = 1;
c.Value = Array(1, 0, 0);
b = CortonaX.Engine.CreateField
("SFColor")
b.Red = 1;
b.Green = 0.5;
b.Blue = 0.1;
c.Assign(b);
}

I couldn't get this to work.
I'm sure I'm doing something
wrong.

Perhaps I'll stick to the
VBScript way of changing single
value fields. I'm assuming you
can change all SF types this
way. I would like to know what
I did wrong though.

Which is prefered? javaScript
or VBScript. I've been doing
mostly javaScript being that's
what I've seen for examples.
It's a little tough to relate
the SDK documentation to
javaScript though. Would it be
easier to understand if I were
using VBScript? There are many
VB examples in the SDK. Can I
use this code when writing
VBScript? I've done some
javascript, some VBA and some
VB. I'd have to learn another
language if I shift to
VBScript, but it doesn't look
tough at all.

Pat

>>And I'm trying to change the
>>diffuse color to red via
>>automation in HTML. I would
>>have thought it should look
>>like this:
>>
>> CortonaX.Engine.Nodes
>>('stainless_mat').Fields
>>("diffuseColor")="1 0 0";
>>
>>But it doesn't work.
>>How do you change the color
of
>>a material node via
automation?
>>
>
>Yes. All component values
(vectors,
>colors, positions) in VRML
Automation
>presented as SafeArrays. You
can use
>VBScript's Array() function or
functions
>for SafeArrays from JavaScript.
>And you can change this values
by
>components.
>Examples:
>c = CortonaX.Engine.Nodes
>("stainless_mat").Fields
("diffuseColor");
>
>1) c.Red = 1;
>2) c.Value = Array(1, 0, 0)
>3) b =
CortonaX.Engine.CreateField
>("SFColor")
>b.Red = 1;
>b.Green = 0.5;
>b.Blue = 0.1;
>c.Assign(b);
>
>---------------------
>parker


 


changing colors through automation / zeno@frontiernet.net / 18.06.01 12:35
     Re: changing colors through automation / Mr.Parker / 18.06.01 13:16
         Re: changing colors through automation / zeno@frontiernet.net / 27.06.01 16:13
             Re: changing colors through automation / Mr.Parker / 28.06.01 00:21

Messages in thread: 4


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.