Difference between revisions of "Std LinkMake/it"

From FreeCAD Documentation
Jump to navigation Jump to search
(Created page with "I collegamenti si riferiscono al corpo completo. Per creare schiere di funzioni all'interno dello stesso Corpo di PartDesign, usare PartDesign LinearP...")
(Updating to match new version of source page)
 
(28 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{GuiCommand/it
 
{{GuiCommand/it
 
|Name=Std LinkMake
 
|Name=Std LinkMake
|Name/it=Std LinkMake
+
|Name/it=Crea link
 
|MenuLocation=None
 
|MenuLocation=None
 
|Workbenches=Tutti
 
|Workbenches=Tutti
Line 12: Line 12:
 
==Descrizione==
 
==Descrizione==
  
Un [[Std LinkMake/it|App::Link]] o solo [[Std LinkMake/it|Link]] è un tipo di oggetto che fa riferimento a un altro oggetto, nello stesso documento o in un altro documento. È pensato per l'uso in assiemi meccanici in cui un oggetto può apparire più volte, ad esempio viti e bulloni, ma anche altri complessi sottoassiemi.
+
{{Button|[[Image:Std LinkMake.svg|16px]] [[Std LinkMake/it|Crea link]]}} crea un [[App Link/it|App Link]] (classe {{incode|App::Link}}), che è un tipo di oggetto che fa riferimento o collega ad un altro oggetto, nello stesso documento o in un altro documento. È appositamente progettato per duplicare in modo efficiente un singolo oggetto più volte, il che aiuta nella creazione di [[assembly/it|assemblaggi]] complessi da sottoassiemi più piccoli e da più componenti riutilizzabili come viti, dadi e dispositivi di fissaggio simili.
  
Per una semplice duplicazione di oggetti, vedere [[Draft Clone/it|Draft Clone]], [[Draft Array/it|Draft Schiera]], e [[Draft PathArray/it|Draft Copie su tracciato]]. Gli strumenti [[Draft LinkArray/it|Draft LinkArray]] e [[Draft PathLinkArray/it|Draft PathLinkArray]] creano dei collegamenti, Link, anziché semplici copie.
+
L'oggetto [[App_Link/it|App Link]] è stato introdotto di recente nella versione 0.19; in passato, si poteva ottenere una semplice duplicazione di oggetti con {{Button|[[File:Draft_Clone.svg|16px]] [[Draft_Clone/it|Clona]]}} di Draft, ma questa è una soluzione meno efficiente a causa della sua implementazione che essenzialmente crea una copia della [[Part_TopoShape/it|Forma (Shape)]] interna dell'oggetto sorgente. Invece, un link fa riferimento direttamente alla forma originale, quindi è più efficiente in termini di memoria.
  
 +
<div class="mw-translate-fuzzy">
 
I collegamenti si riferiscono al corpo completo. Per creare schiere di funzioni all'interno dello stesso [[PartDesign Body/it|Corpo di PartDesign]], usare [[PartDesign LinearPattern/it|Serie rettangolare]], [[PartDesign PolarPattern/it|Serie polare]], e [[PartDesign_MultiTransform/it|Multi trasformazione]].
 
I collegamenti si riferiscono al corpo completo. Per creare schiere di funzioni all'interno dello stesso [[PartDesign Body/it|Corpo di PartDesign]], usare [[PartDesign LinearPattern/it|Serie rettangolare]], [[PartDesign PolarPattern/it|Serie polare]], e [[PartDesign_MultiTransform/it|Multi trasformazione]].
 +
</div>
  
==How to use==
+
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]]}}.
  
# Select an object for which you wish to make a Link.
+
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]].
# Press the {{Button|[[Image:Std LinkMake.svg|16px]] [[Std LinkMake|Std LinkMake]]}} button. If no object is selected, an empty Link will be created.
 
  
==Properties==
+
== Utilizzo ==
  
=== Data ===
+
Con selezione:
 +
# Selezionare un oggetto nella [[tree_view/it|vista ad albero]] o nella [[3D_view/it|vista 3D]] per il quale si desidera creare un link.
 +
# Premere il pulsante {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake/it|Crea link]]}}. L'oggetto prodotto ha la stessa icona dell'oggetto originale, ma ha una freccia sovrapposta che indica che è un collegamento.
  
 +
Without selection:
 +
# If no object is selected, press the {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} button to create an empty [[File:Link.svg|24px]] Link.
 +
# Go to the [[property_editor|property editor]], then click on the {{PropertyData|Linked Object}} property to open the [[Selection_methods|Link selection dialog]] to choose an object, then press {{Button|OK}}.
 +
# Instead of choosing an entire object in the [[tree_view|tree view]], you can also pick subelements (vertices, edges, or faces) of a single object in the [[3D_view|3D view]]. In this case, the Link will duplicate only these subelements, and the arrow overlay will be different. This can also be done with {{Button|[[File:Std_LinkMakeRelative.svg|16px]] [[Std_LinkMakeRelative|Std LinkMakeRelative]]}}.
 +
 +
[[File:Std_Link_tree_example.png]] [[File:Std_Link_example.png]]
 +
 +
{{Caption|(1) An object, (2) an empty Link, (3) a full Link to the first object (with overriding material), and (4) a Link to only some subelements of the object. The empty Link is not tied to the real object so it is not displayed in the [[3D_view|3D view]].}}
 +
 +
== Usage: external documents ==
 +
 +
# Start with a document that has at least one object which will be the source of the Link.
 +
# Open a new document or an existing document. For easier handling, use {{Button|[[File:Std_TreeMultiDocument.svg|16px]] [[Std_TreeMultiDocument|Std TreeMultiDocument]]}} to show both documents in the [[tree_view|tree view]]. Before you proceed, [[Std_Save|save]] both documents. The Link won't be able to find its source and target unless both documents are saved on disk.
 +
# In the first document, select the object that you wish to link; then switch tabs in the [[main_view_area|main view area]] to switch to the second document.
 +
# Press {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}}. 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.
 +
 +
{{Emphasis|Notes:}}
 +
* When saving the document with the Link, it will also ask to [[Std_Save|save]] the source document which contains the original object.
 +
* To include the original object in the document with the Link, use {{Button|[[File:Std_LinkImport.svg|16px]] [[Std_LinkImport|Std LinkImport]]}} or {{Button|[[File:Std_LinkImportAll.svg|16px]] [[Std_LinkImportAll|Std LinkImportAll]]}}.
 +
* {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} can be used on an existing Link object, in order to create a Link to a Link which ultimately resolves to the original object in the source document. This can be used with {{Button|[[File:Std_LinkMakeRelative.svg|16px]] [[Std_LinkMakeRelative|Std LinkMakeRelative]]}} to pick only certain subelements as well.
 +
 +
[[File:Std_Link_tree_documents_example.png]] [[File:Std_Link_documents_example.png]]
 +
 +
{{Caption|(1, 2) Two objects from a source document linked into a target document, (3) a Link to the second Link (with overriding material), and (4) a Link to the subelements of the second Link.}}
 +
 +
=== Dragging and dropping ===
 +
 +
Instead of switching document tabs, you can create Links by performing a drag and drop operation in the [[tree_view|tree view]]: select the source object from the first document, drag it, then drop it into the second document's name while holding the {{KEY|Alt}} key in the keyboard.
 +
 +
Dragging and dropping results in different actions depending on the modifier key that is held.
 +
* Without modifier key it simply moves the object from one document to the other; an inclined arrow is shown in the cursor.
 +
* Holding the {{KEY|Ctrl}} key copies the object; a plus sign is shown in the cursor.
 +
* Holding the {{KEY|Alt}} key creates a Link; a pair of chain links is shown in the cursor.
 +
 +
For the {{KEY|Ctrl}} and {{KEY|Alt}} modifiers, dragging and dropping can also be done with a single document. That is, dragging an object and dropping it into the same document's name can be used to create multiple copies or multiple Links to it.
 +
 +
== Groups ==
 +
 +
{{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} can be used on {{Button|[[File:Std_Part.svg|16px]] [[Std_Part|Std Parts]]}} in order to quickly duplicate groups of objects positioned in space, that is, [[assembly|assemblies]].
 +
 +
[[File:Std_Link_tree_Std_Part_example.png]]
 +
 +
{{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.}}
 +
 +
A regular {{Button|[[File:Std_Group.svg|16px]] [[Std_Group|Std Group]]}} does not possess a {{PropertyData|Placement}} property, so it cannot control the position of the objects inside of it. However, when {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}} is used with {{Button|[[File:Std_Group.svg|16px]] [[Std_Group|Std Group]]}}, the resulting Link behaves essentially like a {{Button|[[File:Std_Part.svg|16px]] [[Std_Part|Std Part]]}}, and can also be moved in space.
 +
 +
[[File:Std_Link_tree_Std_Group_example.png]] [[File:Std_Link_Std_Group_example.png]]
 +
 +
{{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 overriding material) can be moved in space, just like a [[Std_Part|Std Part]].}}
 +
 +
A Link to a {{Button|[[File:Std_Part.svg|16px]] [[Std_Part|Std Part]]}} will keep the visibility of the objects synchronized with the original Part; so if you hide one object in a Link, it will be hidden in all Links and in the original object. On the other hand a Link to a {{Button|[[File:Std_Group.svg|16px]] [[Std_Group|Std Group]]}} will allow independent control of the visibilities.
 +
 +
[[File:Std_Link_tree_Std_Part_visibility.png]] [[File:Std_Link_tree_Std_Group_visibility.png]]
 +
 +
{{Caption|Left: [[Std_Part|Std Part]] with two objects, and two Links to the Part; the visibility of the objects is synchronized. Right: [[Std_Group|Std Group]] with two objects, and two Links to the Group; the visibility of the objects is independently controlled in each group.}}
 +
 +
== Overriding appearance ==
 +
 +
When a Link is created, by default the {{PropertyView|Override Material}} is {{FALSE}}, so the Link will have the same appearance as the original {{PropertyData|Linked Object}}.
 +
 +
When {{PropertyView|Override Material}} is set to {{TRUE}}, the {{PropertyView|Shape Material}} property will now control the appearance of the Link.
 +
 +
Regardless of the state of {{PropertyView|Override Material}}, it is possible to individually set the appearance of the subelements (vertices, edges, faces) of a Link.
 +
# Select the Link in the [[tree_view|tree view]]. Open the context menu (right-click), and pick {{MenuCommand|Override colors}}.
 +
# Now pick the individual subelements that you want in the [[3D_view|3D view]], press {{Button|Edit}}, and change the properties including transparency.
 +
# To remove the custom attributes, select the elements in the list, and press {{Button|Remove}}.
 +
# When you are satisfied with the result, press {{Button|OK}} to close the dialog.
 +
 +
{{Emphasis|Note:}} as of v0.19, the coloring of the 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 not subject to change any more.
 +
 +
[[File:Std_Link_override_color_example.png|500px]]
 +
 +
{{Caption|(1) An original object, (2) a Link with overriding material, and (3) a second Link with individual modified subelements.}}
 +
 +
== Link Array ==
 +
 +
{{Emphasis|See also:}} [[Draft_OrthoArray|Draft OrthoArray]].
 +
 +
When a Link is created, by default its {{PropertyData|Element Count}} is {{Value|0}}, so only a single Link object will be visible in the [[tree_view|tree view]].
 +
 +
Given that {{PropertyData|Show Element}} is {{TRUE}} by default, when {{PropertyData|Element Count}} is set to {{Value|1}} or more, automatically more Links will be created below the first one; each new Link can be placed in the desired position by changing its own {{PropertyData|Placement}} property.
 +
 +
In similar way, each element of the array can have its own appearance changed, either by the {{PropertyView|Override Material}} and {{PropertyView|Shape Material}} properties, or by using the {{MenuCommand|Override colors}} menu on the entire array and then selecting individual faces; this is described in [[#Overriding_appearance|Overriding appearance]].
 +
 +
[[File:Std_Link_tree_array_example.png]] [[File:Std_Link_array_example.png|500px]]
 +
 +
{{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.}}
 +
 +
Once you are satisfied with the placement and properties of the Link elements in the array, you may change {{PropertyData|Show Element}} to {{FALSE}} in order hide the individual Links in the [[tree_view|tree view]]; this has the benefit of making the system more responsive, particularly if you have many objects in the document.
 +
 +
When creating this type of Link array, you must place each of the elements manually; however, if you would like to use specific patterns to place the copies, you may use the array tools of the [[File:Workbench_Draft.svg|24px]] [[Draft_Module|Draft Workbench]], like {{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]]}}; these commands can create normal copies or Link copies depending on the options at creation time.
 +
 +
== Visibility ==
 +
 +
When {{PropertyData|Show Element}} is {{TRUE}} and individual elements are listed in the [[tree_view|tree view]] in a [[#Link_Array|Link Array]], each Link can be shown or hidden by pressing the {{KEY|Space}} bar in the keyboard.
 +
 +
Another way to hide the individual elements is using the {{MenuCommand|Override colors}} menu.
 +
# Select the array, open the {{MenuCommand|Override colors}} menu (right click).
 +
# In the [[3D_view|3D view]], pick any subelement from any Link in the array.
 +
# Press {{Button|Hide}}. An icon of an eye [[File:Invisible.svg|24px]] should appear, indicating that this element has been hidden from the [[3D_view|3D view]]. The object will temporarily show itself when the cursor hovers over the [[File:Invisible.svg|24px]] icon.
 +
# You can click {{Button|OK}} to confirm the operation and close the dialog. The Link will remain hidden even if it is shown as visible in the [[tree_view|tree view]].
 +
 +
[[File:Std_Link_array_visibility_example.png]]
 +
 +
{{Caption|Element color dialog that is available when opening the context menu of a Link object in the tree view.}}
 +
 +
If you wish to restore the visibility of this array element, enter the dialog once more, pick the eye icon, then click on {{Button|Remove}} to remove the hidden status, and click {{Button|OK}} to confirm and close the dialog. The element will be visible in the [[3D_view|3D view]] again.
 +
 +
When the Link is for a {{Button|[[File:Std_Part.svg|16px]] [[Std_Part|Std Part]]}} or a {{Button|[[File:Std_Group.svg|16px]] [[Std_Part|Std Group]]}}, the {{MenuCommand|Override colors}} menu works in similar way as with arrays; it allows controlling the face color, entire object color, and visibility of the objects in the group.
 +
 +
[[File:Std_Link_Std_Part_visibility_example.png]] [[File:Std_Link_Std_Part_visibility_example_3D.png]]
 +
 +
{{Caption|A [[Std_Part|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 level of transparency.}}
 +
 +
== Proprietà ==
 +
 +
An [[App_Link|App Link]] ({{incode|App::Link}} class) is derived from the basic [[App_DocumentObject|App DocumentObject]] ({{incode|App::DocumentObject}} class), therefore it has the latter's basic properties like {{PropertyData|Label}} and {{PropertyData|Label2}}.
 +
 +
The following are the specific properties available in the [[property editor|property editor]]. Hidden properties can be shown by using the {{MenuCommand|Show all}} command in the context menu of the [[property editor|property editor]].
 +
 +
=== Dati ===
 +
 +
{{TitleProperty| Link}}
 +
 +
<div class="mw-translate-fuzzy">
 
* {{PropertyData|Linked Object}}:
 
* {{PropertyData|Linked Object}}:
 
* {{PropertyData|Link Transform}}:
 
* {{PropertyData|Link Transform}}:
Line 34: Line 162:
 
* {{PropertyData|Element Count}}:
 
* {{PropertyData|Element Count}}:
 
* {{PropertyData|Scale}}:
 
* {{PropertyData|Scale}}:
 +
</div>
  
It will additionally show the properties of the original {{PropertyData|Linked Object}}.
+
{{TitleProperty|Base}}
  
=== View ===
+
* {{PropertyData|Proxy|PythonObject|Hidden}}: a custom class associated with this object. This only exists for the [[Python|Python]] version. See [[Std_LinkMake#Scripting|Scripting]].
  
 +
L'oggetto [[App_Link/it|App Link]] mostra inoltre le proprietà del {{PropertyData|Linked Object}} originale, quindi l'[[property_editor/it|editor  delle proprietà]] può avere gruppi di proprietà come {{TitleProperty|Attachment}} , {{TitleProperty|Box}}, {{TitleProperty|Draft}} e così via.
 +
 +
===Vista===
 +
 +
{{TitleProperty| Link}}
 +
 +
<div class="mw-translate-fuzzy">
 
* {{PropertyView|Draw Style}}:
 
* {{PropertyView|Draw Style}}:
 
* {{PropertyView|Line Width}}:
 
* {{PropertyView|Line Width}}:
Line 45: Line 181:
 
* {{PropertyView|Selectable}}:
 
* {{PropertyView|Selectable}}:
 
* {{PropertyView|Shape Material}}:
 
* {{PropertyView|Shape Material}}:
 +
</div>
 +
 +
* {{PropertyView|Shape Material|Material}}: this property includes sub-properties that describe the appearance of the object.
 +
** {{PropertyView|Diffuse Color}}, it defaults to {{value|(0.4, 1.0, 1.0)}}, which is displayed as {{value|[102, 255, 255]}} on base 255, <span style="background-color:#6ff; color:#222; width:3em; height:12pt; padding: 2px 1em 2px;"> light blue </span>.
 +
** {{PropertyView|Ambient Color}}, it defaults to {{value|(0.2, 0.2, 0.2)}}, which is displayed as {{value|[51, 51, 51]}} on base 255, <span style="background-color:#333; color:#eee; width:3em; height:12pt; padding: 2px 1em 2px;"> dark gray </span>.
 +
** {{PropertyView|Specular Color}}, it defaults to {{value|(0.0, 0.0, 0.0)}}, which is displayed as {{value|[0, 0, 0]}} on base 255, <span style="background-color:#000; color:#eee; width:3em; height:12pt; padding: 2px 1em 2px;"> black </span>.
 +
** {{PropertyView|Emissive Color}}, it defaults to {{value|(0.0, 0.0, 0.0)}}, which is displayed as {{value|[0, 0, 0]}} on base 255, <span style="background-color:#000; color:#eee; width:3em; height:12pt; padding: 2px 1em 2px;"> black </span>.
 +
** {{PropertyView|Shininess}}, it defaults to {{Value|0.2}}
 +
** {{PropertyView|Transparency}}, it defaults to {{Value|0.0}}.
 +
 +
{{TitleProperty|Base}}
 +
 +
* {{PropertyView|Child View Provider|PersistentObject|Hidden}}:
 +
* {{PropertyView|Material List|MaterialList|Hidden}}: {{Emphasis|(read-only)}} if individual materials have been added, they will be listed here.
 +
* {{PropertyView|Override Color List|ColorList|Hidden}}: {{Emphasis|(read-only)}} if the individual faces or edges of the link have been overridden they will be listed here.
 +
* {{PropertyView|Override Material List|BoolList|Hidden}}: {{Emphasis|(read-only)}} if the individual materials of the link have been overridden they will be listed here.
 +
 +
{{TitleProperty|Display Options}}
 +
 +
* {{PropertyView|Display Mode|Enumeration}}: {{Value|'Link'}} or {{Value|'ChildView'}}.
 +
* {{PropertyView|Show In Tree|Bool}}: see the information in [[App_FeaturePython|App FeaturePython]].
 +
* {{PropertyView|Visibility|Bool}}: see the information in [[App_FeaturePython|App FeaturePython]].
 +
 +
{{TitleProperty|Selection}}
 +
 +
* {{PropertyView|On Top When Selected|Enumeration}}: see the information in [[App_FeaturePython|App FeaturePython]].
 +
* {{PropertyView|Selection Style|Enumeration}}: see the information in [[App_FeaturePython|App FeaturePython]].
 +
 +
Mostra inoltre le proprietà Vista dell'originale {{PropertyData|Linked Object}}.
 +
 +
== Inheritance ==
 +
 +
An [[App_Link|App Link]] is formally an instance of the class {{incode|App::Link}}, whose parent is the basic [[App_DocumentObject|App DocumentObject]] ({{incode|App::DocumentObject}} class). It is a very low level object, which can be used with most other document objects.
 +
 +
[[File:FreeCAD_core_objects.svg|800px]]
 +
 +
{{Caption|Simplified diagram of the relationships between the core objects in the program. The {{incode|App::Link}} object is a core component of the system, it does not depend on any workbench, but it can be used with most objects created in all workbenches.}}
 +
 +
== Scripting ==
 +
 +
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]], and [[scripted objects|scripted objects]].
 +
 +
See [[Part_Feature|Part Feature]] for the general information.
 +
 +
An App Link is created with the {{incode|addObject()}} method of the document. It can define its {{PropertyData|Linked Object}} by overriding its {{incode|LinkedObject}} attribute, or by using its {{incode|setLink}} method.
 +
{{Code|code=
 +
import FreeCAD as App
 +
 +
doc = App.newDocument()
 +
bod1 = App.ActiveDocument.addObject("Part::Box", "Box")
 +
bod2 = App.ActiveDocument.addObject("Part::Cylinder", "Cylinder")
 +
bod1.Placement.Base = App.Vector(10, 0, 0)
 +
bod2.Placement.Base = App.Vector(0, 10, 0)
 +
 +
obj1 = App.ActiveDocument.addObject("App::Link", "Link")
 +
obj2 = App.ActiveDocument.addObject("App::Link", "Link")
 +
 +
obj1.LinkedObject = bod1
 +
obj2.setLink(bod2)
 +
obj1.Placement.Base = App.Vector(-10, -10, 0)
 +
obj2.Placement.Base = App.Vector(10, -10, 0)
 +
obj1.ViewObject.OverrideMaterial = True
 +
App.ActiveDocument.recompute()
 +
}}
 +
 +
The basic {{incode|App::Link}} doesn't have a Proxy object so it can't be fully used for sub-classing.
 +
 +
Therefore, for [[Python|Python]] subclassing, you should create the {{incode|App::LinkPython}} object.
 +
 +
{{Code|code=
 +
import FreeCAD as App
 +
 +
doc = App.newDocument()
 +
obj = App.ActiveDocument.addObject("App::LinkPython", "Link")
 +
obj.Label = "Custom label"
 +
}}
 +
 +
== Further reading ==
 +
 +
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].
 +
 +
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)
  
It will additionally show the view properties of the original {{PropertyData|Linked Object}}.
+
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).
  
{{Userdocnavi/it}}
+
{{Std Base navi{{#translation:}}}}
 +
{{Userdocnavi{{#translation:}}}}
 +
{{clear}}

Latest revision as of 17:47, 15 September 2020

Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎русский

Std LinkMake.svg Crea link

Nome nel codice
Std LinkMake
Posizione nel menu
None
Ambiente
Tutti
Avvio veloce
Nessuno
Introdotto nella versione
0.19
Vedere anche
Std Part, Std Group, PartDesign Body


Descrizione

Std LinkMake.svg Crea link crea un App Link (classe App::Link), che è un tipo di oggetto che fa riferimento o collega ad un altro oggetto, nello stesso documento o in un altro documento. È appositamente progettato per duplicare in modo efficiente un singolo oggetto più volte, il che aiuta nella creazione di assemblaggi complessi da sottoassiemi più piccoli e da più componenti riutilizzabili come viti, dadi e dispositivi di fissaggio simili.

L'oggetto App Link è stato introdotto di recente nella versione 0.19; in passato, si poteva ottenere una semplice duplicazione di oggetti con Draft Clone.svg Clona di Draft, ma questa è una soluzione meno efficiente a causa della sua implementazione che essenzialmente crea una copia della Forma (Shape) interna dell'oggetto sorgente. Invece, un link fa riferimento direttamente alla forma originale, quindi è più efficiente in termini di memoria.

I collegamenti si riferiscono al corpo completo. Per creare schiere di funzioni all'interno dello stesso Corpo di PartDesign, usare Serie rettangolare, Serie polare, e Multi trasformazione.

When used with the Workbench PartDesign.svg PartDesign Workbench, Links are intended to be used with PartDesign Body.svg PartDesign Bodies, so it is recommended to set ViewDisplay Mode Body to Tip to select the features of the entire Body, and not the individual features. To create arrays of the internal PartDesign Features, use PartDesign LinearPattern.svg PartDesign LinearPattern, PartDesign PolarPattern.svg PartDesign PolarPattern, and PartDesign MultiTransform.svg PartDesign MultiTransform.

The Std LinkMake.svg Std LinkMake tool 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. The Link object, used in conjunction with Std Part.svg Std Part to group various objects, forms the basis of the Assembly3 workbench icon.svg Assembly3 and Assembly4 workbench icon.svg Assembly4 Workbenches.

Utilizzo

Con selezione:

  1. Selezionare un oggetto nella vista ad albero o nella vista 3D per il quale si desidera creare un link.
  2. Premere il pulsante Std LinkMake.svg Crea link. L'oggetto prodotto ha la stessa icona dell'oggetto originale, ma ha una freccia sovrapposta che indica che è un collegamento.

Without selection:

  1. If no object is selected, press the Std LinkMake.svg Std LinkMake button to create an empty Link.svg Link.
  2. Go to the property editor, then click on the DataLinked Object property to open the Link selection dialog to choose an object, then press OK.
  3. Instead of choosing an entire object in the tree view, you can also pick subelements (vertices, edges, or faces) of a single object in the 3D view. In this case, the Link will duplicate only these subelements, and the arrow overlay will be different. This can also be done with Std LinkMakeRelative.svg Std LinkMakeRelative.

Std Link tree example.png Std Link example.png

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


Usage: external documents

  1. Start with a document that has at least one object which will be the source of the Link.
  2. Open a new document or an existing document. For easier handling, use Std TreeMultiDocument.svg Std TreeMultiDocument to show both documents in the tree view. Before you proceed, save both documents. The Link won't be able to find its source and target unless both documents are saved on disk.
  3. In the first document, select the object that you wish to link; then switch tabs in the main view area to switch to the second document.
  4. Press Std LinkMake.svg Std LinkMake. 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.

Notes:

  • When saving the document with the Link, it will also ask to save the source document which contains the original object.
  • To include the original object in the document with the Link, use Std LinkImport.svg Std LinkImport or Std LinkImportAll.svg Std LinkImportAll.
  • Std LinkMake.svg Std LinkMake can be used on an existing Link object, in order to create a Link to a Link which ultimately resolves to the original object in the source document. This can be used with Std LinkMakeRelative.svg Std LinkMakeRelative to pick only certain subelements as well.

Std Link tree documents example.png Std Link documents example.png

(1, 2) Two objects from a source document linked into a target document, (3) a Link to the second Link (with overriding material), and (4) a Link to the subelements of the second Link.


Dragging and dropping

Instead of switching document tabs, you can create Links by performing a drag and drop operation in the tree view: select the source object from the first document, drag it, then drop it into the second document's name while holding the Alt key in the keyboard.

Dragging and dropping results in different actions depending on the modifier key that is held.

  • Without modifier key it simply moves the object from one document to the other; an inclined arrow is shown in the cursor.
  • Holding the Ctrl key copies the object; a plus sign is shown in the cursor.
  • Holding the Alt key creates a Link; a pair of chain links is shown in the cursor.

For the Ctrl and Alt modifiers, dragging and dropping can also be done with a single document. That is, dragging an object and dropping it into the same document's name can be used to create multiple copies or multiple Links to it.

Groups

Std LinkMake.svg Std LinkMake can be used on Std Part.svg Std Parts in order to quickly duplicate groups of objects positioned in space, that is, assemblies.

Std Link tree Std Part example.png

Link created from a Std Part; the objects are not duplicated but they are listed under the original container and under the Link container.


A regular Std Group.svg Std Group does not possess a DataPlacement property, so it cannot control the position of the objects inside of it. However, when Std LinkMake.svg Std LinkMake is used with Std Group.svg Std Group, the resulting Link behaves essentially like a Std Part.svg Std Part, and can also be moved in space.

Std Link tree Std Group example.png Std Link Std Group example.png

Link created from a Std Group; the objects are not duplicated but they are listed under the original container and under the Link container. The Link (with overriding material) can be moved in space, just like a Std Part.


A Link to a Std Part.svg Std Part will keep the visibility of the objects synchronized with the original Part; so if you hide one object in a Link, it will be hidden in all Links and in the original object. On the other hand a Link to a Std Group.svg Std Group will allow independent control of the visibilities.

Std Link tree Std Part visibility.png Std Link tree Std Group visibility.png

Left: Std Part with two objects, and two Links to the Part; the visibility of the objects is synchronized. Right: Std Group with two objects, and two Links to the Group; the visibility of the objects is independently controlled in each group.


Overriding appearance

When a Link is created, by default the ViewOverride Material is false, so the Link will have the same appearance as the original DataLinked Object.

When ViewOverride Material is set to true, the ViewShape Material property will now control the appearance of the Link.

Regardless of the state of ViewOverride Material, it is possible to individually set the appearance of the subelements (vertices, edges, faces) of a Link.

  1. Select the Link in the tree view. Open the context menu (right-click), and pick Override colors.
  2. Now pick the individual subelements that you want in the 3D view, press Edit, and change the properties including transparency.
  3. To remove the custom attributes, select the elements in the list, and press Remove.
  4. When you are satisfied with the result, press OK to close the dialog.

Note: as of v0.19, the coloring of the subelements is subject to the topological naming problem so it should be done as the last modelling step, when the model is not subject to change any more.

Std Link override color example.png

(1) An original object, (2) a Link with overriding material, and (3) a second Link with individual modified subelements.


Link Array

See also: Draft OrthoArray.

When a Link is created, by default its DataElement Count is 0, so only a single Link object will be visible in the tree view.

Given that DataShow Element is true by default, when DataElement Count is set to 1 or more, automatically more Links will be created below the first one; each new Link can be placed in the desired position by changing its own DataPlacement property.

In similar way, each element of the array can have its own appearance changed, either by the ViewOverride Material and ViewShape Material properties, or by using the Override colors menu on the entire array and then selecting individual faces; this is described in Overriding appearance.

Std Link tree array example.png Std Link array example.png

(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.


Once you are satisfied with the placement and properties of the Link elements in the array, you may change DataShow Element to false in order hide the individual Links in the tree view; this has the benefit of making the system more responsive, particularly if you have many objects in the document.

When creating this type of Link array, you must place each of the elements manually; however, if you would like to use specific patterns to place the copies, you may use the array tools of the Workbench Draft.svg Draft Workbench, like Draft OrthoArray.svg Draft OrthoArray, Draft PolarArray.svg Draft PolarArray, and Draft CircularArray.svg Draft CircularArray; these commands can create normal copies or Link copies depending on the options at creation time.

Visibility

When DataShow Element is true and individual elements are listed in the tree view in a Link Array, each Link can be shown or hidden by pressing the Space bar in the keyboard.

Another way to hide the individual elements is using the Override colors menu.

  1. Select the array, open the Override colors menu (right click).
  2. In the 3D view, pick any subelement from any Link in the array.
  3. Press Hide. An icon of an eye Invisible.svg should appear, indicating that this element has been hidden from the 3D view. The object will temporarily show itself when the cursor hovers over the Invisible.svg icon.
  4. You can click OK to confirm the operation and close the dialog. The Link will remain hidden even if it is shown as visible in the tree view.

Std Link array visibility example.png

Element color dialog that is available when opening the context menu of a Link object in the tree view.


If you wish to restore the visibility of this array element, enter the dialog once more, pick the eye icon, then click on Remove to remove the hidden status, and click OK to confirm and close the dialog. The element will be visible in the 3D view again.

When the Link is for a Std Part.svg Std Part or a Std Group.svg Std Group, the Override colors menu works in similar way as with arrays; it allows controlling the face color, entire object color, and visibility of the objects in the group.

Std Link Std Part visibility example.png Std Link Std Part visibility example 3D.png

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 level of transparency.


Proprietà

An App Link (App::Link class) is derived from the basic App DocumentObject (App::DocumentObject class), therefore it has the latter's basic properties like DataLabel and DataLabel2.

The following are the specific properties available in the property editor. Hidden properties can be shown by using the Show all command in the context menu of the property editor.

Dati

Link

  • DataLinked Object:
  • DataLink Transform:
  • DataPlacement:
  • DataSub Elements:
  • DataShow Elements:
  • DataElement Count:
  • DataScale:

Base

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

L'oggetto App Link mostra inoltre le proprietà del DataLinked Object originale, quindi l'editor delle proprietà può avere gruppi di proprietà come Attachment , Box, Draft e così via.

Vista

Link

  • ViewDraw Style:
  • ViewLine Width:
  • ViewOverride Material:
  • ViewPoint Size:
  • ViewSelectable:
  • ViewShape Material:
  • 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.

Display Options

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

Selection

Mostra inoltre le proprietà Vista dell'originale DataLinked Object.

Inheritance

An App Link is formally an instance of the class App::Link, whose parent is the basic App DocumentObject (App::DocumentObject class). It is a very low level object, which can be used with most other document objects.

FreeCAD core objects.svg

Simplified diagram of the relationships between the core objects in the program. The App::Link object is a core component of the system, it does not depend on any workbench, but it can be used with most objects created in all workbenches.


Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

See Part Feature for the general information.

An App Link is created with the addObject() method of the document. It can define its DataLinked Object by overriding its LinkedObject attribute, or by using its setLink method.

import FreeCAD as App

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

obj1 = App.ActiveDocument.addObject("App::Link", "Link")
obj2 = App.ActiveDocument.addObject("App::Link", "Link")

obj1.LinkedObject = bod1
obj2.setLink(bod2)
obj1.Placement.Base = App.Vector(-10, -10, 0)
obj2.Placement.Base = App.Vector(10, -10, 0)
obj1.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.

Therefore, for Python subclassing, you should create the App::LinkPython object.

import FreeCAD as App

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

Further reading

The App Link object was introduced after 2 years of development and prototyping. This component was thought and developed almost single-handedly by user realthunder. The motivations and design implementations behind this project are described in his GitHub page, Link. In order to accomplish this feature, several core changes to FreeCAD were made; these were also extensively documented in Core-Changes.

The App Link project started after the redesign of the PartDesign Workbench was complete in v0.17. The history of App Link can be traced to some essential forum threads:

Finally, the pull request and merge happened: