Search in sources :

Example 26 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class RootModel method mergeAllControlPanels.

public void mergeAllControlPanels(boolean combine) {
    JFrame frame = getMainFrame();
    if (frame == null) {
        // ArtiSynth is running in batch mode, so do nothing
        return;
    }
    if (myControlPanelsFrame == null) {
        createControlPanelsFrame();
    }
    if (!myControlPanels.isEmpty()) {
        for (ControlPanel panel : myControlPanels) {
            Container contentPane = panel.getFrame().getContentPane();
            if (combine) {
                myControlPanelTabs.addTab(panel.getFrame().getTitle(), contentPane);
            } else {
                panel.getFrame().setContentPane(contentPane);
            }
            panel.setVisible(!combine);
        }
        myControlPanelsFrame.pack();
        if (myControlPanelTabs.getTabCount() == 0) {
            myControlPanelsFrame.setVisible(false);
        } else if (!myControlPanelsFrame.isVisible()) {
            Point loc = frame.getLocation();
            myControlPanelsFrame.setLocation(loc.x + frame.getWidth(), loc.y);
            myControlPanelsFrame.setVisible(true);
        }
    }
}
Also used : Container(java.awt.Container) JFrame(javax.swing.JFrame) ControlPanel(artisynth.core.gui.ControlPanel) Point(java.awt.Point) WayPoint(artisynth.core.probes.WayPoint)

Example 27 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class PointModel method attach.

@Override
public void attach(DriverInterface driver) {
    super.attach(driver);
    if (getControlPanels().size() == 0) {
        ControlPanel panel = new ControlPanel("activations", "");
        for (AxialSpring s : model.axialSprings()) {
            if (s instanceof Muscle) {
                Muscle m = (Muscle) s;
                String name = (m.getName() == null ? "m" + m.getNumber() : m.getName().toUpperCase());
                panel.addWidget(name, m, "excitation", 0.0, 1.0);
            }
        }
        addControlPanel(panel);
    }
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) Muscle(artisynth.core.mechmodels.Muscle) AxialSpring(artisynth.core.mechmodels.AxialSpring)

Example 28 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class FemFrictionBeam method build.

public void build(String[] args) {
    double feml = 0.1;
    double femw = 0.05;
    double plateh = 0.01;
    myMech = new MechModel("mech");
    myFem = FemFactory.createHexGrid(null, feml, femw, femw, 6, 3, 3);
    myFem.setName("fem");
    myFem.setDensity(1000);
    myMech.addModel(myFem);
    myPlate = RigidBody.createBox("plate", 2 * feml, feml, plateh, 1000);
    myMech.addRigidBody(myPlate);
    myPlate.setDynamic(false);
    myPlate.setPose(new RigidTransform3d(0, 0, -(femw + plateh) / 2));
    RenderProps.setPointStyle(myFem, Renderer.PointStyle.SPHERE);
    RenderProps.setPointRadius(myFem, 0.001);
    RenderProps.setPointColor(myFem, Color.GREEN);
    myMech.setCollisionBehavior(myFem, myPlate, true, myMu);
    myMech.transformGeometry(new RigidTransform3d(0, 0, 0, 0, 1, 0, Math.toRadians(myAngle)));
    addModel(myMech);
    ControlPanel panel = new ControlPanel("controls");
    panel.addWidget(this, "friction");
    panel.addWidget(this, "angle");
    panel.addWidget(myMech, "integrator");
    panel.addWidget(myMech, "maxStepSize");
    addControlPanel(panel);
    Main.getMain().arrangeControlPanels(this);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel)

Example 29 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class FemMuscleArm method addControlPanel.

public void addControlPanel() {
    panel = new ControlPanel("Muscle Control", "");
    panel.addWidget("Activation", model, "models/muscle:excitation", 0.0, 1.0);
    panel.addWidget("Muscle-Arm Collision", this, "collisions");
    addControlPanel(panel);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel)

Example 30 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class HydrostatModel method createBundlesPanel.

public void createBundlesPanel(String[] names) {
    bundlesPanel = new ControlPanel("Bundles", "LiveUpdate");
    for (int i = 0; i < names.length; i++) {
        LabeledComponentBase c = bundlesPanel.addWidget(names[i], this, "bundles/" + names[i] + ":excitation", 0.0, 1.0);
        if (c != null)
            c.setLabelFontColor(Color.getHSBColor((float) i / names.length, 1f, 1f));
    }
    bundlesPanel.pack();
    bundlesPanel.setVisible(true);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) LabeledComponentBase(maspack.widgets.LabeledComponentBase) Point(artisynth.core.mechmodels.Point)

Aggregations

ControlPanel (artisynth.core.gui.ControlPanel)35 FemControlPanel (artisynth.core.gui.FemControlPanel)10 Point (artisynth.core.mechmodels.Point)3 File (java.io.File)3 IOException (java.io.IOException)3 InternalErrorException (maspack.util.InternalErrorException)3 LabeledComponentBase (maspack.widgets.LabeledComponentBase)3 CollisionManager (artisynth.core.mechmodels.CollisionManager)2 MechModel (artisynth.core.mechmodels.MechModel)2 RigidBody (artisynth.core.mechmodels.RigidBody)2 WayPoint (artisynth.core.probes.WayPoint)2 RootModel (artisynth.core.workspace.RootModel)2 BooleanSelector (maspack.widgets.BooleanSelector)2 Main (artisynth.core.driver.Main)1 FemModel3d (artisynth.core.femmodels.FemModel3d)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)1 AxialSpring (artisynth.core.mechmodels.AxialSpring)1 Muscle (artisynth.core.mechmodels.Muscle)1