Here the Tcl code, check the comments, about 11 commands and the component is assembled.
I hope that helps to understand the process. You can use less than 11 lines, if you later understand what you doing here😉 You only need to map this to toolkit calls, probably > 11
# are comments
#———————————————-
# Vars for the models to be used
set ASSY assy.asm
set PART mode.prt
# Create two selection objects
# including named model items
# one for the assembly reference
# one for the component reference
# Note: The model item is initialized
ps_sel AssySelObj -modelitem AssyMiObj
ps_sel CompSelObj -modelitem CompMiObj
# A csys for sure has a name
# Note: The Feature ID of the CSYS is not the ID, which is used later
# The Geometric ID will be used
# set data, fill csys geometric id, type and owner.
#
# one for the assembly
# one for the component
# This two calls will setup the model items with valid values
# if the given name and type is valid
# the csys names are ACS0 and CS0
# now fill the modelitem by name and type
AssyMiObj byname $ASSY csys ACS0
CompMiObj byname $PART csys CS0
#
# create the constraint Object
#
ps_asmconstraint constraintObj
#
# setup the type by 'csys'
#
constraintObj config -constrainttype CSYS
#
# set the info, same as manually done in Creo after selecting the references
For the simplest case, assembly a component at csys from the target assembly, you may have to setup table_num and comp_id_table to -1 if you don‘t use NULL for the CompPath in the selection reference..
Check how you setup the selection, you can init this one as well only with a modelitem.
If you want to assemble the component and use a csys in the tree structure, you must supply the comppath to this model, and the model handle in assembly selection.