Showing results for 
Search instead for 
Do you mean 
Reply

2D Graph Plotting

Hello,

 

I was wondering if there is any built-in or some external method by which I can visualize a 2d plot within the NX window?

 

Regards

Ratnadeep

2 REPLIES

Re: 2D Graph Plotting

 

If you have a set of data points and want to plot, CAE FTK is right for you.

 

CAE::FTK::BaseUnit *xBaseUnit = theSession->DataManager()->CreateArrayUnit(CAE::XyFunctionMeasureGeneral, CAE::XyFunctionUnitDisplacementMm);

 

xBaseUnit->SetMeasureName("Path Length");

CAE::FTK::BaseUnit *yBaseUnit = theSession->DataManager()->CreateArrayUnit(CAE::XyFunctionMeasureGeneral, CAE::XyFunctionUnitTemperatureC);

yBaseUnit->SetMeasureName("Temperature");

vector<CAE::FTK::BaseRecord *> lc_records(set your size here);

lc_tdpIter = lc_tempDropPaths.begin();

int lc_numPathSteps = numeric_limits<int>::max();

for(lc_i = 0; lc_tdpIter != lc_tempDropPaths.end(); ++lc_tdpIter, ++lc_i)

{

lc_path = (*lc_tdpIter).second;

if(lc_path == NULL)

continue;

sprintf(lc_legendName, lc_dropPath, (*lc_tdpIter).first);

CAE::FTK::ArrayRecord2D *arrayRecord2DPath = theSession->DataManager()->CreateArrayRecord2d(NULL, lc_legendName, (int)lc_path->size());

vector<double> xPathPoints((int)lc_path->size());

vector<double> yPathPoints((int)lc_path->size());

for(lc_j = 0; lc_j < lc_path->size(); ++lc_j)

{

xPathPoints[lc_j] = (*lc_path)[lc_j].first;

yPathPoints[lc_j] = (*lc_path)[lc_j].second;

}

arrayRecord2DPath->SetXCoordinatePoints(xPathPoints);

arrayRecord2DPath->SetYCoordinatePoints(yPathPoints);

arrayRecord2DPath->SetXCoordinateUnit(xBaseUnit);

arrayRecord2DPath->SetYCoordinateUnit(yBaseUnit);

lc_records[lc_i] = arrayRecord2DPath;

if(lc_numPathSteps > lc_path->size())

lc_numPathSteps = (int)lc_path->size();

}

CAE::Xyplot:Smiley Tonguelot *plot1;

plot1 = theSession->XYPlotManager()->PlotRecords(lc_records, 0);

Hope this helps

 

 

MAYAHTT
www.mayahtt.com

Re: 2D Graph Plotting

Mukund,

 

Thanks for responding so quickly. But I am relatively new to UGOpen, so I have some questions:

 

1) What is FTK?

2) In the code snippet, that you posted, where exactly are the data points being entered?

3) Since this is CAE, can we call it from modeling environment?