Search in sources :

Example 1 with MuscleElementDesc

use of artisynth.core.femmodels.MuscleElementDesc in project artisynth_core by artisynth.

the class MuscleBundleEditor method addElementsNearFibres.

private void addElementsNearFibres(MuscleBundle bundle) {
    WidgetDialog dialog = WidgetDialog.createDialog(myMain.getFrame(), "Specify fibre distance", "Set");
    DoubleField widget = new DoubleField("distance:", myLastElementFibreDist);
    widget.setRange(0, Double.POSITIVE_INFINITY);
    dialog.addWidget(widget);
    GuiUtils.locateCenter(dialog, myMain.getFrame());
    dialog.setVisible(true);
    if (dialog.getReturnValue() == OptionPanel.OK_OPTION) {
        double dist = widget.getDoubleValue();
        LinkedList<MuscleElementDesc> list = bundle.getNewElementsNearFibres(dist);
        AddComponentsCommand cmd = new AddComponentsCommand("Add near elements", list, bundle.getElements());
        myMain.getUndoManager().saveStateAndExecute(cmd);
        myLastElementFibreDist = dist;
    }
}
Also used : WidgetDialog(maspack.widgets.WidgetDialog) DoubleField(maspack.widgets.DoubleField) MuscleElementDesc(artisynth.core.femmodels.MuscleElementDesc)

Example 2 with MuscleElementDesc

use of artisynth.core.femmodels.MuscleElementDesc in project artisynth_core by artisynth.

the class FemMuscleDemo method createBundle.

protected MuscleBundle createBundle(String name, List<FemElement3d> elems) {
    MuscleBundle bundle = new MuscleBundle(name);
    if (elems != null) {
        for (FemElement3d e : elems) {
            MuscleElementDesc desc = new MuscleElementDesc();
            desc.setElement(e);
            desc.setDirection(Vector3d.X_UNIT);
            bundle.addElement(desc);
        }
    }
    return bundle;
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) FemElement3d(artisynth.core.femmodels.FemElement3d) MuscleElementDesc(artisynth.core.femmodels.MuscleElementDesc)

Aggregations

MuscleElementDesc (artisynth.core.femmodels.MuscleElementDesc)2 FemElement3d (artisynth.core.femmodels.FemElement3d)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 DoubleField (maspack.widgets.DoubleField)1 WidgetDialog (maspack.widgets.WidgetDialog)1