Difference between revisions of "DB Snippets"

From Developer Documents
Jump to navigation Jump to search
(Created page with "== Finding all models in the project == <code> Session session = Simantics.getSession(); Layer0 L0 = Layer0.getInstance(session); SimulationResource SIMU = SimulationResource.ge...")
 
Line 1: Line 1:
 
== Finding all models in the project ==
 
== Finding all models in the project ==
  
<code>
+
Layer0 L0 = Layer0.getInstance(session);
Session session = Simantics.getSession();
+
SimulationResource SIMU = SimulationResource.getInstance(session);
Layer0 L0 = Layer0.getInstance(session);
+
Resource project = Simantics.getProject();
SimulationResource SIMU = SimulationResource.getInstance(session);
+
Collection&lt;Resource&gt; models = session.syncRequest(
Resource project = Simantics.getProject();
+
    new ObjectsWithType(project, L0.ConsistsOf, SIMU.Model)
Collection<Resource> models = session.syncRequest(
+
);
    new ObjectsWithType(project, L0.ConsistsOf, SIMU.Model)
 
);
 
</code>
 

Revision as of 08:02, 16 September 2011

Finding all models in the project

Layer0 L0 = Layer0.getInstance(session);
SimulationResource SIMU = SimulationResource.getInstance(session);
Resource project = Simantics.getProject();
Collection<Resource> models = session.syncRequest(
    new ObjectsWithType(project, L0.ConsistsOf, SIMU.Model)
);