@@ -219,26 +219,27 @@ void ViewProviderFemConstraint::onChanged(const App::Property* prop)
219
219
220
220
void ViewProviderFemConstraint::updateData (const App::Property* prop)
221
221
{
222
- auto pcConstraint = static_cast <Fem::Constraint*>(this ->getObject ());
222
+ auto pcConstraint = static_cast <const Fem::Constraint*>(this ->getObject ());
223
223
224
224
if (prop == &pcConstraint->Points || prop == &pcConstraint->Scale ) {
225
225
const std::vector<Base::Vector3d>& points = pcConstraint->Points .getValue ();
226
226
const std::vector<Base::Vector3d>& normals = pcConstraint->Normals .getValue ();
227
- SbVec3f axisY (0 , 1 , 0 );
228
227
pMultCopy->matrix .setNum (points.size ());
229
228
SbMatrix* mat = pMultCopy->matrix .startEditing ();
230
- float s = static_cast <float >(pcConstraint->Scale .getValue ());
231
- s = s > 0 ? s : 0 ;
232
- SbVec3f scale (s, s, s);
229
+ // SbVec3f axisY(0, 1, 0);
230
+ // float s = static_cast<float>(pcConstraint->Scale.getValue());
231
+ // s = s > 0 ? s : 0;
232
+ // SbVec3f scale(s, s, s);
233
233
int i = 0 ;
234
234
for (const auto & point : points) {
235
235
const auto & normal = normals[i];
236
- SbVec3f norm = rotateSymbol ? SbVec3f (normal .x , normal .y , normal .z ) : axisY;
237
- SbRotation rot (axisY, norm);
238
- SbVec3f tra (static_cast <float >(point.x ),
239
- static_cast <float >(point.y ),
240
- static_cast <float >(point.z ));
241
- mat[i].setTransform (tra, rot, scale);
236
+ // SbVec3f norm = rotateSymbol ? SbVec3f(normal.x, normal.y, normal.z) :
237
+ // axisY; SbRotation rot(axisY, norm); SbVec3f
238
+ // tra(static_cast<float>(point.x),
239
+ // static_cast<float>(point.y),
240
+ // static_cast<float>(point.z));
241
+ // mat[i].setTransform(tra, rot, scale);
242
+ transformSymbol (pcConstraint, point, normal , mat[i]);
242
243
++i;
243
244
}
244
245
@@ -249,6 +250,25 @@ void ViewProviderFemConstraint::updateData(const App::Property* prop)
249
250
}
250
251
}
251
252
253
+ void ViewProviderFemConstraint::transformSymbol (const App::DocumentObject* obj,
254
+ const Base::Vector3d& point,
255
+ const Base::Vector3d& normal ,
256
+ SbMatrix& mat) const
257
+ {
258
+ SbVec3f axisY (0 , 1 , 0 );
259
+ auto pcConstraint = static_cast <const Fem::Constraint*>(obj);
260
+ float s = static_cast <float >(pcConstraint->Scale .getValue ());
261
+ s = s > 0 ? s : 0 ;
262
+ SbVec3f scale (s, s, s);
263
+ SbVec3f norm = rotateSymbol ? SbVec3f (normal .x , normal .y , normal .z ) : axisY;
264
+ SbRotation rot (axisY, norm);
265
+ SbVec3f tra (static_cast <float >(point.x ),
266
+ static_cast <float >(point.y ),
267
+ static_cast <float >(point.z ));
268
+ mat.setTransform (tra, rot, scale);
269
+ }
270
+
271
+
252
272
// OvG: Visibility automation show parts and hide meshes on activation of a constraint
253
273
std::string ViewProviderFemConstraint::gethideMeshShowPartStr (const std::string showConstr)
254
274
{
@@ -711,13 +731,36 @@ void ViewProviderFemConstraint::checkForWizard()
711
731
712
732
713
733
// Python feature -----------------------------------------------------------------------
734
+ template <>
735
+ void /* FemGui::*/
736
+ ViewProviderFemConstraintPythonT</* FemGui::*/ ViewProviderFemConstraint>::transformSymbol(
737
+ const App::DocumentObject* obj,
738
+ const Base::Vector3d& point,
739
+ const Base::Vector3d& normal ,
740
+ SbMatrix& mat) const
741
+ {
742
+ Py::Object prop =
743
+ Base::freecad_dynamic_cast<App::PropertyPythonObject>(getPropertyByName (" Proxy" ))
744
+ ->getValue ();
745
+
746
+ #ifdef FC_PY_VIEW_OBJECT
747
+
748
+ printf (" aca\n " );
749
+ #endif
750
+ }
714
751
715
752
namespace Gui
716
753
{
717
754
// / @cond DOXERR
755
+ // PROPERTY_SOURCE_TEMPLATE(FemGui::ViewProviderFemConstraintPython,
756
+ // FemGui::ViewProviderFemConstraint)
718
757
PROPERTY_SOURCE_TEMPLATE (FemGui::ViewProviderFemConstraintPython, FemGui::ViewProviderFemConstraint)
719
758
// / @endcond
720
759
721
- // explicit template instantiation
722
- template class FemGuiExport ViewProviderPythonFeatureT<ViewProviderFemConstraint>;
760
+ // namespace Gui {
761
+ // template class FemGuiExport ViewProviderPythonFeatureT<ViewProviderFemConstraint>;
762
+ // }
763
+ // explicit template instantiation
764
+ template class FemGuiExport
765
+ ViewProviderPythonFeatureT<ViewProviderFemConstraintPythonT<ViewProviderFemConstraint>>;
723
766
} // namespace Gui
0 commit comments