void Dlg_BCs::ApplyPreset(int NewPreset) { pEnv->ClearBCs(); BCEditPrimDlg->ChangedSnap(false); char ThisDof = DOF_NONE; switch (NewPreset){ case BC_XCANT: pEnv->AddFixedBc(Vec3D<>(0,0,0), Vec3D<>(0.01, 1.0, 1.0)); pEnv->AddForcedBc(Vec3D<>(0.99,0,0), Vec3D<>(0.01, 1.0, 1.0), Vec3D<>(0,0,-1.0), Vec3D<>(0,0,0)); break; case BC_YCANT: pEnv->AddFixedBc(Vec3D<>(0,0,0), Vec3D<>(1.0, 0.01, 1.0)); pEnv->AddForcedBc(Vec3D<>(0,0.99,0), Vec3D<>(1.0, 0.01, 1.0), Vec3D<>(0,0,-1.0), Vec3D<>(0,0,0)); break; case BC_XAXIAL: pEnv->AddFixedBc(Vec3D<>(0,0,0), Vec3D<>(0.01, 1.0, 1.0)); pEnv->AddForcedBc(Vec3D<>(0.99,0,0), Vec3D<>(0.01, 1.0, 1.0), Vec3D<>(1.0,0,0), Vec3D<>(0,0,0)); break; case BC_YAXIAL: pEnv->AddFixedBc(Vec3D<>(0,0,0), Vec3D<>(1.0, 0.01, 1.0)); pEnv->AddForcedBc(Vec3D<>(0,0.99,0), Vec3D<>(1.0, 0.01, 1.0), Vec3D<>(0,1.0,0), Vec3D<>(0,0,0)); break; case BC_ZAXIAL: pEnv->AddFixedBc(Vec3D<>(0,0,0), Vec3D<>(1.0, 1.0, 0.01)); pEnv->AddForcedBc(Vec3D<>(0,0,0.99), Vec3D<>(1.0, 1.0, 0.01), Vec3D<>(0,0,1.0), Vec3D<>(0,0,0)); break; case BC_XSYM: SET_FIXED(DOF_X, ThisDof, true); SET_FIXED(DOF_TY, ThisDof, true); SET_FIXED(DOF_TZ, ThisDof, true); pEnv->AddFixedBc(Vec3D<>(0.99,0,0), Vec3D<>(0.01, 1.0, 1.0), ThisDof); break; case BC_YSYM: SET_FIXED(DOF_Y, ThisDof, true); SET_FIXED(DOF_TX, ThisDof, true); SET_FIXED(DOF_TZ, ThisDof, true); pEnv->AddFixedBc(Vec3D<>(0,0.99,0), Vec3D<>(1.0, 0.01, 1.0), ThisDof); break; case BC_ZSYM: SET_FIXED(DOF_Z, ThisDof, true); SET_FIXED(DOF_TX, ThisDof, true); SET_FIXED(DOF_TY, ThisDof, true); pEnv->AddFixedBc(Vec3D<>(0,0,0.99), Vec3D<>(1.0, 1.0, 0.01), ThisDof); break; } ui.BCList->setCurrentRow(0); //set the current elected to this one BCrowChanged(0); //need to call this explicitly sometimes, if new index happens to be the same as the old one... UpdateBCLists(); emit RequestUpdateGL(); }
void Dlg_BCs::ChangedFixed(char DofToChange, bool State) { if (CurRegion){ SET_FIXED(DofToChange, CurRegion->DofFixed, State); if (DOF_X&DofToChange){State ? CurRegion->Force.x=0 : CurRegion->Displace.x=0; } //if we're changing the X DOF if (DOF_Y&DofToChange){State ? CurRegion->Force.y=0 : CurRegion->Displace.y=0; } //if we're changing the Y DOF if (DOF_Z&DofToChange){State ? CurRegion->Force.z=0 : CurRegion->Displace.z=0; } //if we're changing the Z DOF if (DOF_TX&DofToChange){State ? CurRegion->Torque.x=0 : CurRegion->AngDisplace.x=0; } //if we're changing the TX DOF if (DOF_TY&DofToChange){State ? CurRegion->Torque.y=0 : CurRegion->AngDisplace.y=0; } //if we're changing the TY DOF if (DOF_TZ&DofToChange){State ? CurRegion->Torque.z=0 : CurRegion->AngDisplace.z=0; } //if we're changing the TZ DOF } }
void CVXS_Voxel::FixDof(char DofFixedIn) //fixes any of the degrees of freedom indicated. Doesn't unfix any currently fixed ones { if (IS_FIXED(DOF_X, DofFixedIn)) SET_FIXED(DOF_X, DofFixed, true); if (IS_FIXED(DOF_Y, DofFixedIn)) SET_FIXED(DOF_Y, DofFixed, true); if (IS_FIXED(DOF_Z, DofFixedIn)) SET_FIXED(DOF_Z, DofFixed, true); if (IS_FIXED(DOF_TX, DofFixedIn)) SET_FIXED(DOF_TX, DofFixed, true); if (IS_FIXED(DOF_TY, DofFixedIn)) SET_FIXED(DOF_TY, DofFixed, true); if (IS_FIXED(DOF_TZ, DofFixedIn)) SET_FIXED(DOF_TZ, DofFixed, true); }