|
Расположение в меню |
---|
Нет |
Верстаки |
Все |
Быстрые клавиши |
Нет |
Представлено в версии |
0.19 |
См. также |
"Создать деталь", "Создать группу", "PartDesign Body" |
Std LinkMake creates an App Link (
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 assemblies from smaller subassemblies, and from multiple reusable components like screws, nuts, and similar fasteners.
The App Link object was newly introduced in v0.19; in the past, simple duplication of objects could be achieved with Draft Clone, but this is a less efficient solution due to its implementation, which essentially creates a copy of the internal Shape of the source object. Instead, a Link directly references the original Shape, so it is more memory-efficient.
By itself the Link object can behave like an array, duplicating its base object many times; this can be done by setting its ДанныеElement Count property to 1
or larger. This "Link Array" object can also be created with the different array tools of the Draft Workbench, for example,
Draft OrthoArray,
Draft PolarArray, and
Draft CircularArray.
When used with the PartDesign Workbench, Links are intended to be used with
PartDesign Bodies, so it is recommended to set ВидDisplay 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,
PartDesign PolarPattern, and
PartDesign MultiTransform.
The 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 to group various objects, forms the basis of the
Assembly3 and
Assembly4 Workbenches.
With selection:
Without selection:
(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.
Notes:
(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.
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.
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.
Std LinkMake can be used on
Std Parts in order to quickly duplicate groups of objects positioned in space, that is, assemblies.
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 does not possess a ДанныеPlacement property, so it cannot control the position of the objects inside of it. However, when
Std LinkMake is used with
Std Group, the resulting Link behaves essentially like a
Std Part, and can also be moved in space.
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 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 will allow independent control of the visibilities.
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.
When a Link is created, by default the ВидOverride Material is false
, so the Link will have the same appearance as the original ДанныеLinked Object.
When ВидOverride Material is set to true
, the ВидShape Material property will now control the appearance of the Link.
Regardless of the state of ВидOverride Material, it is possible to individually set the appearance of the subelements (vertices, edges, faces) of a Link.
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.
(1) An original object, (2) a Link with overriding material, and (3) a second Link with individual modified subelements.
See also: Draft OrthoArray.
When a Link is created, by default its ДанныеElement Count is 0
, so only a single Link object will be visible in the tree view.
Given that ДанныеShow Element is true
by default, when ДанныеElement 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 ДанныеPlacement property.
In similar way, each element of the array can have its own appearance changed, either by the ВидOverride Material and ВидShape Material properties, or by using the Override colors menu on the entire array and then selecting individual faces; this is described in Overriding appearance.
(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 ДанныеShow 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 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.
When ДанныеShow 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.
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 or a
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.
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.
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 ДанныеLabel and ДанныеLabel2.
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.
Link
LinkSubHidden
): list of Link elements that have had their color overriden.IntegerConstraint
): Link element count. It defaults to 0
. If it is 1
or larger, the App Link will behave like an array, and will duplicate the same ДанныеLinked Object many times. If ДанныеShow Elements is true
, each element in the array will be displayed in the tree view, and each can have its own ДанныеPlacement 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.LinkList
): the list of Link elements.Bool
): Claim the linked object as a childEnumeration
):
Disabled
: disable the creation of a copy of the linked object, triggered by a change of any of its properties set as CopyOnChange
.Enabled
: enable a deep copy of the linked object if any of its properties marked as CopyOnChange
are changed. After the deep copy is performed, there won't be any linkage between the original and the copied object. Therefore, changes in the original object won't be reflected in the copies.Owned
: indicates that the linked object has been copied and is owned by the Link. This state is set automatically by the Link itself, a user would normally not do that. The link will try to sync any change of the original linked object back to the copy (Editor's note: the latter seems not to be implemented in FreeCAD main).Tracking
: same as Enabled
, but additionally the copy will be automatically refreshed if the original source object changes.Link
): Linked to a internal group object for holding on change copiesXLink
): The copy on change source objectBool
): Indicating the copy on change source object has been changedString
): name of the execute function that will run for this particular Link object. It defaults to 'appLinkExecute'
. Set it to 'None'
to disable it.Placement
): it is an offset applied on top of the ДанныеPlacement of the ДанныеLinked Object. This property is normally hidden but appears if ДанныеLink Transform is set to true
; in this case, ДанныеPlacement now becomes hidden.Bool
): it defaults to false
, in which case the Link will override the ДанныеLinked Object's own placement. If it is set to true
, the Link will be placed in the same position as the ДанныеLinked Object, and its placement will be relative to the ДанныеLinked Object's placement. This can also be achieved with 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).Placement
): the placement of the Link in absolute coordinates.PlacementList
): The placement for each Link elementFloat
): 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
.VectorList
): the scale factor for each Link element.Vector
): the scale factor for each component (X, Y, Z)
for all Link elements when ДанныеElement Count is 1
or larger. If ДанныеScale is other than 1.0
, this same value will be used in the three components.Bool
): it defaults to true
, in which case the tree view will show the individual Link copies, as long as ДанныеElement Count is 1
or larger.LinkList
): TBDInteger
): TBDBool
): TBDОсновные
PythonObject
): a custom class associated with this object. This only exists for the Python version. See Scripting.The App Link object will additionally show the properties of the original ДанныеLinked Object, so the property editor may have groups of properties like Attachment, Box, Draft, etc.
Link
Enumeration
): it defaults to None
; it can be Solid
, Dashed
, Dotted
, Dashdot
; defines the style of the edges in the 3D view.FloatConstraint
): a float that determines the width in pixels of the edges in the 3D view. It defaults to 2.0
.Bool
): it defaults to false
; if set to true
it will override the ДанныеLinked Object's material, and it will display the colors defined in ВидShape Material.FloatConstraint
): similar to ВидLine Width, defines the size of the vertices.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
.Material
): this property includes sub-properties that describe the appearance of the object.
(0.4, 1.0, 1.0)
, which is displayed as [102, 255, 255]
on base 255, light blue .(0.2, 0.2, 0.2)
, which is displayed as [51, 51, 51]
on base 255, dark gray .(0.0, 0.0, 0.0)
, which is displayed as [0, 0, 0]
on base 255, black .(0.0, 0.0, 0.0)
, which is displayed as [0, 0, 0]
on base 255, black .0.2
0.0
.Основные
PersistentObject
):MaterialList
): (read-only) if individual materials have been added, they will be listed here.ColorList
): (read-only) if the individual faces or edges of the link have been overridden they will be listed here.BoolList
): (read-only) if the individual materials of the link have been overridden they will be listed here.Display Options
Enumeration
): 'Link'
or 'ChildView'
.Bool
): see the information in App FeaturePython.Bool
): see the information in App FeaturePython.Selection
Enumeration
): see the information in App FeaturePython.Enumeration
): see the information in App FeaturePython.It will additionally show the view properties of the original ДанныеLinked Object.
Объект App Link формально является экземпляром класса App::Link
, родителем которого является базовый App DocumentObject (класс App::DocumentObject
). Это объект очень низкого уровня, который можно использовать с большинством других объектов документа.
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.
Смотрите так же: Основы составления скриптов в FreeCAD, и скриптовые объекты.
See Part Feature for the general information.
An App Link is created with the addObject()
method of the document. It can define its ДанныеLinked 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"
If you want to skip the historical details, go to the user-oriented introduction to links.
Объект App Link был представлен после двух лет разработки и прототипирования. Этот компонент был задуман и спроектирован практически в одиночку пользователем realthunder. Мотивация и реализация дизайна этого проекта описаны на его странице в GitHub, ссылка. Чтобы завершить эту функцию, в ядре FreeCAD были сделаны несколько изменений; это было подробно документировано в Изменениях-Ядра.
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:
Other miscellaneous "links" about Link include: