Skip to content

Fem: Constraint symbol scaling#13274

Merged
WandererFan merged 12 commits intoFreeCAD:mainfrom
marioalexis84:fem-symbol_scaling
Apr 22, 2024
Merged

Fem: Constraint symbol scaling#13274
WandererFan merged 12 commits intoFreeCAD:mainfrom
marioalexis84:fem-symbol_scaling

Conversation

@marioalexis84
Copy link
Member

@marioalexis84 marioalexis84 commented Apr 2, 2024

This pull request fixes #11306 via a rework of the constraint symbol framework:

  • A SoMultipleCopy node is used to create multiple copies of the symbol node and save resources (currently, there is one node for each symbol).

  • The symbol geometry is read from an Open Inventor .iv file (the expected file structure is detailed in the loadSymbol function documentation) and is made up of the symbol used at each point on the reference shape plus an optional symbol that does not is affected by multiple copies (for example, useful for those constraints that need to use a global symmetry axis).

  • Some attributes are added for fine control over the symbol:

    • An extra symbol node to add a global symbol not affected for transformations at each point on the reference shape.
    • A boolean to set whether to apply local rotations based on the reference geometry normal vectors or set the multiple
      copied to remain oriented in the same direction and only translate rigidly (for example, displacement constraint symbol).
  • Control nodes and attributes are also exposed to ViewProviderFemConstraint Python Features.

  • A virtual transformSymbol function to apply local transformations to the symbol at each point on the reference.

    So, to add symbols to proxy Python objects:

    class VPConstraintProxy:
         ...
         def attach(self, vobj):
             # vobj.loadSymbol(path_to_iv_file)
             # vobj.RotateSymbol = True/False
         ...
         def updateData(self, vobj, prop):
             # apply changes to the symbol using vobj.SymbolNode, vobj.ExtraSymbolNode
    

There are still some objects to migrate: Constraint transform and the hidden constraints bearing, gear, pulley and fluidBoundary.
After these objects are migrated, the static ViewProviderFemConstraint methods used to create symbols are obsolete and can be removed.

@github-actions github-actions bot added the Mod: FEM Related to the FEM Workbench label Apr 2, 2024
@marioalexis84
Copy link
Member Author

@FEA-eng you surely have suggestions for adding new symbols and updating current ones.

@FEA-eng
Copy link
Contributor

FEA-eng commented Apr 2, 2024

@marioalexis84 It's great to finally have a working constraint symbol scale property. Could it be renamed from Dist Factor to something like Symbol Scale though? This way it would be easier to find it. Also, would it be possible to improve the initial scaling somehow? Currently, if you take the example of the 8 m long beam from the referenced issue, the initial force constraint symbol size is still too small to see it.

Finally, there are those old properties that seem to be doing nothing:

  • Font Size
  • Mirror
  • Shape Color
  • Text Color

Unless they are used for some other constraint types? But then why show them for all constraints?

@marioalexis84 marioalexis84 marked this pull request as draft April 2, 2024 22:36
@marioalexis84 marioalexis84 force-pushed the fem-symbol_scaling branch 2 times, most recently from 759287d to b1047e3 Compare April 19, 2024 18:28
@marioalexis84 marioalexis84 marked this pull request as ready for review April 19, 2024 18:29
@marioalexis84
Copy link
Member Author

@FEA-eng could you test this?
The PR is reworked to use the Scale property for scaling. The property is no longer an integer and becomes a float for finer control over scaling.
In another pull request I will remove unused view properties.

@FEA-eng
Copy link
Contributor

FEA-eng commented Apr 20, 2024

Great, I tested this and it works properly.

@marioalexis84
Copy link
Member Author

@chennes this is ready. After migrate the remaining objects, #11306 can be closed.

@maxwxyz
Copy link
Collaborator

maxwxyz commented Apr 21, 2024

Works great! Is there an easy fix for #7030 after this?

@maxwxyz maxwxyz closed this Apr 21, 2024
@maxwxyz maxwxyz reopened this Apr 21, 2024
@marioalexis84
Copy link
Member Author

Works great! Is there an easy fix for #7030 after this?

Not yet. I will change the criteria for calculating the symbol size from the object size.

@WandererFan WandererFan merged commit 7d4d5ed into FreeCAD:main Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mod: FEM Related to the FEM Workbench

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Problem] Size of the FEM feature symbols can't be changed

4 participants