Search in sources :

Example 71 with InternalErrorException

use of maspack.util.InternalErrorException in project artisynth_core by artisynth.

the class ReadlinePanel method getLineText.

String getLineText() {
    int begOff = getLineStart();
    int endOff = getLineEnd();
    try {
        return getText(begOff, endOff - begOff);
    } catch (BadLocationException e) {
        throw new InternalErrorException("bad location");
    }
}
Also used : InternalErrorException(maspack.util.InternalErrorException) BadLocationException(javax.swing.text.BadLocationException)

Example 72 with InternalErrorException

use of maspack.util.InternalErrorException in project artisynth_core by artisynth.

the class FemModel3d method computeNodalIncompressibility.

private void computeNodalIncompressibility(IncompressibleMaterial imat, Matrix6d D) {
    for (FemNode3d n : myNodes) {
        if (volumeIsControllable(n)) {
            double restVol = n.myRestVolume;
            myKp[0] = imat.getEffectiveModulus(n.myVolume / restVol) / restVol;
            // myKp[0] = 1;
            if (myKp[0] != 0) {
                for (FemNodeNeighbor nbr_i : getNodeNeighbors(n)) {
                    int bi = nbr_i.myNode.getSolveIndex();
                    for (FemNodeNeighbor nbr_j : getNodeNeighbors(n)) {
                        int bj = nbr_j.myNode.getSolveIndex();
                        if (!mySolveMatrixSymmetricP || bj >= bi) {
                            FemNodeNeighbor nbr = nbr_i.myNode.getNodeNeighbor(nbr_j.myNode);
                            if (nbr == null) {
                                nbr = nbr_i.myNode.getIndirectNeighbor(nbr_j.myNode);
                            }
                            if (nbr == null) {
                                throw new InternalErrorException("No neighbor block at bi=" + bi + ", bj=" + bj);
                            } else {
                                nbr.addDilationalStiffness(myKp, nbr_i.myDivBlk, nbr_j.myDivBlk);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : InternalErrorException(maspack.util.InternalErrorException) Point(artisynth.core.mechmodels.Point)

Example 73 with InternalErrorException

use of maspack.util.InternalErrorException in project artisynth_core by artisynth.

the class NumericProbeRangeSelectorDialog method actionPerformed.

public void actionPerformed(ActionEvent e) {
    String nameOfAction = e.getActionCommand();
    if (nameOfAction.equals("OK")) {
        display.setDefaultRange(minYField.getDoubleValue(), maxYField.getDoubleValue());
        // display.setDisplayRange(
        // minYField.getDoubleValue(), maxYField.getDoubleValue());
        // set new display range in probe
        display.myProbe.setDefaultDisplayRange(minYField.getDoubleValue(), maxYField.getDoubleValue());
        display.repaint();
        setVisible(false);
    } else if (nameOfAction.equals("Cancel")) {
        display.setDisplayRange(minYRange, maxYRange);
        // set auto-ranging last because setDisplayRange will clear it
        display.setAutoRanging(autoRanging);
        display.repaint();
        setVisible(false);
    } else {
        throw new InternalErrorException("Unknown action: " + nameOfAction);
    }
}
Also used : InternalErrorException(maspack.util.InternalErrorException)

Example 74 with InternalErrorException

use of maspack.util.InternalErrorException in project artisynth_core by artisynth.

the class PropertyWidgetDialog method updateRange.

private void updateRange(ModelComponent comp, PropertyInfo info) {
    Property prop = comp.getProperty(info.getName());
    if (prop == null) {
        throw new InternalErrorException("Cannot create property '" + info.getName() + " for component type " + comp.getClass());
    }
    DoubleInterval newRange = getDefaultRange(prop);
    double currentValue = ((Number) prop.get()).doubleValue();
    if (currentValue < newRange.getLowerBound()) {
        newRange.setLowerBound(currentValue);
    } else if (currentValue > newRange.getUpperBound()) {
        newRange.setUpperBound(currentValue);
    }
    myRangeField.setValue(newRange);
}
Also used : DoubleInterval(maspack.util.DoubleInterval) InternalErrorException(maspack.util.InternalErrorException) CompositeProperty(maspack.properties.CompositeProperty) EditingProperty(maspack.properties.EditingProperty) Property(maspack.properties.Property)

Example 75 with InternalErrorException

use of maspack.util.InternalErrorException in project artisynth_core by artisynth.

the class PropertyWidgetDialog method createEditingProperty.

private EditingProperty createEditingProperty(Property prop) {
    if (prop.getHost() == null) {
        throw new InternalErrorException("Property " + prop.getName() + " does not have host");
    }
    HostList hostList = new HostList(1);
    hostList.addHost(prop.getHost());
    // get single property from host list
    String[] restricted = new String[] { prop.getName() };
    String[] excluded = null;
    PropTreeCell tree = hostList.commonProperties(null, /* allowReadonly= */
    false, restricted, excluded);
    if (tree.numChildren() == 0) {
        throw new InternalErrorException("Property " + prop.getName() + " not found in host");
    }
    // expand save data in hostList down one level ...
    hostList.saveBackupValues(tree);
    return new EditingProperty(tree.getFirstChild(), hostList, /* live= */
    true);
}
Also used : EditingProperty(maspack.properties.EditingProperty) PropTreeCell(maspack.properties.PropTreeCell) HostList(maspack.properties.HostList) InternalErrorException(maspack.util.InternalErrorException)

Aggregations

InternalErrorException (maspack.util.InternalErrorException)92 Vector3d (maspack.matrix.Vector3d)9 CompositeProperty (maspack.properties.CompositeProperty)8 Point3d (maspack.matrix.Point3d)7 Property (maspack.properties.Property)7 FemModel3d (artisynth.core.femmodels.FemModel3d)6 Point (artisynth.core.mechmodels.Point)6 ModelComponent (artisynth.core.modelbase.ModelComponent)5 PolygonalMesh (maspack.geometry.PolygonalMesh)5 Line (maspack.matrix.Line)5 RigidTransform3d (maspack.matrix.RigidTransform3d)5 EditingProperty (maspack.properties.EditingProperty)5 BadLocationException (javax.swing.text.BadLocationException)4 RotationMatrix3d (maspack.matrix.RotationMatrix3d)4 RigidBody (artisynth.core.mechmodels.RigidBody)3 RootModel (artisynth.core.workspace.RootModel)3 File (java.io.File)3 IOException (java.io.IOException)3 LinkedList (java.util.LinkedList)3 SelectionManager (artisynth.core.gui.selectionManager.SelectionManager)2