Documentation Home
v1.22 v1.23
v1.22 v1.23

XR Center CLI

Intro

image-20260326-094442.png

XR Center provides a CLI tool to interact and manage some workflows. This solution can be preferred to using the API as it can handle full workflows without having to handle authentication or code.

This CLI tool is exposed throught the executable Skr.XRCenter.Cmd.exe and follows POSIX conventions. Values returned are formatted into json.

Configure the CLI

Ensure that the json configuration file of the CLI matches the configuration of your XR Center.
By default, it can be found at %programdata%/Skr/xrcenter-cmd/xrcenter-cmd.json


image-20260326-095402.png
Must match what’s declared in xrcenter.json configuration file

Get the documentation

The CLI is auto-documented : you can access it via using -?, -h or --help on any command.

image-20260326-095705.png
documentation example for CAD related commands with cad -?


Command reference

Every command follows the pattern Skr.XRCenter.Cmd.exe <group> <command> [arguments] [options]. Add -? to any command to see its exact arguments and options.

XR Center CLI commands

health

Command

What it does

ping

Checks the configuration and the connection to XR Center. -n / --number sets how many calls to make (1 by default).

workspace

Command

What it does

create

Creates a workspace (--name, --description).

get

Returns a workspace (JSON).

search

Searches workspaces by name (JSON array).

update

Updates a workspace.

delete

Deletes a workspace.

export

Exports a workspace to a file.

import

Imports a workspace from a file.

cleanup

Cleans up the data of a workspace.

cad

Command

What it does

import

Imports a CAD file into the 3D Library and prepares its visualization (JSON output).

addtoexperience

Adds a CAD from the 3D Library to an experience.

addtoexperience-extid

Same, using the CAD external ID.

preparevisualization

Prepares the 3D visualization of an imported CAD (or of any Product3DComponent).

preparevisualization-extid

Same, using the CAD external ID.

get-infos

Returns the information linked to a 3D Library element.

get-infos-extId

Same, using the CAD external ID.

delete

Deletes a CAD.

delete-extid

Same, using the CAD external ID.

experience

Command

What it does

create

Creates an experience (--name, --description, --experience-type Classic or Editor).

get

Returns an experience (JSON).

get-extid

Same, using the experience external ID.

get-infos

Returns the information linked to an experience.

get-infos-extid

Same, using the experience external ID.

update

Updates an experience.

delete

Deletes an experience.

delete-extid

Same, using the experience external ID.

generate-visualization

Generates the VR visualization of an experience.

migrate

Migrates the visualization of an experience to the latest engine version.

External IDs

To drive XR Center from another system (a PLM, a script…), map your own identifiers to XR Center elements:

  • cad import --ext-id <id> and experience create --ext-id <id> store your ID with the new element.

  • The -extid commands then take this ID instead of the XR Center one: no need to keep track of XR Center IDs.

  • --copy-authorizations-ext-id <id> copies the access rights of another element, given by its external ID.

Main CAD import options

Option

Effect

--sag

Tessellation precision (1 by default).

--safe-mode

Uses the legacy SkyPrep import settings and ignores the other Spatial options, for more stability.

--visu-first

Tries to extract the CAD visualization before tessellating, and falls back automatically.

--merge-meshes-polygon-threshold

Merges meshes up to this number of polygons (100,000 by default, 0 to disable).

--split-heavy-meshes-threshold

Splits meshes above this number of polygons (disabled by default, 1,500,000 recommended).

--multi-process

Imports using several processes.

--deduplicate-instance

Deduplicates instances during import.

--discard-graphical-pmi

Skips graphical PMI to import faster (recommended for CATIA V5).

--jt-translate-all-properties

Translates all JT properties.

--expand-part-structure

Expands the Part3D structure (bigger product tree).

--disable-3d-engine-visualization

Skips the 3D engine visualization step.

--allow-non-commercial-files

Accepts files from education-licensed CAD software.

How to

Are are some sample powershell scripts that you can find at %programdata%/Skr/xrcenter-cmd/docs

Create a workspace

PowerShell
### Create new workspace ###
$WorkspaceName = "Workspace Name"
$WorkspaceDescription = "Workspace Description"
Write-Output "Create a new workspace ($WorkspaceName)"

$WorkspaceJson = Invoke-Expression "&'$CliExePath' workspace create --name '$WorkspaceName' --description '$WorkspaceDescription'"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
$WorkspaceObject = ConvertFrom-Json $WorkspaceJson
$WorkspaceId = $WorkspaceObject.EntityId
Write-Output "$WorkspaceJson"
Write-Output "Workspace created with ID $WorkspaceId`r`n"

Import CAD

PowerShell
### Import cad into 3d lib and prepare visualization ###
# Define your workspaceId and CadPath to your values #
$WorkspaceId = "019d29a3-e3cf-718b-9321-368b87ccde83"
$Cad1Path = "C:\pathToYourCad\SphereProduct.CATProduct"

Write-Output "Import CAD in workspace 3D lib ('$Cad1Path')"

$Cad1RootId = Invoke-Expression "&'$CliExePath' cad import $WorkspaceId '$Cad1Path'"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
Write-Output "Cad imported with Root Id $Cad1RootId`r`n"

Create and compose and experience

Full script showing how to create a workspace, import 2 cads into the 3D Library, create an experience and add the 2 newly imported Data Library elements from the 3D Library to it.


PowerShell
### XrCenter CLI path ###
$CliExePath = "C:\SkyRealSuite\master\XRCenterCLI\Skr.XRCenter.Cmd.exe"
$DateTime = Get-Date -DisplayHint Date

If (!(Test-Path -Path $CliExePath -PathType Leaf)) {
	Write-Output "ERROR file path $CliExePath doesn't exists"
	Return
}

### Ping XR Center ###
Write-Output "Ping XR-Center"
$PingResult = Invoke-Expression "&'$CliExePath' health ping"
if ($PingResult.Contains("failed")) {
	Write-Output "Unable to connect to XR Center"
	Return
}

### Create new workspace ###
$WorkspaceName = Get-Date -UFormat "%A_%m/%d/%Y_%R"
$WorkspaceDescription = $DateTime
Write-Output "Create a new workspace ($WorkspaceName)"

$WorkspaceJson = Invoke-Expression "&'$CliExePath' workspace create --name '$WorkspaceName' --description '$WorkspaceDescription'"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
$WorkspaceObject = ConvertFrom-Json $WorkspaceJson
$WorkspaceId = $WorkspaceObject.EntityId
Write-Output "Workspace created with ID $WorkspaceId`r`n"

### Create new Experience ###
Write-Output "Create a new experience (in workspace $WorkspaceId)"

$ExperienceName = "Experience Name"
$ExperienceDescription = "Experience Description"

$ExperienceJson = Invoke-Expression "&'$CliExePath' experience create $WorkspaceId --name '$ExperienceName' --description '$ExperienceDescription'" 
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
$ExperienceObject = ConvertFrom-Json $ExperienceJson
$ExperienceId = $ExperienceObject.EntityId

Write-Output "Experience created with ID $ExperienceId`r`n"

### Import 1st cad 3d lib ###
$Cad1Path = "C:\ProgramData\Skr\xrcenter-cmd\docs\sphere\SphereProduct.CATProduct"
Write-Output "Import CAD in workspace 3D lib ('$Cad1Path')"

$Cad1RootId = Invoke-Expression "&'$CliExePath' cad import $WorkspaceId '$Cad1Path'"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
Write-Output "Cad imported with Root Id $Cad1RootId`r`n"

### Import 2nd cad 3d lib ###
$Cad2Path = "C:\ProgramData\Skr\xrcenter-cmd\docs\plane\planes.CATProduct"
Write-Output "Import CAD in workspace 3D lib ('$Cad2Path')"

$Cad2RootId = Invoke-Expression "&'$CliExePath' cad import $WorkspaceId '$Cad2Path'"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}
Write-Output "Cad imported with Root Id $Cad2RootId`r`n"

### Add CAD1 to experience ###
Write-Output "Add CAD with Root Id $Cad1RootId to experience $ExperienceId"

Invoke-Expression "&'$CliExePath' cad addtoexperience $WorkspaceId $ExperienceId $Cad1RootId --disable-3d-engine-visualization true"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}

Write-Output "Cad added to experience`r`n"

### Add CAD2 to experience ###
Write-Output "Add CAD with Root Id $Cad2RootId to experience $ExperienceId"

Invoke-Expression "&'$CliExePath' cad addtoexperience $WorkspaceId $ExperienceId $Cad2RootId --disable-3d-engine-visualization true"
if (!($LASTEXITCODE -eq 0)) {
	Write-Output "An error occured"
	Return
}

Write-Output "Cad added to experience`r`n"