ParallelGraphics Forums
VRMLPAD addins and macros
You are here: [Forums]::[Authoring Tools]::[VRMLPAD addins and macros]

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 - VRMLPAD addins and macros

Subject: little update for code.bas and another question
Sender: arjo.rozendaal@xs4all.nl 11.12.05 04:07

Hi,

I made a little update for the zerokiller in the code.bas file in the freeaddins
This one replaces values like 3.56789e-12 with a zero

Document.Range.ReplaceText "\d*e-\d*" , "0", vpMatchRegExp
Document.Range.ReplaceText "\d\.\d*e-\d*" , "0", vpMatchRegExp

I also tried the next one but doesn't work
Document.Range.ReplaceText "-\d*e-\d*" , "0", vpMatchRegExp
The "-" at the beginning does not have any influence
it still returns -0 instead of 0, why?

I've got another question that I would like to solve.
I know far too little of scripting to know the answer, so I really hope someone could help me with this one.
My 3d app saves boxes and spheres as vrml box and sphere objects but cylinders are saved ase indexedfacesets. I would like to turn them back into cylinders, so I thought I would name them like below and then use the "a" as radius and the "b" as height. How could I use these values to replace the "geometry IndexedFaceSet" with "geometry Cylinder" with the right values for radius and height.

DEF cylinder_a1_b3 Shape {
    appearance Appearance {
        material Material {
            diffuseColor 1 1 1
        }
    }
    geometry IndexedFaceSet {
<snip>

The only thing I reached so far is selecting the geometry Indexedfaceset and then calling the following script.
I stripped and altered this code from the geometry.bas file.
By inputting the values by hand the code is replace correctly but it would be better if this could be completely automatically.

Sub Cylinder
Set doc = Window.Documents.Active
rr = InputBox("Enter Radius:","Create Tube","1")
If rr = "" Then Exit Sub
On Error Resume Next
hh = InputBox("Enter Height:","Create Tube","5")
If hh = "" Then Exit Sub
rr = Replace(rr, ",", ".")
hh = Replace(hh, ",", ".")
nodestring = nodestring + "geometry Cylinder {" + vbCrLf
nodestring = nodestring + "    radius " + rr + vbCrLf
nodestring = nodestring + "    height " + hh + vbCrLf
nodestring = nodestring + "}" + vbCrLf
doc.Selection = nodestring
doc.Saved = False
End Sub

The thing I cannot reach is how to store the a and b values from the name into the rr and hh variables.

Arjo.

 


little update for code.bas and another question / arjo.rozendaal@xs4all.nl / 11.12.05 04:07
     Re: little update for code.bas and another questio / arjo.rozendaal@xs4all.nl / 2.01.06 04:23

Messages in thread: 2


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