Std LinkMakeRelative

From FreeCAD Documentation
Revision as of 18:24, 11 September 2020 by Vocx (talk | contribs) (Std LinkMakeRelative creates an App Link but it operates on selected subelements first, and sets the Link Transform to true.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Std LinkMakeRelative

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

Description

Std LinkMakeRelative creates an App Link (App::Link class), just like Std LinkMake, but it operates on selected subelements first, and sets the DataLink Transform to true.

Usage

With selection:

  1. Select a subelement in the 3D view, this means a vertex, edge, or face, or any combination of these. These subelements must belong to a single object.
  2. Press the Std LinkMakeRelative button. The produced object has the same icon as the original object, but has two arrow overlays indicating it is a relative Link.

Without selection:

  • If no object is selected, this command does nothing.
  • If an object is selected in the tree view only, but no subelement is selected in the 3D view, the command does nothing either.

Properties

All properties are described in Std LinkMake.

In particular, DataLink Transform is set to true, so DataPlacement becomes hidden, and instead DataLink Placement controls the position of the Link with respect to the position of DataLinked Object.

Scripting

See Std LinkMake for the general information.

An App Link is created with the addObject() method of the document. It can define its DataLinked Object by by using its setLink method with the names of the subelements.

import FreeCAD as App

doc = App.newDocument()
bod1 = App.ActiveDocument.addObject("PartDesign::Body", "Body")
bod2 = App.ActiveDocument.addObject("Part::Box", "Box")

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

obj1.LinkedObject = bod1
obj2.setLink(bod2)
App.ActiveDocument.recompute()