Sandbox:Roy 043: Difference between revisions

From FreeCAD Documentation
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 24: Line 24:


<!--T:3-->
<!--T:3-->
{{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} creates an [[App_Link|App Link]] ({{incode|App::Link}} class), a type of object that references or links to another object, in the same document, or in another document. It is especially designed to efficiently duplicate a single object multiple times, which helps with the creation of complex [[assembly|assemblies]] from smaller subassemblies, and from multiple reusable components like screws, nuts, and similar fasteners.
The '''Std LinkMake''' command creates [[App_Link|App Links]] ({{incode|App::Link}} class). An App Link, or Link for short, is an object that references, links, to another object in the same document, or in another document. It is especially designed to efficiently duplicate a single object multiple times and forms the basis of the [[Assembly3_Workbench|Assembly3 Workbench]] and the [[Assembly4_Workbench|Assembly4 Workbench]].

<!--T:4-->
The [[App_Link|App Link]] object was newly introduced in v0.19; in the past, simple duplication of objects could be achieved with {{Button|[[File:Draft_Clone.svg|16px]] [[Draft_Clone|Draft Clone]]}}, but this is a less efficient solution due to its implementation which essentially creates a copy of the internal [[Part_TopoShape|Shape]] of the source object. On the other hand, a Link references directly the original Shape, so it is more memory efficient.


<!--T:5-->
<!--T:5-->
By itself the [[App_Link|Link]] object can behave like an array, duplicating its base object many times; this can be done by setting its {{PropertyData|Element Count}} property to {{Value|1}} or larger. This "[[#Link_Array|Link Array]]" object can also be created with the different array tools of the [[File:Workbench_Draft.svg|24px]] [[Draft_Workbench|Draft Workbench]], for example, {{Button|[[File:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|Draft OrthoArray]]}}, {{Button|[[File:Draft_PolarArray.svg|16px]] [[Draft_PolarArray|Draft PolarArray]]}}, and {{Button|[[File:Draft_CircularArray.svg|16px]] [[Draft_CircularArray|Draft CircularArray]]}}.
A [[App_Link|Link]] object can optionally behave like an array by duplicating its base object several times. This [[#Link_Array|Link Array]] object can also be created with the different array tools of the [[Draft_Workbench|Draft Workbench]].

<!--T:47-->
When used with the [[File:Workbench_PartDesign.svg|24px]] [[PartDesign_Workbench|PartDesign Workbench]], Links are intended to be used with {{Button|[[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|PartDesign Bodies]]}}, so it is recommended to set {{PropertyView|Display Mode Body}} to {{Value|Tip}} to select the features of the entire Body, and not the individual features. To create arrays of the internal [[PartDesign_Feature|PartDesign Features]], use {{Button|[[File:PartDesign_LinearPattern.svg|16px]] [[PartDesign_LinearPattern|PartDesign LinearPattern]]}}, {{Button|[[File:PartDesign_PolarPattern.svg|16px]] [[PartDesign_PolarPattern|PartDesign PolarPattern]]}}, and {{Button|[[File:PartDesign_MultiTransform.svg|16px]] [[PartDesign_MultiTransform|PartDesign MultiTransform]]}}.


<!--T:18-->
<!--T:18-->
The {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} tool is not defined by a particular workbench, but by the base system, thus it is found in the {{MenuCommand|structure toolbar}} that is available in all [[Workbenches|workbenches]]. The Link object, used in conjunction with {{Button|[[File:Std_Part.svg|16px]] [[Std_Part|Std Part]]}} to group various objects, forms the basis of the [[File:Assembly3_workbench_icon.svg|24px]] [[Assembly3_Workbench|Assembly3]] and [[File:Assembly4_workbench_icon.svg|24px]] [[Assembly4_Workbench|Assembly4 Workbenches]].
The '''Std LinkMake''' command is not defined by a particular workbench, but by the base system, thus it is found in the {{MenuCommand|structure toolbar}} that is available in all [[Workbenches|workbenches]].

... The produced object has the same icon as the original object, but has an arrow overlay indicating it is a Link.

.... The produced object has the same icon as the original object, but has an additional arrow overlay indicating it is a Link coming from an external document.



==Usage== <!--T:6-->
==Usage== <!--T:6-->
Line 82: Line 71:


<!--T:49-->
<!--T:49-->
{{Caption|(1) An object, (2) an empty Link, (3) a full Link to the first object (with material override), and (4) a Link to only some subelements of the object. The empty Link is not tied to a real object so it is not displayed in the [[3D_view|3D view]].}}
{{Caption|(1) An object, (2) an empty Link, (3) a full Link to the first object (with overridden material), and (4) a Link to only some subelements of the object. The empty Link is not tied to a real object so it is not displayed in the [[3D_view|3D view]].}}


<!--T:53-->
<!--T:53-->
Line 97: Line 86:
# Hold down the {{KEY|Alt}} key.
# Hold down the {{KEY|Alt}} key.
# Drag the selection to the document label of the current document or an external document.
# Drag the selection to the document label of the current document or an external document.
# The cursor will change.
# The cursor icon will change.
# Drop the selection.
# Drop the selection.


Line 112: Line 101:
# Each Link element in the array can be positioned individually by changing its own {{PropertyData|Placement}} property.
# Each Link element in the array can be positioned individually by changing its own {{PropertyData|Placement}} property.
# In a similar way, each element in the array can have its own appearance. See [[#Override appearance|Override appearance]] below.
# In a similar way, each element in the array can have its own appearance. See [[#Override appearance|Override appearance]] below.
# Once you are satisfied with the placement and properties of the Link elements in the array, you can change {{PropertyData|Show Element}} to {{FALSE}} in order to hide them in the [[Tree_view|Tree view]]. This has the benefit of making the system more responsive.
# Once you are satisfied with the placement and properties of the Link elements in the array, you can change {{PropertyData|Show Element}} to {{FALSE}} in order to hide them in the [[Tree_view|Tree view]].


<!--T:77-->
<!--T:77-->
Line 118: Line 107:


<!--T:78-->
<!--T:78-->
{{Caption|(1) Original object, and (2, 3, 4) a Link array with three elements, each in a different position. The first Link has overridden material and transparent faces, the other two have custom face colors.}}
{{Caption|(1) Original object, and (2, 3, 4) a Link array with three elements, each in a different position. The first Link has an overridden material and transparent faces, the other two have custom face colors.}}


=== Notes ===
=== Notes ===
Line 129: Line 118:
<!--T:60-->
<!--T:60-->
[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]] can be used on [[File:Std_Part.svg|16px]] [[Std_Part|Std Parts]] in order to quickly duplicate groups of objects, [[assembly|assemblies]], positioned in space. A Link to a Part will keep the visibility of its child objects synchronized with that Part. If you hide a child object in the Link, it will be hidden in the original Part, as well as in all other Links to that Part.
[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]] can be used on [[File:Std_Part.svg|16px]] [[Std_Part|Std Parts]] in order to quickly duplicate groups of objects, [[assembly|assemblies]], positioned in space. A Link to a Part will keep the visibility of its child objects synchronized with that Part. If you hide a child object in the Link, it will be hidden in the original Part, as well as in all other Links to that Part.

<!--T:61-->
[[File:Std_Link_tree_Std_Part_example.png]]

<!--T:62-->
{{Caption|Link created from a [[Std_Part|Std Part]]. The objects are not duplicated but they are listed under the original container and under the Link container.}}


== Link to Std Group ==
== Link to Std Group ==
Line 141: Line 124:
A regular [[File:Std_Group.svg|16px]] [[Std_Group|Std Group]] does not have a {{PropertyData|Placement}} property, so it cannot control the position of its child objects. However when [[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]] is used on a [[File:Std_Group.svg|16px]] [[Std_Group|Std Group]] the resulting Link does have a {{PropertyData|Placement}} and, like a [[File:Std_Part.svg|16px]] [[Std_Part|Std Part]], can control the position of its child objects. A Link to a Group allows independent control of the visibility of its child objects.
A regular [[File:Std_Group.svg|16px]] [[Std_Group|Std Group]] does not have a {{PropertyData|Placement}} property, so it cannot control the position of its child objects. However when [[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]] is used on a [[File:Std_Group.svg|16px]] [[Std_Group|Std Group]] the resulting Link does have a {{PropertyData|Placement}} and, like a [[File:Std_Part.svg|16px]] [[Std_Part|Std Part]], can control the position of its child objects. A Link to a Group allows independent control of the visibility of its child objects.


== Link to PartDesign Body ==
<!--T:64-->

[[File:Std_Link_tree_Std_Group_example.png]] [[File:Std_Link_Std_Group_example.png]]
A Link can be created from a [[PartDesign_Body|PartDesign Body]], but not from its individual features. To avoid selecting them instead of the Body, it is recommended to set the {{PropertyView|Display Mode Body}} property to {{Value|Tip}}.


== Link to Link ==
<!--T:65-->
{{Caption|Link created from a [[Std_Group|Std Group]]. The objects are not duplicated but they are listed under the original container and under the Link container. The Link (with material override) can be moved in space, just like a [[Std_Part|Std Part]].}}


== Override appearance == <!--T:66-->
== Override appearance == <!--T:66-->
Line 173: Line 156:
#*# The subelements are hidden in the 3D view and are added to the list with an eye icon [[File:Invisible.svg|16px]].
#*# The subelements are hidden in the 3D view and are added to the list with an eye icon [[File:Invisible.svg|16px]].
#*# When the cursor is over a hidden subelement in the list, it is temporarily made visible in the [[3D_view|3D view]].
#*# When the cursor is over a hidden subelement in the list, it is temporarily made visible in the [[3D_view|3D view]].
# Optionally remove some custom attributes:
# To remove custom attributes:
## Select one or more elements in the list.
## Select one or more elements in the list.
## Press the {{Button|Remove}} button.
## Press the {{Button|Remove}} button.
# Optionally press the {{Button|Remove all}} button to remove all custom attributes from the Link
# Optionally press the {{Button|Remove all}} button to remove all custom attributes from the Link.
# Press the {{Button|OK}} button to close task panel.
# Press the {{Button|OK}} button to close task panel.


<!--T:91-->
<!--T:91-->
[[File:Std_Link_Std_Part_visibility_example.png]] [[File:Std_Link_Std_Part_visibility_example_3D.png]]
[[File:Std_Link_Std_Part_visibility_example.png|x242px]] [[File:Std_Link_Std_Part_visibility_example_3D.png|x242px]]


<!--T:92-->
<!--T:92-->
Line 188: Line 171:


* The coloring of subelements is subject to the [[Topological_naming_problem|topological naming problem]] so it should be done as the last modelling step, when the model is no longer subject to change.
* The coloring of subelements is subject to the [[Topological_naming_problem|topological naming problem]] so it should be done as the last modelling step, when the model is no longer subject to change.
* The individual elements in a Link Array are listed in the [[Tree_view|Tree view]] if {{PropertyData|Show Element}} is {{TRUE}} and can then be shown or hidden by pressing the {{KEY|Space}} bar. Which generally makes more sense than using the {{MenuCommand|Override colors...}} option to accomplish the same.
* The individual elements in a Link Array are listed in the [[Tree_view|Tree view]] if {{PropertyData|Show Element}} is {{TRUE}} and can then be shown or hidden by pressing the {{KEY|Space}} bar. This generally makes more sense than using the {{MenuCommand|Override colors...}} option to control their visibility.
* If the {{MenuCommand|Alpha channel}} option is missing in the {{MenuCommand|Select Color}} dialog then add this Boolean preference: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Dialog → DontUseNativeColorDialog}}, and set it to {{FALSE}}. See [[Std_DlgParameter|Std DlgParameter]] and [[Fine-tuning|Fine-tuning]] for more information.
* If the {{MenuCommand|Alpha channel}} option is missing in the {{MenuCommand|Select Color}} dialog then add this Boolean preference: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Dialog → DontUseNativeColorDialog}}, and set it to {{FALSE}}. See [[Std_DlgParameter|Std DlgParameter]] and [[Fine-tuning|Fine-tuning]] for more information.


Line 324: Line 307:
}}
}}
<translate>
<translate>

== Further reading == <!--T:45-->

<!--T:46-->
The [[App_Link|App Link]] object was introduced after 2 years of development and prototyping. This component was thought and developed almost single-handedly by user {{Emphasis|realthunder}}. The motivations and design implementations behind this project are described in his GitHub page, [https://github.com/realthunder/FreeCAD_assembly3/wiki/Link Link]. In order to accomplish this feature, several core changes to FreeCAD were made; these were also extensively documented in [https://github.com/realthunder/FreeCAD_assembly3/wiki/Core-Changes Core-Changes].

<!--T:23-->
The App Link project started after the redesign of the [[PartDesign Workbench|PartDesign Workbench]] was complete in v0.17. The history of App Link can be traced to some essential forum threads:
* [https://forum.freecadweb.org/viewtopic.php?f=19&t=21505 Why an object can only be inside one App::Part?] (March 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=21586 Introducing App::Link/XLink] (March 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=20&t=22216 Links] (May 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=20&t=23015 Realthunder Link implementation: Architecture discussion] (June 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=17&t=23419 PR #876: Link, stage one, context aware selection] (July 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=17&t=23626 Preview: Link, stage two, API groundwork] (July 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=20&t=25712 Assembly3 preview] (December 2017)
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=29542 Merging of my Link branch] (June 2018)

<!--T:24-->
Finally, the pull request and merge happened:
* [https://forum.freecadweb.org/viewtopic.php?f=27&t=38621 App::Link: the big merge], old thread (July 2019), [https://github.com/FreeCAD/FreeCAD/pull/2350 pull request #2350] (the BIG merge), [https://github.com/realthunder/FreeCAD/tree/LinkMerge LinkMerge branch].
* [https://forum.freecadweb.org/viewtopic.php?f=8&t=37757 App::Link: the big merge], main thread (July 2019)
* [https://forum.freecadweb.org/viewtopic.php?p=329054#p329054 A simple path description of Link, 019, Link stage, Asm3, merge?] (August 2019)
* [https://forum.freecadweb.org/viewtopic.php?f=17&t=39672 PR#2559: expose link and navigation actions], an introduction to the Link feature in 0.19 (September 2019).

<!--T:95-->
Other miscellaneous "links" about Link include:
* [[Dynamic linked object]] - A pattern with Link and assemblies that aims to reduce duplication of assembly related logic such as orientation, positioning, or number of instances.





Latest revision as of 20:33, 22 February 2022


Std LinkMake

Menu location
None
Workbenches
All
Default shortcut
None
Introduced in version
0.19
See also
Std Part, Std Group, PartDesign Body

Description

The Std LinkMake command creates App Links (App::Link class). An App Link, or Link for short, is an object that references, links, to another object in the same document, or in another document. It is especially designed to efficiently duplicate a single object multiple times and forms the basis of the Assembly3 Workbench and the Assembly4 Workbench.

A Link object can optionally behave like an array by duplicating its base object several times. This Link Array object can also be created with the different array tools of the Draft Workbench.

The Std LinkMake command is not defined by a particular workbench, but by the base system, thus it is found in the structure toolbar that is available in all workbenches.

Usage

Same document

  1. Select one or more objects.
  2. There are several ways to invoke the command:
    • Press the Make link button.
    • Select the Link actions → Make link option from the Tree view context menu or 3D view context menu.
  3. For each selected object a Link is created.

External document

  1. If required change the Tree view DocumentMode to MultiDocument with the Std TreeMultiDocument command.
  2. Open a source document and a target document.
  3. Select one or more objects in the source document.
  4. Switch to the target document by clicking its tab in the Main view area.
  5. Press the Make link button.
  6. For each selected object a Link is created.

Start with empty Link

  1. Make sure no object is selected.
  2. There are several ways to invoke the command:
    • Press the Make link button.
    • Select the Link actions → Make link option from the Tree view context menu or 3D view context menu.
  3. An empty Link is created.
  4. In the Property editor click in the DataLinked Object field of the Link.
  5. Press the ... button.
  6. The Link dialog opens.
  7. Do one of the following:
    • Select an object from the same document.
    • Switch to an external document by clicking its tab in the Main view area, and select an object there.
  8. In both cases you can also select a subelement from an object in the 3D view. This will create a Sub-Link. See Std LinkMakeRelative.
  9. Press the OK button.

(1) An object, (2) an empty Link, (3) a full Link to the first object (with overridden material), and (4) a Link to only some subelements of the object. The empty Link is not tied to a real object so it is not displayed in the 3D view.

(1, 2) Two objects from a source document linked into a target document, (3) a Link to the second Link (its tab in the Main view area), and (4) a Link to the subelements of the second Link.

Drag and drop

You can also create Links by performing a drag and drop operation in the Tree view.

  1. Select one or more objects in the Tree view.
  2. Hold down the Alt key.
  3. Drag the selection to the document label of the current document or an external document.
  4. The cursor icon will change.
  5. Drop the selection.

Notes

  • When linking to an object in an external document both the source document and the target document have to be saved at least once. This is required to determine the relative path for the Link.

Link Array

A Link can be turned into an array where each element has its own placement and appearance.

  1. Make sure the DataShow Element property of the Link is set to true (this is the default).
  2. Change the DataElement Count of the Link to 1 or more. Using 1 results in an array with a single element, so you will typically use a value of 2 or more.
  3. Each Link element in the array can be positioned individually by changing its own DataPlacement property.
  4. In a similar way, each element in the array can have its own appearance. See Override appearance below.
  5. Once you are satisfied with the placement and properties of the Link elements in the array, you can change DataShow Element to false in order to hide them in the Tree view.

(1) Original object, and (2, 3, 4) a Link array with three elements, each in a different position. The first Link has an overridden material and transparent faces, the other two have custom face colors.

Notes

  • When creating this type of Link Array, you must place each of the elements manually. If you need a patterned array you should use the array tools of the Draft Workbench, like Draft OrthoArray, Draft PolarArray, and Draft CircularArray. These commands can create normal copies or Link copies depending on the options at creation time.

Link to Std Part

Std LinkMake can be used on Std Parts in order to quickly duplicate groups of objects, assemblies, positioned in space. A Link to a Part will keep the visibility of its child objects synchronized with that Part. If you hide a child object in the Link, it will be hidden in the original Part, as well as in all other Links to that Part.

Link to Std Group

A regular Std Group does not have a DataPlacement property, so it cannot control the position of its child objects. However when Std LinkMake is used on a Std Group the resulting Link does have a DataPlacement and, like a Std Part, can control the position of its child objects. A Link to a Group allows independent control of the visibility of its child objects.

Link to PartDesign Body

A Link can be created from a PartDesign Body, but not from its individual features. To avoid selecting them instead of the Body, it is recommended to set the ViewDisplay Mode Body property to Tip.

Link to Link

Override appearance

By default a Link has the same appearance as the original DataLinked Object. There are two options, which can be combined, to override that.

Override material

If the ViewOverride Material property of a Link is set to true, its ViewShape Material property will control its appearance. Note that if the ViewOverride Material property of a Link Array is set to true, the individual ViewOverride Material properties of its elements are ignored.

Override colors

It is possible to change the appearance of individual subelements (vertices, edges and faces) of a Link. Sublements can also be child objects inside Links to Parts and Groups, and elements in a Link Array. Apart from changing their appearance, subelements can also be hidden.

  1. Select a Link in the Tree view.
  2. Right-click and select the Override colors... option from the context menu.
  3. The Set element color task panel opens.
  4. Pick one or more subelements in the 3D view.
  5. Do one of the following:
    • To change the appearance of the subelements:
      1. Press the Edit button.
      2. Specify the color and transparency in the Select Color dialog.
      3. The subelements receive the selected color and transparency, and are added to the list with a color swatch.
    • To hide the subelements:
      1. Press the Hide button.
      2. The subelements are hidden in the 3D view and are added to the list with an eye icon .
      3. When the cursor is over a hidden subelement in the list, it is temporarily made visible in the 3D view.
  6. To remove custom attributes:
    1. Select one or more elements in the list.
    2. Press the Remove button.
  7. Optionally press the Remove all button to remove all custom attributes from the Link.
  8. Press the OK button to close task panel.

A Std Part containing three objects, and a Link to that Part. In the Link, (1) the first object is made invisible, (2) the second object has some subelements with different colors, (3) the entire third object has a different color and a level of transparency.

Notes

  • The coloring of subelements is subject to the topological naming problem so it should be done as the last modelling step, when the model is no longer subject to change.
  • The individual elements in a Link Array are listed in the Tree view if DataShow Element is true and can then be shown or hidden by pressing the Space bar. This generally makes more sense than using the Override colors... option to control their visibility.
  • If the Alpha channel option is missing in the Select Color dialog then add this Boolean preference: Tools → Edit parameters... → BaseApp → Preferences → Dialog → DontUseNativeColorDialog, and set it to false. See Std DlgParameter and Fine-tuning for more information.

Properties

The App Link (App::Link class) is derived from the basic App DocumentObject (App::DocumentObject class) and inherits all its properties.

The following are the specific properties available in the Property editor. The App Link will additionally show the properties of the original DataLinked Object. The names of these linked properties appear in green in the Property editor. Hidden properties can be shown by using the Show all command in the context menu of the Property editor.

Data

Link

  • DataLinked Object (XLink): it indicates the source object of the App Link; this can be an entire object, or a subelement of it (vertex, edge, or face).
  • DataLink Transform (Bool): it defaults to false, in which case the Link will override the DataLinked Object's own placement. If it is set to true, the Link will be placed in the same position as the DataLinked Object, and its placement will be relative to the DataLinked Object's placement. This can also be achieved with Std LinkMakeRelative.
  • Data (Hidden)Link Placement (Placement): it is an offset applied on top of the DataPlacement of the DataLinked Object. This property is normally hidden but appears if DataLink Transform is set to true; in this case, DataPlacement now becomes hidden.
  • DataPlacement (Placement): the placement of the Link in absolute coordinates.
  • DataShow Element (Bool): it defaults to true, in which case the Tree view will show the individual Link copies, as long as DataElement Count is 1 or larger.
  • DataElement Count (IntegerConstraint): it defaults to 0. If it is 1 or larger, the App Link will behave like an array, and will duplicate the same DataLinked Object many times. If DataShow Elements is true, each element in the array will be displayed in the Tree view, and each can have its own DataPlacement modified. Each Link copy will have a name based on the Link's Name, augmented by _iN, where N is a number starting from 0. For example, with a single Link, the copies will be named Link_i0, Link_i1, Link_i2, etc.
  • DataLink Execute (String): name of the execute function that will run for this particular Link object. It defaults to 'appLinkExecute'. Set it to 'None' to disable it.
  • Data (Hidden)Colored Elements (LinkSubHidden): list of Link elements that have had their color overriden.
  • DataLink Copy On Change (Enumeration): Disabled or Enabled.
  • DataScale (Float): it defaults to 1.0. It is a factor for uniform scaling in each direction X, Y, and Z. For example, a cube of 2 mm x 2 mm x 2 mm, that is scaled by 2.0, will result in a shape with dimensions 4 mm x 4 mm x 4 mm.
  • Data (Hidden)Scale Vector (Vector): the scale factor for each component (X, Y, Z) for all Link elements when DataElement Count is 1 or larger. If DataScale is other than 1.0, this same value will be used in the three components.
  • DataScale List (VectorList): the scale factor for each Link element.
  • Data (Hidden)Visibility List (BoolList): (read-only) the visibility state of each Link element, either true or false.
  • Data (Hidden)Placement List (PlacementList): (read-only) the placement for each Link element.
  • Data (Hidden)Element List (LinkList): the list of Link elements.
  • Data (Hidden)_ Link Touched (Bool):
  • Data (Hidden)_ Child Cache (LinkList):
  • Data (Hidden)_ Link Owner (Integer):

Base

  • Data (Hidden)Proxy (PythonObject): a custom class associated with this object. This only exists for the Python version. See Scripting.

View

Link

  • ViewDraw Style (Enumeration): it defaults to None; it can be Solid, Dashed, Dotted; defines the style of the edges in the 3D view.
  • ViewLine Width (FloatConstraint): a float that determines the width in pixels of the edges in the 3D view. It defaults to 2.0.
  • ViewOverride Material (Bool): it defaults to false; if set to true it will override the DataLinked Object's material, and it will display the colors defined in ViewShape Material.
  • ViewPoint Size (FloatConstraint): similar to ViewLine Width, defines the size of the vertices.
  • ViewSelectable (Bool): if it is true, the object can be picked with the pointer in the 3D view. Otherwise, the object cannot be selected until this option is set to true.
  • ViewShape Material (Material): this property includes sub-properties that describe the appearance of the object.
    • ViewDiffuse Color, it defaults to (0.4, 1.0, 1.0), which is displayed as [102, 255, 255] on base 255, light blue .
    • ViewAmbient Color, it defaults to (0.2, 0.2, 0.2), which is displayed as [51, 51, 51] on base 255, dark gray .
    • ViewSpecular Color, it defaults to (0.0, 0.0, 0.0), which is displayed as [0, 0, 0] on base 255, black .
    • ViewEmissive Color, it defaults to (0.0, 0.0, 0.0), which is displayed as [0, 0, 0] on base 255, black .
    • ViewShininess, it defaults to 0.2
    • ViewTransparency, it defaults to 0.0.

Base

  • View (Hidden)Child View Provider (PersistentObject):
  • View (Hidden)Material List (MaterialList): (read-only) if individual materials have been added, they will be listed here.
  • View (Hidden)Override Color List (ColorList): (read-only) if the individual faces or edges of the link have been overridden they will be listed here.
  • View (Hidden)Override Material List (BoolList): (read-only) if the individual materials of the link have been overridden they will be listed here.
  • View (hidden)Proxy (PythonObject): a custom viewprovider class associated with this object. This only exists for the Python version. See Scripting.

Display Options

  • View (Hidden)Display Mode (Enumeration): Link or ChildView.
  • ViewShow In Tree (Bool): see the information in App FeaturePython.
  • ViewVisibility (Bool): see the information in App FeaturePython.

Selection

Scripting

See also: FreeCAD Scripting Basics and scripted objects.

See Part Feature for the general information on adding objects to the document.

An App Link is created with the addObject() method of the document. its DataLinked Object can be defined by changing its LinkedObject property, or by using its setLink method.

import FreeCAD as App

doc = App.newDocument()
obj1 = App.ActiveDocument.addObject("Part::Box", "Box")
obj2 = App.ActiveDocument.addObject("Part::Cylinder", "Cylinder")
obj1.Placement.Base = App.Vector(10, 0, 0)
obj2.Placement.Base = App.Vector(0, 10, 0)

link1 = App.ActiveDocument.addObject("App::Link", "Link")
link2 = App.ActiveDocument.addObject("App::Link", "Link")

link1.LinkedObject = obj1
link2.setLink(obj2)
link1.Placement.Base = App.Vector(-10, -10, 0)
link2.Placement.Base = App.Vector(10, -10, 0)
link1.ViewObject.OverrideMaterial = True
App.ActiveDocument.recompute()

The basic App::Link doesn't have a Proxy object so it can't be fully used for sub-classing.

For Python subclassing you should create a App::LinkPython object.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("App::LinkPython", "Link")
obj.Label = "Custom label"