Creating Objects and Loads that Have Body Views

To show body views for custom objects or loads, you define the callback onDrawBodyViews. This callback allows entities to show body views in the same fashion as for native connection objects such as joints, contact region, and so on. With this callback, you can set the properties of a single-body view or a two-body view. Properties include the pane name, scoping, and whether to show the body view.

The return value from this callback determines whether to show body views. The callback gets passed in three arguments: a user load, view one, and view two, respectively.

  • View one corresponds to the top pane in the body views as seen in the default pane layout.

  • View two corresponds to the bottom pane.

A view has two properties that can be set on it:

  • Name of the pane

  • Selection to display in the pane

An example follows of the IronPython code:

def OnDrawBodyViews(load, view1, view2):
    view1.Name = "View 1"
    view2.Name = "View 2"

    view1.Selection = load.Properties["Scoping1"].Value
    view2.Selection = load.Properties["Scoping2"].Value

    return True

To show a single body view, you do not set a pane name value for view two:

def OnDrawBodyViewsBodyToGround(load, view1, view2):
    view1.Name = "Body 1"
    view1.Selection = load.Properties["Scoping1"].Value
    return True


Note:  Scopings supported by this feature are the same as those supported by native connection objects:

  • Faces

  • Bodies

  • Vertices

  • Edges

  • Element Faces



Tip:  In Template12-BodyView, you can see an example where this callback is implemented. To download all Mechanical templates, on the App Developer Resources page, click the ACT Templates tab and then click ACT Templates for Mechanical.