Std DependencyGraph: Difference between revisions

From FreeCAD Documentation
({{Std Base}} {{Userdocnavi}} to categorize the page)
(Removed a reference to V0.19.)
 
(56 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:39-->
{{Docnav
|[[Std_SceneInspector|SceneInspector]]
|[[Std_ProjectUtil|ProjectUtil]]
|[[Std_Tools_Menu|Std Tools Menu]]
|IconL=Std_SceneInspector.svg
|IconR=Std_ProjectUtil.svg
|IconC=Freecad.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Std DependencyGraph
|Name=Std DependencyGraph
|MenuLocation=[[Std Tools Menu|Tools]] → Dependency graph...
|MenuLocation=Tools → Dependency graph...
|Workbenches=All
|Workbenches=All
}}
}}



== Description == <!--T:6-->
== Description == <!--T:6-->


<!--T:7-->
<!--T:7-->
The '''Dependency graph''' displays the dependencies between objects in the active document as a graph. As opposed to the Model tree, objects are listed in reverse chronological order, with the first created object at the bottom.
The '''Std DependencyGraph''' command displays the dependencies between objects in the active document in a 'dependency graph'. As opposed to the [[Tree_view|Tree view]], objects are listed in reverse chronological order, with the first created object at the bottom.


<!--T:18-->
<!--T:18-->
It can be useful in analyzing a FreeCAD document and locating forks in a tree. The dependency graph layout will depend on which workbench was used to create the objects in the document. For example, in FreeCAD 0.16, a model exclusively made in the PartDesign workbench should display a linear dependency graph with a single vertical branch. A model made with Part operations will have many branches, but for a single part they will join up at the top after Boolean operations. If they don't, it means that they are separate objects.
It can be useful in analyzing a FreeCAD document and locating forks in a tree. The dependency graph layout will depend on which workbench was used to create the objects in the document. For example a model made exclusively in the [[PartDesign_Workbench|PartDesign]] workbench can display a linear dependency graph with a single vertical branch. A model made with [[Part_Workbench|Part]] operations will have many branches, but for a single part they will join up at the top after [[Part_Boolean|Boolean]] operations. If they don't, it means that they are separate objects.


<!--T:19-->
<!--T:19-->
The dependency graph is purely a visualization tool, therefore it cannot be edited; it automatically updates if changes are made to the model.
The dependency graph is purely a visualization tool, therefore it cannot be edited. It automatically updates if changes are made to the model.


</translate>
[[Image:Std_DependencyGraph_example.svg|400px]]
<translate>
<!--T:8-->
<!--T:8-->
{{Caption|Example of a dependency graph with a PartDesign body on the left and an object created with Part operations on the right}}
[[Image:DependencyGraph1.png|DependencyGraph1.png]]
{{clear}}


==Installation== <!--T:9-->
==Installation== <!--T:32-->
To use the Dependency graph, a third-party software named [http://graphviz.org/ Graphviz] needs to be installed first. If you do not have it pre-installed or it is installed in an unconventional location, FreeCAD will display the following dialogue:


<!--T:9-->
To use the command a third-party software named [http://graphviz.org/ Graphviz] needs to be installed. If you do not have it pre-installed or it is installed in an unconventional location, FreeCAD will display the following dialog:

<!--T:30-->
[[File:FreeCAD-0.17-missing-Graphviz-error-dialogue.png]]
[[File:FreeCAD-0.17-missing-Graphviz-error-dialogue.png]]


===Windows=== <!--T:15-->
===Windows=== <!--T:33-->

Download the '''graphviz-2.xx.msi''' installer from the [https://graphviz.gitlab.io/_pages/Download/Download_windows.html Graphviz Download page] and launch it to install it.
<!--T:15-->
Download the '''graphviz-2.xx''' installer from the [https://graphviz.org/download/#windows Graphviz Download page] and launch it to install it. Some older versions seem to have issues displaying the graph; version 2.38 and newer are known to be reliable. You can find all graphviz releases on [https://gitlab.com/graphviz/graphviz/-/releases Gitlab].

===macOS=== <!--T:34-->

<!--T:11-->
You can install Graphviz using [https://brew.sh/ Homebrew] if you have macOS Big Sur (11) (or higher). While installing Homebrew, don't get nervous, if macOS asks you to install updates, e.g. for the Xcode commandline tools. These updates are performed later by the installation process.


===Mac/OSX=== <!--T:11-->
You can install graphviz using [https://brew.sh/ Homebrew]:
</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
brew install graphviz
brew install graphviz
}}
}}
<translate>
<translate>

<!--T:12-->
<!--T:12-->
This installs the graphviz binaries under /usr/local/bin. Unfortunately we can't navigate directly there from the file dialog that comes up from FreeCAD → Tools → Dependency graph.
This installs the Graphviz binaries under {{FileName|/usr/local/bin}} for macOS on Intel, or {{FileName|/opt/homebrew}} for macOS on Apple Silicon/ARM. FreeCAD should automatically find these locations. If the Graphviz program is not found you will be asked to specify a path. Unfortunately we can't navigate directly to the program in the file dialog that comes up from {{MenuCommand|Tools → Dependency graph...}}. There are two options: You can use the key combination Cmd+Shift+. to show hidden items. Or you can use the key combination Cmd+Shift+G to get an input field for the path. Enter one of these paths in the [https://en.wikipedia.org/wiki/Terminal_(macOS) Terminal]:

When you get the file selection dialog use the keys Cmd+Shift+G to get an input field for the path. Enter
</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
/usr/local/bin
/usr/local/bin
}}
}}
<translate>
<translate>

<!--T:41-->
or:

</translate>
{{Code|lang=text|code=
/opt/homebrew/bin
}}
<translate>

<!--T:13-->
<!--T:13-->
and confirm the input field and the file selection dialog.
and confirm the input field and the file selection dialog.


<!--T:21-->
<!--T:21-->
In case the Graphviz binaries are installed in a non-standard location try to find the program with the command
In case the Graphviz binaries are installed in a non-standard location try to find the program with the command:

</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
type dot
type dot
}}
}}
<translate>
<translate>

<!--T:22-->
<!--T:22-->
It will output something like
It will output something like:

</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
dot is /usr/local/bin/dot
dot is /usr/local/bin/dot
}}
}}
<translate>
<translate>

<!--T:23-->
<!--T:23-->
And therefore you can tell FreeCAD to look in that directory.
And you can tell FreeCAD to look in that directory.

<!--T:42-->
If you don't have macOS Big Sur (11) (or higher) Homebrew might not work, but you can use [https://www.macports.org/index.php MacPorts] instead. Just download the [https://www.macports.org/install.php appropriate version for your OS]. Once the installation is complete, enter this command in the [https://en.wikipedia.org/wiki/Terminal_(macOS) Terminal]:


===Linux=== <!--T:10-->
On most Linux distributions (Debian/Ubuntu, Fedora, OpenSUSE), you just need to install the graphviz package from the repositories. However, similarly to MacOSX, in cases where the Graphviz binaries are installed in a non-standard location, try to find the program with the command:
</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
sudo port install graphviz
}}
<translate>

<!--T:43-->
Enter your password and wait while the dependencies are downloaded and installed (it can take some time).

<!--T:44-->
The Graphviz binaries may be under {{FileName|/usr/local/bin}} or {{FileName|/opt/local/bin/dot}}. FreeCAD may automatically find the Graphviz program with the file dialog that comes up from {{MenuCommand|Tools → Dependency graph...}}, if not enter this command:

</translate>
{{Code|lang=text|code=
type dot
type dot
}}
}}
<translate>
<translate>

<!--T:45-->
It will output something like:

</translate>
{{Code|lang=text|code=
dot is /opt/local/bin/dot
}}
<translate>

<!--T:46-->
And you can tell FreeCAD to look in that directory as explained before.

<!--T:47-->
It is also possible to make the opt directory visible with this command:

</translate>
{{Code|lang=text|code=
defaults write com.apple.finder AppleShowAllFiles YES;
}}
<translate>

<!--T:48-->
then:

</translate>
{{Code|lang=text|code=
killall Finder /System/Library/CoreServices/Finder.app;
}}
<translate>

<!--T:49-->
Therefore you can tell FreeCAD to follow this path. It has been successfully tested on macOS 10.13 (High Sierra).

===Linux=== <!--T:35-->

<!--T:10-->
On most Linux distributions (Debian/Ubuntu, Fedora, OpenSUSE), you just need to install the Graphviz package from the repositories. However, similar to the macOS, in cases where the Graphviz binaries are installed in a non-standard location, try to find the program with the command:

</translate>
{{Code|lang=text|code=
type dot
}}
<translate>

<!--T:24-->
<!--T:24-->
It may output something like
It may output something like

</translate>
</translate>
{{Code|code=
{{Code|lang=text|code=
dot is /usr/local/bin/dot
dot is /usr/local/bin/dot
}}
}}
<translate>
<translate>

<!--T:25-->
<!--T:25-->
And therefore you can point FreeCAD to look in that directory.
And therefore you can point FreeCAD to look in that directory.


==Configuration== <!--T:16-->
==Usage== <!--T:37-->
You shouldn't need any configuration of FreeCAD preferences. If FreeCAD cannot find the utility "dot" (from the Graphviz package) then a dialog comes up and asks the user for its path: set the path to the folder that contains the "dot" executable, do not select the executable itself. FreeCAD then tries to start the utility again and in case it succeeds the value is written automatically to the user parameters.


==How to use== <!--T:20-->
<!--T:20-->
# Go to the '''Tools → Dependency graph...''' menu
# Select the {{MenuCommand|Tools → [[Image:Std_DependencyGraph.svg|16px]] Dependency graph...}} option from the menu.
# A new tab titled '''Dependency graph''' opens over the main area of the FreeCAD window.
# A new tab titled '''Dependency graph''' opens in the [[Main_view_area|Main view area]].
# Use the mouse scroll wheel to zoom in / zoom out.
# Use the mouse scroll wheel to zoom in or out.
# Use the horizontal slider at the bottom of the screen to pan the view sideways.
# Use the sliders at the bottom and at the right of the screen to pan the view. Alternatively hold down the left mouse button and move the mouse.


==Save/Export== <!--T:17-->
==Save== <!--T:38-->

You can save/export the displayed dependency graph as an image file. While the Dependency graph tab is in the foreground:
<!--T:17-->
* Just choose '''File''' → [[Std_SaveAs|Save As]] to save the graph as a picture (PNG/BMP/GIF/JPG), a vector graphic (SVG) or as a PDF document.
You can save a dependency graph:
* '''File''' → [[Std_Export|Export]] or '''Tools''' → [[Std ViewScreenShot|Save picture]] will '''NOT''' work.
# Make sure the Dependency graph tab is in the foreground.
# Select the {{MenuCommand|File → [[Std_Save|Save]]}} or {{MenuCommand|File → [[Std_SaveAs|Save As]]}} option from the menu.
# Enter a filename and select the file type (*.png, *.bmp, *.gif, *.jpg, *.svg or *.pdf).
# Press the {{Button|Save}} button.


==General principles== <!--T:26-->
==General principles== <!--T:26-->


<!--T:27-->
<!--T:27-->
* The graph shows objects in reverse chronological order, from the bottom to the top.
* The graph shows objects in reverse chronological order.
* The direction of arrows showing dependencies should always point down, from the child object to the parent object. An arrow pointing up indicates a cyclic dependency, an issue that needs to be resolved.
* The direction of arrows showing dependencies should always point down, from the child object to the parent object. An arrow pointing up indicates a cyclic dependency, an issue that needs to be resolved.
* A sketch that contains links to [[Sketcher External|external geometry]] will have a number with an "x" suffix besides the arrow linking it to its parent, showing the number of external geometry linked in the sketch.
* A sketch that contains links to [[Sketcher_External|external geometry]] will have a number with an 'x' suffix besides the arrow linking it to its parent, showing the number of external geometries linked in the sketch.
* Objects can have dependencies to multiple parents. For example, for a model built in PartDesign, a Pocket may be linked to its Sketch and to the Pad feature that came before it.
* Objects can have dependencies to multiple parents. For example, for a model built in [[PartDesign_Workbench|PartDesign]], a Pocket may be linked to its Sketch and to the Pad feature that came before it.
* Disallowed dependencies (for example, between a Draft/Part operation and an element inside a [[PartDesign Body]]) will show with a red arrow. This type of link usually shows a "Links go out of allowed scope" error in the report view.
* Disallowed dependencies (for example, between a [[Draft_Workbench|Draft]]/[[Part_Workbench|Part]] operation and an element inside a PartDesign Body) will show with a red arrow. This type of link usually shows a 'Links go out of allowed scope' error in the [[Report_view|Report view]].
* [[Std Part|Part container]] and [[PartDesign Body|PartDesign Body]] enclose their content inside a frame with a randomly colored background. Their Origin also enclose their content (standard planes and axes) in a frame.
* A [[Std_Part|Part container]] and [[PartDesign_Body|PartDesign Body]] enclose their content inside a frame with a randomly colored background. Their Origin also encloses its content (standard planes and axes) in a frame.
* [[Std Group|Group]] is displayed as a single element linked to its content.
* A [[Std_Group|Groups]] is displayed as a single element linked to its content.


==Limitations== <!--T:28-->
==Limitations== <!--T:28-->


<!--T:29-->
<!--T:29-->
* The dependency graph cannot help with issues caused by [[Glossary#Topological Naming|topological naming]]. If a sketch switches faces of a feature after an edit, it is still linked to the feature; even if some features are broken, the dependency graph will remain unchanged.
* The dependency graph cannot help with the [[Topological_naming_problem|topological naming problem]]. If a sketch switches faces of a feature after an edit, it is still linked to the feature. Even if some features are broken, the dependency graph will remain unchanged.

* A bug in v0.17/v0.18 causes a Body to disappear from the graph and its content to disseminate if a Part or Draft object is created from the Body. This otherwise does not affect the model.

<!--T:40-->
{{Docnav
|[[Std_SceneInspector|SceneInspector]]
|[[Std_ProjectUtil|ProjectUtil]]
|[[Std_Tools_Menu|Std Tools Menu]]
|IconL=Std_SceneInspector.svg
|IconR=Std_ProjectUtil.svg
|IconC=Freecad.svg
}}


</translate>
</translate>
{{Std Base navi{{#translation:}}}}
{{clear}}
{{Userdocnavi{{#translation:}}}}
[[Category:3rd Party{{#translation:}}]]

Latest revision as of 15:38, 20 May 2023

Std DependencyGraph

Menu location
Tools → Dependency graph...
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
None

Description

The Std DependencyGraph command displays the dependencies between objects in the active document in a 'dependency graph'. As opposed to the Tree view, objects are listed in reverse chronological order, with the first created object at the bottom.

It can be useful in analyzing a FreeCAD document and locating forks in a tree. The dependency graph layout will depend on which workbench was used to create the objects in the document. For example a model made exclusively in the PartDesign workbench can display a linear dependency graph with a single vertical branch. A model made with Part operations will have many branches, but for a single part they will join up at the top after Boolean operations. If they don't, it means that they are separate objects.

The dependency graph is purely a visualization tool, therefore it cannot be edited. It automatically updates if changes are made to the model.

Example of a dependency graph with a PartDesign body on the left and an object created with Part operations on the right

Installation

To use the command a third-party software named Graphviz needs to be installed. If you do not have it pre-installed or it is installed in an unconventional location, FreeCAD will display the following dialog:

Windows

Download the graphviz-2.xx installer from the Graphviz Download page and launch it to install it. Some older versions seem to have issues displaying the graph; version 2.38 and newer are known to be reliable. You can find all graphviz releases on Gitlab.

macOS

You can install Graphviz using Homebrew if you have macOS Big Sur (11) (or higher). While installing Homebrew, don't get nervous, if macOS asks you to install updates, e.g. for the Xcode commandline tools. These updates are performed later by the installation process.

brew install graphviz

This installs the Graphviz binaries under /usr/local/bin for macOS on Intel, or /opt/homebrew for macOS on Apple Silicon/ARM. FreeCAD should automatically find these locations. If the Graphviz program is not found you will be asked to specify a path. Unfortunately we can't navigate directly to the program in the file dialog that comes up from Tools → Dependency graph.... There are two options: You can use the key combination Cmd+Shift+. to show hidden items. Or you can use the key combination Cmd+Shift+G to get an input field for the path. Enter one of these paths in the Terminal:

/usr/local/bin

or:

/opt/homebrew/bin

and confirm the input field and the file selection dialog.

In case the Graphviz binaries are installed in a non-standard location try to find the program with the command:

type dot

It will output something like:

dot is /usr/local/bin/dot

And you can tell FreeCAD to look in that directory.

If you don't have macOS Big Sur (11) (or higher) Homebrew might not work, but you can use MacPorts instead. Just download the appropriate version for your OS. Once the installation is complete, enter this command in the Terminal:

sudo port install graphviz

Enter your password and wait while the dependencies are downloaded and installed (it can take some time).

The Graphviz binaries may be under /usr/local/bin or /opt/local/bin/dot. FreeCAD may automatically find the Graphviz program with the file dialog that comes up from Tools → Dependency graph..., if not enter this command:

type dot

It will output something like:

dot is /opt/local/bin/dot

And you can tell FreeCAD to look in that directory as explained before.

It is also possible to make the opt directory visible with this command:

defaults write com.apple.finder AppleShowAllFiles YES;

then:

killall Finder /System/Library/CoreServices/Finder.app;

Therefore you can tell FreeCAD to follow this path. It has been successfully tested on macOS 10.13 (High Sierra).

Linux

On most Linux distributions (Debian/Ubuntu, Fedora, OpenSUSE), you just need to install the Graphviz package from the repositories. However, similar to the macOS, in cases where the Graphviz binaries are installed in a non-standard location, try to find the program with the command:

type dot

It may output something like

dot is /usr/local/bin/dot

And therefore you can point FreeCAD to look in that directory.

Usage

  1. Select the Tools → Dependency graph... option from the menu.
  2. A new tab titled Dependency graph opens in the Main view area.
  3. Use the mouse scroll wheel to zoom in or out.
  4. Use the sliders at the bottom and at the right of the screen to pan the view. Alternatively hold down the left mouse button and move the mouse.

Save

You can save a dependency graph:

  1. Make sure the Dependency graph tab is in the foreground.
  2. Select the File → Save or File → Save As option from the menu.
  3. Enter a filename and select the file type (*.png, *.bmp, *.gif, *.jpg, *.svg or *.pdf).
  4. Press the Save button.

General principles

  • The graph shows objects in reverse chronological order.
  • The direction of arrows showing dependencies should always point down, from the child object to the parent object. An arrow pointing up indicates a cyclic dependency, an issue that needs to be resolved.
  • A sketch that contains links to external geometry will have a number with an 'x' suffix besides the arrow linking it to its parent, showing the number of external geometries linked in the sketch.
  • Objects can have dependencies to multiple parents. For example, for a model built in PartDesign, a Pocket may be linked to its Sketch and to the Pad feature that came before it.
  • Disallowed dependencies (for example, between a Draft/Part operation and an element inside a PartDesign Body) will show with a red arrow. This type of link usually shows a 'Links go out of allowed scope' error in the Report view.
  • A Part container and PartDesign Body enclose their content inside a frame with a randomly colored background. Their Origin also encloses its content (standard planes and axes) in a frame.
  • A Groups is displayed as a single element linked to its content.

Limitations

  • The dependency graph cannot help with the topological naming problem. If a sketch switches faces of a feature after an edit, it is still linked to the feature. Even if some features are broken, the dependency graph will remain unchanged.