# LabVIEW

cancel
Showing results for
Did you mean:

## 3d plot sphere with vectors

Hi, I'm trying to create a 3d shpere [i've doen that bit] with a number of vector lines out from the plot within the 3d enviroment,

can this be done by adding aditional plots, if so how can they be done??

The vector lines i'm trying to make will be controlled by a source, and destination coordiantes defined by:  {theta, phi, r} - in sherical coordinates,

also can they be plotted as just lines, and idealy with arrows on the destination end??

Help!!

VI attatched, any help apreciated!!

Message 1 of 21
(7,439 Views)

## Re: 3d plot sphere with vectors

Dear John,The function you are looking for is the 3D curve.vi – you can specify 3 separate coordinates for x, y, z to form a vector. How you specify these coordinates is up to you – I imagine that, with a little thought, you would have no problems specifying these radially.Another important function, that is rather easy to miss, is the setplots.vi. By default you can only make a single plot on a 3D graph. But, using the setplots function, you can add as many plots as you require.The only last thing to remember is that you must specify the plot number when you are changing properties of a specific plot.Please see the attached code for further help.It sounds like you are creating quite an exciting application! Best of luck to you!!Kind regards,
Rich Roberts
Senior Marketing Engineer, National Instruments
Message 2 of 21
(7,423 Views)

## Re: 3d plot sphere with vectors

You can choose the coordinates system used when plotting. See here.

Ben

Message Edited by Ben on 08-14-2008 07:46 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 21
(7,420 Views)

## Re: 3d plot sphere with vectors

Hi i understood how to carry out corrdinate conversion, it was the format i was having issue with.

I'll givwe reply 1 a try, many thanks

Message 4 of 21
(7,398 Views)

## Re: 3d plot sphere with vectors

Hi could you convert the labview edition from 8.5 to 8.2 for me??

Message 5 of 21
(7,397 Views)

## Re: 3d plot sphere with vectors

Apologies John, I made an incorrect assumption.

Please find the attached 8.2 code.

Rich Roberts
Senior Marketing Engineer, National Instruments
Message 6 of 21
(7,381 Views)

## Re: 3d plot sphere with vectors

no my mistake i didn't say which version i was using!
Message 7 of 21
(7,377 Views)

## Re: 3d plot sphere with vectors

One last thing, i'd like to make the vi accept a number of vectors to plot, i've tried to do this using a for loop, and attatching the plot number to the plot number +1, but this seems to give one plots and the ball and then an error, if i set it to +2 it gives me both lines but no balls.

I'm a touch confused.

help is again very much apreciated!

see attatched!

Message 8 of 21
(7,371 Views)

## Re: 3d plot sphere with vectors

Ah found it, there is a 'number of plots' part that has to include the ball as well as the lines

Message 9 of 21
(7,370 Views)

## Re: 3d plot sphere with vectors

Great news! I am guessing that, before you resolved your own issue, you were over writing the sphere plot. So, by adding two to the for loop iteration rather than one you are able to avoid this (i.e. during the first run of the for loop, you are writing to plot number 2, rather than overwriting the sphere in plot number 1).

John, for the sake of your fellow developers, could you please post your new and improved vi on here. That way, if another developer stumbles on to this thread they will have a prebuilt piece of code.