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);
}
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);
}
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);
}
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);
}
}
}
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());
}
}
}
Aggregations