[Paraview] name blocks or sets and export them in X3D files
Kristian Sons
kristian.sons at supporting.com
Thu Mar 11 06:36:07 EST 2010
Dear Pierre,
I skipped the ParaView list, cause it get's very X3D specific now.
You can name the shapes with the DEF attribute. This is not done by the
exporter as it has no access to names.
Some more tips how you could achieve the functionality you descriped:
If Xj3D supports the CAD profile, you could pack the shapes into a CADLayer
and give this Layer a name (i.e. via XSLT):
<CADLayer DEF="MyLayer" visible="true false">
<Shape DEF="Box">...</Shape>
<Shape DEF="Cone">...</Shape>
</CADLayer>
Then use the Java API to do something like this:
X3DScene scene = (X3DScene) browser.getExecutionContext();
X3DNode boxLayer = scene.getNamedNode("BoxLayer");
MFBool visibleArray = boxLayer.getField("visible");
visibleArray.setValue(...)
Actually I never worked with the Xj3D Java API, but I guess this should
work ;)
Best regards,
Kristian
On Thu, 11 Mar 2010 12:05:53 +0100, Pierre JUILLARD
<pierre.juillard at gmail.com> wrote:
> Dear Kristian,
>
> Thanks again for this most valuable answer.
>
> There is I guess a slight misunderstanding in the web3d forum. I do not
> whish specifically to focus on a switch function.
> I would like to keep the possibility to configure (in a specific
"selection
> frame") the set of objects to be displayed in a java applet using Xj3D
and
> stored in the X3D file:
> - it can be the box
> - it can be the cone
> - it can be both if both are selected
>
> My question was more to know if it does exist a way to differentiate
> objects
> in X3D, and how to identify them (how can we store the ID of these
> objects)?
> Then (back on ParaView and VTK!), can we set an ID in ParaView to each of
> the different objects so that it is possible to identify them in the X3D
> file and be able to "select" them in a X3D file?
>
> I have to study this problem more deeply (I am not an expert of X3D
> format),
> but I guess that using the X3D <Shape> you mention, it should be possible
> to
> store each object as different objects.
>
> I guess that even we don't have the possibility to name the objects, they
> are stored in X3D in the same order than they are read in ParaView.
>
> if in ParaView:
> 1 I read box.vtk
> 2 I read cone.vtk
> 3 I save them in X3D
>
> I will have in the X3D file:
> Shape 1
> (the box description)
> Shape 2
> (the cone description)
>
> So that in the end, if I keep track of what has been read in Paraview, I
> should be able to recognise what is selected by the user.
>
> I thank you again for your help and advices.
> Best regards,
>
>
> Pierre
>
>
>
>
>
>
> 2010/3/11 Kristian Sons <kristian.sons at supporting.com>
>
>>
>> Dear Pierre,
>>
>> I guess now I understood your intention and here some answers (I hope
>> this
>> is not too off topic for other ParaView users):
>>
>> - The X3D exporter just exports the results of the VTK pipeline you
>> configured using VTK
>> - So if you implement some kind of "Switch" by grouping two sources and
>> than extract one of them using VTK filters, this functionality will not
>> be
>> mapped to X3D, just the active result of the pipeline gets exported. It
>> would be possible to "emulate" the VTK pipeline to some degree using
X3D,
>> but this needs much more logic than the current exporter.
>> - Some of the functionalities (like naming the sources) is a ParaView
>> specific functionality. The X3D exporter has access to the VTK data
>> structure only, so you i.e. won't find them in the export
>>
>> So the answer from the Web3D forum thread is not wrong. To pick up your
>> example:
>> 1. Create the box and the cone.
>> 2. Export the scene to X3D. You will find three shapes. The first is the
>> center actor that is in the same renderer (you can deactivate this actor
>> in
>> View->Show Center). The two other shapes are the box and the cone.
>> 3. Surround the two shapes with a switch node and then you can choose
one
>> or the other to display using the whichChoice attribute.
>>
>> Best regards,
>> Kristian
>>
>> On Thu, 11 Mar 2010 09:56:38 +0100, Pierre JUILLARD
>> <pierre.juillard at gmail.com> wrote:
>> > Dear Kristian,
>> >
>> > I thank you for your answer.
>> > I know understand a bit better how it works.
>> >
>> > I was actually asking to guys of Web3D how should be managed a
>> "mutli-part"
>> > scene in X3D in this
>> > thread<http://www.web3d.org/message_boards/viewtopic.php?f=7&t=2084>,
>> > and I got the answer of using X3D <Switch> which I'm not sure is the
>> > correct
>> > answer.
>> >
>> > What you describe is interesting and I will have a deeper analysis of
>> > it.
>> >
>> > Thanks for you help.
>> > Best regards,
>> >
>> >
>> > Pierre
>> >
>> >
>> >
>> >
>> > 2010/3/11 Kristian Sons <kristian.sons at supporting.com>
>> >
>> >>
>> >> Hi Pierre,
>> >>
>> >> though Berk answered your questions already, Christophe Mouton from
>> >> EDF
>> >> asked me to add some details.
>> >> I contributed the rewrite of the X3D exporter and the binary X3D
>> exporter
>> >> on behalf of EDF.
>> >>
>> >> The X3D exporter is not aware of the composite data types of VTK. It
>> >> works
>> >> roughly like this:
>> >>
>> >> 1. Get all the actors from a vtkRenderWindow (it implements the
>> >> vtkExporter
>> >> interface)
>> >> 2. Each Actor is mapped to a X3D <Shape>
>> >> 3. Each vtkProperty/vtkTexture is mapped to a X3D <Appearance>,
>> >> <Material>,
>> >> <PixelTexture>
>> >> 4. Each geometry is either a vtkPolyData or is converted to
>> >> vtkPoylData
>> >> using the vtkGeometryFilter
>> >> 5. The vtkPolyData is mapped to X3D <IndexedFaceSet>, <LineSet>,
>> >> <PointSet>
>> >>
>> >> It's generally not a big task to add composite support to the
>> >> exporter,
>> >> the
>> >> Appearance could be reused using the USE/DEF semantic of X3D.
>> >>
>> >> Best regards,
>> >> Kristian
>> >>
>> >>
>> >>
>> >>
>>
More information about the ParaView
mailing list