HKScene

@objc
public class HKScene : NSObject

HKScene manages the current scene and the scene objects

  • The title of the current loaded scene.

    Declaration

    Swift

    @objc
    public var title: String
  • The text description of the current loaded scene.

    Declaration

    Swift

    @objc
    public var text: String
  • The text description of the current loaded scene, if it is broken into sections

    Declaration

    Swift

    @objc
    public var textSections: [[String : String]]
  • A flat unordered list of visible objects in the current scene

    Declaration

    Swift

    @objc
    public var objectIds: [String]
  • A map of objectIDs to display names

    Declaration

    Swift

    @objc
    public var objects: [String : String]
  • Brings up the built-in iOS share UI with the current contents of the view

    Declaration

    Swift

    @objc
    public func share(from: CGRect)
  • Captures a screenshot and triggers the screenshot callback in HKHumanDelegate

    Declaration

    Swift

    @objc
    public func screenshot()
  • Reset the scene objects to the current scene’s original state

    Note

    This does not reset the camera, there is a separate function for that

    Declaration

    Swift

    @objc
    public func reset()

Object Selection and Manipulation

  • Hide a group of obects by object ID Groups of objects can be hidden by passing more than one objectID or by passing a “group node” ID

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func hide(objectIds: [String])

    Parameters

    objectIds

    An array of object IDs to hide

  • Show a group of obects by object ID Groups of objects can be shown by passing more than one objectID or by passing a “group node” ID

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func show(objectIds: [String])

    Parameters

    objectIds

    An array of object IDs to show

  • Isolate a group of obects by object ID Groups of objects can be shown by passing more than one objectID or by passing a “group node” ID

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func isolate(objectIds: [String])

    Parameters

    objectIds

    An array of object IDs to isolate

  • Select a group of objects programatically

    Declaration

    Swift

    @objc
    public func select(objectIds: [String])

    Parameters

    objectIds

    An array of object IDs to select

  • Deselect all objects in the scene

    Declaration

    Swift

    @objc
    public func undoSelections()
  • Change the highlight color

    Declaration

    Swift

    @objc
    public func setHighlightColor(color: UIColor)

    Parameters

    color

    Selected objects are yellow by default, set this to use a different color

  • Change the object highlight color back to the original yellow color

    Declaration

    Swift

    @objc
    public func resetHighlightColor()
  • Disable object highlighting

    Declaration

    Swift

    @objc
    public func disableHighlight()
  • Enable object highlighting

    Declaration

    Swift

    @objc
    public func enableHighlight()
  • Highlight an object even if highlight is disabled for the user

    Declaration

    Swift

    @objc
    public func highlight(objectIds: [String])

    Parameters

    objectIds

    object to highlight

  • unhighlight an object

    Declaration

    Swift

    @objc
    public func unhighlight(objectId: String)

    Parameters

    objectId

    object to unhighlight

  • Prevent objects from being selected

    Declaration

    Swift

    @objc
    public func disablePicking()
  • Allow objects to be selected

    Declaration

    Swift

    @objc
    public func enablePicking()
  • Enables labels to appear when an object is selected, this is the default behavior, unless disabled

    Declaration

    Swift

    @objc
    public func showLabels()
  • Hides all object labels and disables future labels from appearing on selected objects

    Declaration

    Swift

    @objc
    public func hideLabels()
  • Turn xray mode ON or OFF in the current scene

    Declaration

    Swift

    @objc
    public func xray(_ enabled: Bool)

    Parameters

    enabled

    A boolean to turn xray mode ON or OFF

Painting

  • Set the color of an object

    Declaration

    Swift

    @objc
    public func color(objectId: String, color: HKColor)
  • Unset the color of a scene object

    Declaration

    Swift

    @objc
    public func uncolor(objectId: String)

    Parameters

    objectId

    object ID to uncolor

  • Get the color of a scene object

    Since

    Since:SDK 2.0

    Calls human(_:colorObject:color:) on success

    Declaration

    Swift

    @objc
    public func getColor(objectId: String)

    Parameters

    objectId

    object ID to uncolor

manipulate object

  • Move an object in 3D space

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func translateObject(objectId: String, translate: [Double])

    Parameters

    objectid

    object to transform

    translate

    [x,y,z] array amount to move the object]

  • Rotate an object in 3D space

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func rotateObject(objectId: String, rotate: [Double])

    Parameters

    objectid

    object to transform

    rotate

    [x,y,z] array amount to rotate the object]

  • Scale an object in 3D space

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func scaleObject(objectId: String, scale: [Double])

    Parameters

    objectid

    object to transform

    scale

    [x,y,z] array amount to scale the object]

  • Pivot an object in 3D space

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func pivotObject(objectId: String, pivot: [Double])

    Parameters

    objectid

    object to transform

    pivot

    [x,y,z] array amount to rotate the object]

  • Move an object in 3D space

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func transformObject(objectId: String, translate: [Double], rotate: [Double], scale: [Double], pivot: [Double])

    Parameters

    objectid

    object to transform

    translate

    [x,y,z] array amount to move the object]

    rotate

    [x,y,z] array amount to rotate the object]

    scale

    [x,y,z] array amount to scale the object]

    pivot

    [x,y,z] array amount to rotate the object]

capture and restore

  • Capture the current state of the scene

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func capture()
  • Restore the scene from the previous capture Calls human(_:sceneRestored:) on success

    Since

    SDK 2.0

    Declaration

    Swift

    @objc
    public func restore()

Deprecated

  • Select an object programatically

    Declaration

    Swift

    @available(*, deprecated, message: "Please use select(objectIds:﹚ instead")
    @objc
    public func selectObject(objectID: String)

    Parameters

    objectID

    the object you want to select Deprecated in SDK 2.0. Please use selectObjects(objectIds:) instead

  • Select an object programatically - Parameter objectID: the object you want to select Deprecated in SDK 2.0. Please use selectObjects(objectIds:) instead

    Declaration

    Swift

    @available(*, deprecated, message: "Please use select(objectIds:﹚ instead")
    @objc
    public func selectObjectWithGroup(objectID: String, group: [String])
  • Turn isolate mode ON or OFF in the current scene This will isolate any selected objects and set the SDK to isolate any user selected object

    Declaration

    Swift

    @available(*, deprecated, message: "Please use isolate(objectIds:﹚")
    @objc
    public func isolate(_ enabled: Bool)

    Parameters

    enabled

    A boolean to turn isolate mode ON or OFF

  • Turn dissect mode ON or OFF in the current scene

    Declaration

    Swift

    @available(*, deprecated, message: "Please use hide(objectIds:﹚")
    @objc
    public func dissect(_ enabled: Bool)

    Parameters

    enabled

    A boolean to turn dissect mode ON or OFF

  • Undo the last dissect Deprecated in API 2.0 use showObjects(objIds:) instead

    Declaration

    Swift

    @available(*, deprecated, message: "Please use show(objectIds:﹚")
    @objc
    public func undo()
  • Set the color of an object

    Declaration

    Swift

    @available(*, deprecated, renamed: "color(objectId:color:﹚")
    @objc
    public func colorObject(id: String, color: HKColor)
  • Unset the color of a scene object

    Declaration

    Swift

    @available(*, deprecated, renamed: "uncolor(objectId:﹚")
    @objc
    public func uncolorObject(id: String)
  • unHighlight an object
    

    Declaration

    Swift

    @available(*, renamed: "unhighlight(objectId:﹚")
    @objc
    public func unhighlightObject(objectid: String)

    Parameters

    objectId

    object to unhighlight