How to interact with a 3D viewer

Transferred from "tech.groups.yahoo.com/group/formsPlayer".

The 3DXML Player that I am using in the example can be downloaded from http://www.3ds.com/3/3dxml it is free to use. Furthermore it has a nice help file (.chp) that describes the available script method, parameters, and events.

I have created a little sample page. It has a button that does the functionality that I would like the "repeat" list to fire when the user clicks on a part in the list.

I have emailed Mark B. the sample, since there is now where to upload the code, and since I don"t have a public web-server.

Bjarke

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mark Birbeck's picture

New project available

There is now a project for this sample.

3D XML embedded in a web page

I followed the link to the project example but the embedded viewer didn't show up. Do you know how to embed a .3dxml into a web page? When I just use the 'embed' tags i can get the 3D XML Viewer to show up, but it won't load the .3dxml file. What other code do i need to include?

Mark,

Mark,
Did you have any luck making the 3DXML Player work with formsPlayer?

Bjarke

Mark Birbeck's picture

Links to Bjarke's files

Hi Bjarke,

Thanks for that. I've uploaded your files to our SVN repository:

http://svn.x-port.net/svn/public/samples/3d-xml/

For anyone who has formsPlayer and the 3D XML viewer installed (see above), they can just navigate to this to run Bjarke's code:

http://svn.x-port.net/svn/public/samples/3d-xml/PartsList.htm

The only change I made was to make the path to your instance data relative. The support files are:

http://svn.x-port.net/svn/public/samples/3d-xml/AC_Assemble.3dxml
http://svn.x-port.net/svn/public/samples/3d-xml/PartsList.XML

Now we have the files we'll take a look at how to get it working with fP.

3D XML in J2EE application

Hi,

I am in the process of developing a web application for tool management system.
I am trying to use 3DXML for providing the 3dimensional viewing experience to the user.
I tried embedding the 3DXML player in a HTML file and it worked.
But in actual implementation, i will get ot from Database and i will display it dynamically in a JSP page.
My application has physical 3Tier with Appserver and WebServer being physically different.
Can you suggest me a suitable implementation?

Regards,
Anand

Mark Birbeck's picture

Using inline functions with XPath

The solution to this problem does not revolve around events, but simply requires an inline function to be called from an XPath expression.

The first thing to do is slightly modify the selectItem subroutine to make it a function:

Function selectItem(sID)
  ' Select the right part in the 3DXML ActiveX control
  vbSelection.Empty
  vbSelection.Add Array("0", "1", sID)
  vbEWVIA.GetCurrentViewer().ReframeOnSelection
  selectItem = sID
End Function

It needs to be a function rather than a subroutine since to call this from an XPath expression we need to return a value. Other than that, the only thing we have changed here over Bjarke's original is that we pass the id value to the function rather than using DOM methods to obtain it from the instance data.

To make this function available to our XPath expressions, the following namespace must be added to the 'html' element:

xmlns:inline="http://www.formsplayer.com/inlineScript" 

Now we can use this function inside the repeat to select a part, like this:

<xforms:trigger>
  <xforms:label ref="@id" />
  <xforms:action ev:event="DOMActivate">
    <xforms:setvalue
     ref="instance('dataSelectedPart')/id"
     value="inline:selectItem(string(instance('dataPartsList')/Instance3D[index('rptPartsList')]/@id))" 
    />
  </xforms:action>
</xforms:trigger>

The index function gives us the number of the currently selected row in the repeat and this is used to retrieve the ID value.

Another way of doing this is with a simple drop-box, and then using the xforms-value-changed event as the indicator that the selectItem needs to be called:

<xforms:select1 ref="instance('dataSelectedPart')/id">
  <xforms:label>Choose a part:</xforms:label>
  <xforms:itemset nodeset="instance('dataPartsList')/Instance3D">
    <xforms:label ref="@name" />
    <xforms:value ref="@id" />
  </xforms:itemset>
  <xforms:action ev:event="xforms-value-changed">
    <xforms:setvalue ref="." value="inline:selectItem(string(.))" />
  </xforms:action>
</xforms:select1>

The example has been updated to incorporate these changes, and anyone that has installed the 3D player and formsPlayer should see these changes by simply navigating to the form URL.

This is excellent Thanks

This is excellent:-) Thanks for the help. I will now implement this in my work instruction solution.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.