Subscribe Bookmark RSS Feed

How to save result as jpeg for Fit Model in JMP Automation?

frank_tung

New Contributor

Joined:

May 11, 2016

Hello Sir,

I am downloading JMP12 and testing the automation function. I copy the C# JMPStarter project from \SAS\JMPSW\12\Samples\Automation\Visual C# Sample.

I can save result as jpeg for Basic\Distribution and Graph\Control Chart but failed for Model\Fit Model.

Does anyone try it and could share your experiment?

Here is the code for Fit Model

private void fitModelButton_Click(object sender, System.EventArgs e)

{

  startJMP();

  fmDoc = myJMP.OpenDocument(jmpSampleDataDir + "tiretread.jmp");

  fm = fmDoc.CreateFitModel();

  fm.LaunchAddY("abrasion");

  fm.LaunchAddY("modulus");

  fm.LaunchAddY("elong");

  fm.LaunchAddY("hardness");

  fm.LaunchAddToEffectList("silica");

  fm.LaunchAddToEffectList("silane");

  fm.LaunchAddToEffectList("sulfur");

  fm.LaunchAddMacroEffect(JMP.fitModelMacroEffectConstants.fitModelEffectResponseSurface);

  fm.LaunchSpecifyIntercept(true);

  fm.LaunchSpecifyEmphasis(JMP.fitModelEmphasisConstants.fitModelEmphasisScreening);

  fm.LaunchSpecifyPersonality(JMP.fitModelPersonalityConstants.fitModelPerLS);

  fls = (JMP.FitLeastSquares) fm.Launch();

  fls.ContourProfiler(true);

  resp = fls.GetResponse("abrasion");

  resp.SaveColumns(JMP.fitModelSaveColumnConstants.fitModelSavePredFormula);

  resp.RowDiagnostics(JMP.fitModelRowDiagConstants.fitModelRDPress, true);

  resp = fls.GetResponse("modulus");

  resp.SaveColumns(JMP.fitModelSaveColumnConstants.fitModelSavePredFormula);

  resp = fls.GetResponse("elong");

  resp.SaveColumns(JMP.fitModelSaveColumnConstants.fitModelSavePredFormula);

  resp = fls.GetResponse("hardness");

  resp.SaveColumns(JMP.fitModelSaveColumnConstants.fitModelSavePredFormula);

  //Try to save Graphic Output

  int h = fls.GetGraphicItemByType("picture box", 1);                       

  fls.CopyGraphicItem(h);

  fls.SaveGraphicOutputAs(@"D:\FM.JPG", JMP.jmpGraphicsFormats.jmpJPEG);                     

}

Thank you.

Frank

2 REPLIES
briancorcoran

Joined:

Jun 23, 2011

Hi Frank,

Normally you would take the handle produced by GetGraphicItemByType and call SaveGraphicItem, passing the handle in.  Unfortunately, it appears that there is a bug with the Fit Response type output where the automation methods that take a graphic handle will fail.  I have created a tracking defect for this, and it will get fixed in JMP 13.0.  I'm sorry to say, though, that I don't know of any other workaround right now.

Brian Corcoran

JMP Development

frank_tung

New Contributor

Joined:

May 11, 2016

Hi Brian,

Thank you for your information. I will try it when JMP 13 is available.

Frank