Search in sources :

Example 16 with ControlPanel

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

the class SimpleCollide method build.

public void build(String[] args) {
    MechModel mechMod = new MechModel("mechModel");
    mechMod.setMaxStepSize(0.01);
    mechMod.setIntegrator(Integrator.ConstrainedBackwardEuler);
    addModel(mechMod);
    // for block/block friction test
    // mySeparation = 1.09;
    // mySeparation = .615;
    CollisionManager cm = mechMod.getCollisionManager();
    cm.setColliderType(ColliderType.SIGNED_DISTANCE);
    cm.setDrawIntersectionContours(true);
    RenderProps.setEdgeWidth(cm, 2);
    RenderProps.setEdgeColor(cm, Color.YELLOW);
    RenderProps.setVisible(cm, true);
    setTopObject(ObjectType.FemEllipsoid);
    setBottomObject(ObjectType.Box);
    // for block/block friction test
    // mechMod.transformGeometry (
    // new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.toRadians(20)));
    mechMod.setProfiling(false);
    ControlPanel panel = new ControlPanel("controls");
    panel.addWidget(this, "topObject");
    panel.addWidget(this, "bottomObject");
    panel.addWidget(mechMod, "integrator");
    panel.addWidget(this, "friction");
    panel.addWidget(mechMod, "collisionManager:compliance");
    panel.addWidget(mechMod, "collisionManager:damping");
    addControlPanel(panel, 0);
    // mechMod.transformGeometry (
    // new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.PI));
    Main.getMain().arrangeControlPanels(this);
    // panel.pack();
    // panel.setVisible (true);
    // java.awt.Point loc = Main.getMainFrame().getLocation();
    // panel.setLocation(loc.x + Main.getMainFrame().getWidth(), loc.y);
    // addControlPanel (panel);
    NumericInputProbe iprobe = new NumericInputProbe(mechMod, "rigidBodies/bottomObject:targetOrientation", 0, 6);
    // new NumericInputProbe (
    // mechMod, "rigidBodies/bottomObject:targetPosition", 0, 6);
    iprobe.addData(new double[] { 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 3, 0, 1, 0, 90, 5, 0, 1, 0, 180, 6, 0, 1, 0, 180 }, NumericInputProbe.EXPLICIT_TIME);
    // iprobe.addData (
    // new double[] { 0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 3, 0, 0,
    // 2, 4, 0, 0, 0,},
    // NumericInputProbe.EXPLICIT_TIME);
    // 
    // 
    iprobe.setActive(true);
    addInputProbe(iprobe);
    addBreakPoint(1.34);
}
Also used : MechModel(artisynth.core.mechmodels.MechModel) CollisionManager(artisynth.core.mechmodels.CollisionManager) ControlPanel(artisynth.core.gui.ControlPanel) NumericInputProbe(artisynth.core.probes.NumericInputProbe)

Example 17 with ControlPanel

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

the class SingleHex method createControlPanel.

private void createControlPanel(MechModel mechMod, FemModel3d mod) {
    ControlPanel panel = new ControlPanel("options");
    FemControlPanel.addFem3dControls(panel, mod, mechMod);
    panel.pack();
    addControlPanel(panel);
    panel.setVisible(true);
    Main.getMain().arrangeControlPanels(this);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) FemControlPanel(artisynth.core.gui.FemControlPanel)

Example 18 with ControlPanel

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

the class DoubleArmDemo method addPanel.

public void addPanel() {
    panel = new ControlPanel("Muscle Control", "");
    panel.addWidget("Upper Muscle", model, "axialSprings/muscle:excitation", 0.0, 1.0);
    panel.addWidget("Lower Muscle", model, "axialSprings/muscle2:excitation", 0.0, 1.0);
    addControlPanel(panel);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel)

Example 19 with ControlPanel

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

the class Main method arrangeControlPanels.

public void arrangeControlPanels(RootModel root) {
    if (myFrame != null) {
        java.awt.Point loc = myFrame.getLocation();
        int locx = loc.x + myFrame.getWidth();
        int locy = loc.y;
        int maxWidth = 0;
        for (ControlPanel panel : root.getControlPanels()) {
            panel.pack();
            panel.setLocation(locx, locy);
            if (panel.getWidth() > maxWidth) {
                maxWidth = panel.getWidth();
            }
            locy += panel.getHeight();
        }
        for (ControlPanel panel : root.getControlPanels()) {
            if (panel.getWidth() < maxWidth) {
                panel.setSize(maxWidth, panel.getHeight());
            }
            panel.setVisible(true);
        }
    }
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) WayPoint(artisynth.core.probes.WayPoint)

Example 20 with ControlPanel

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

the class MenuBarHandler method doLoadControlPanel.

/**
 * Load a control panel into the model
 */
private void doLoadControlPanel() {
    RootModel root = myMain.getRootModel();
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(myMain.getModelDirectory());
    int retVal = chooser.showOpenDialog(myFrame);
    if (retVal == JFileChooser.APPROVE_OPTION) {
        File file = chooser.getSelectedFile();
        ControlPanel panel = null;
        try {
            panel = (ControlPanel) ComponentUtils.loadComponent(file, root, ControlPanel.class);
        } catch (Exception e) {
            showError("Error reading file: " + e.getMessage());
        }
        if (panel != null) {
            // panel.pack();
            // panel.setVisible (true);
            root.addControlPanel(panel);
            myMain.setModelDirectory(chooser.getCurrentDirectory());
        }
    }
}
Also used : RootModel(artisynth.core.workspace.RootModel) JFileChooser(javax.swing.JFileChooser) ControlPanel(artisynth.core.gui.ControlPanel) File(java.io.File) InternalErrorException(maspack.util.InternalErrorException) IOException(java.io.IOException)

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