Create

sceneplates/create.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2#
 3# Example to show how to insert front plates
 4#
 5# vrSceneplateService is used to create new scene plates
 6# vrdSceneplateNode is used to change scene plate properties
 7#
 8
 9# We introduce this types to make the code more readable
10NodeType = vrSceneplateTypes.NodeType
11ContentType = vrSceneplateTypes.ContentType
12PositionType = vrSceneplateTypes.Position
13
14# This function summarizes all necessary steps to create a scene plate and set its properties.
15# First we have to create a node using the scene plate service and convert this to an plate.
16# Then we set different properties of the new created plate. 
17def createPlate(root, name, position):
18    theNode = vrSceneplateService.createNode(root, NodeType.Frontplate, name)
19    thePlate = vrdSceneplateNode(theNode)
20    thePlate.setContentType(ContentType.Text)
21    thePlate.setText(name)
22    theFontColor = QVector3D(0.0, 0.2, 1.0)
23    thePlate.setFontColor(theFontColor)
24    thePlate.setPosition(position)
25
26# Query parent object for all scene plate creation
27theRoot = vrSceneplateService.getRootNode()
28
29# Create text front plates attached to windows sides
30createPlate(theRoot, "0", PositionType.Center)
31createPlate(theRoot, "1", PositionType.TopLeft)
32createPlate(theRoot, "2", PositionType.Top)
33createPlate(theRoot, "3", PositionType.TopRight)
34createPlate(theRoot, "4", PositionType.Right)
35createPlate(theRoot, "5", PositionType.BottomRight)
36createPlate(theRoot, "6", PositionType.Bottom)
37createPlate(theRoot, "7", PositionType.BottomLeft)
38createPlate(theRoot, "8", PositionType.Left)