The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to check existence and use objects?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
klunz Posted - 09/18/2007 : 08:22:10 AM
Origin Version (Select Help-->About Origin): 7.5G SR6
Operating System: XP

Hello again,

I´ve got the following Problem:
I have a skript that is applied to only one Set of Data at a Time. In the process, the curve "kurveDaten" is drawn to the GraphLayer "graphSchicht" on the GraphPage "graphDaten".

What I would like to do now is the following:
If the skript is run again and applied to another Set of Data, and the GraphPage from the previous Dataset is still present (hence "exists") it should draw the new Curve in the same GraphPage, on the same Layer.

So it should go something like:
Start Skript -> ... ->Check if GraphPage "graphDaten" is already present -> if so, draw to same Graphpage, if not create GraphPage and draw onthere.

So far my code looks like this, but if i run it with the GraphPage already present it simply creates a new one called "graphDaten1".

GraphPage graphDaten;
bool ExistenzG = graphDaten.Create("Daten"); // Graph erzeugen
graphDaten.Rename("Graph Datensatz");
Curve kurveDaten(tabelleDaten,0,1); // Kurve definieren
GraphLayer graphSchicht = graphDaten.Layers(); // Schicht im Graph erzeugen
int Plot = graphSchicht.AddPlot(kurveDaten, IDM_PLOT_LINE); // Kurve auf Schicht zeichnen


My Problem is, that I just cant find anything really useful to check if something that wasnt created within the skript and is therefore unknown to the skript already exists and then give this already existing "thing" a useable name.

I hope my description is understandable, already thanks a lot for your help.

Greetings
Tobi
2   L A T E S T    R E P L I E S    (Newest First)
klunz Posted - 09/20/2007 : 09:44:44 AM
Thank you very much, as always, that did it

Greetings
Tobi
Mike Buess Posted - 09/18/2007 : 09:05:58 AM
Hi Tobi,

This will work...
	GraphPage graphDaten("GraphDatensatz");
if( !graphDaten ) // if graph page does not exist
{
graphDaten.Create("Daten");
graphDaten.Rename("GraphDatensatz");
}
GraphLayer graphSchicht = graphDaten.Layers();
Curve kurveDaten(tabelleDaten,0,1);
string kurveName = kurveDaten.GetName(); // name of curve
DataPlot kurvePlot(graphSchicht.DataPlots(kurveName));
if( !kurvePlot ) // if data plot does not exist
graphSchicht.AddPlot(kurveDaten, IDM_PLOT_LINE);
graphSchicht.Rescale();


Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000